Oracle RAC 注册数据库Sqlplus无法识别

程序艺术 2014-05-23

系统环境:

操作系统:RedHat EL55

Oracle : Oracle 11.2.0.1.0

集群软件:Oracle GI 11.2.0.1.0

错误现象

[oracle@node1 ~]$ srvctl add database -d stddb -o /u01/app/oracle/product/11.2.0/db_1/ -n cuug

[oracle@node1 ~]$ srvctl add instance -d stddb -i stddb1 -n node1

[oracle@node1 ~]$ srvctl add instance -d stddb -i stddb2 -n node2

[oracle@node1 ~]$ srvctl config database -d stddb

Database unique name: stddb

Database name: cuug

Oracle home: /u01/app/oracle/product/11.2.0/db_1/

Oracle user: oracle

Spfile:

Domain:

Start options: open

Stop options: immediate

Database role: PRIMARY

Management policy: AUTOMATIC

Server pools: stddb

Database instances: stddb1,stddb2

Disk Groups:

Services:

Database is administrator managed

[oracle@node1 ~]$

通过crs启动数据库:

[oracle@node1 ~]$ srvctl start database -d stddb

[oracle@node1 admin]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Wed May 21 19:09:19 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

通过sqlplus连接Instance:


[oracle@node1 admin]$ sqlplus sys/oracle@stddb as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed May 21 19:09:09 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

SQL> select instance_name,status from gv$instance;

INSTANCE_NAME    STATUS

---------------- ------------

stddb1          OPEN

stddb2          OPEN

[oracle@node1 admin]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 - Production on Thu May 22 16:24:20 2014

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

尽然连接的是idle的instance

解决方法

[oracle@node1 ~]$ srvctl add database -d stddb -o $ORACLE_HOME -n cuug

将Oracle软件包的主目录换成变量!

[oracle@node1 ~]$ srvctl add instance -d stddb -i stddb1 -n node1

[oracle@node1 ~]$ srvctl add instance -d stddb -i stddb2 -n node2

[oracle@node1 ~]$ srvctl start database -d stddb

[oracle@node1 ~]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Wed May 21 19:18:37 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

SQL> select instance_name,status from gv$instance;

 


INSTANCE_NAME    STATUS

---------------- ------------

stddb1          OPEN

stddb2          OPEN

[oracle@node2 admin]$ export ORACLE_SID=stddb2

[oracle@node2 admin]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Wed May 21 19:19:53 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

@至此,问题解决!

相关推荐