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

操作系统:RedHat EL55

OracleOracle 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

@至此,问题解决!

Oracle用户密码包含特殊字符导致sqlplus无法正常登录解决

rlwrap - 解决Linux下SQLPLUS退格、上翻键乱码问题

SQLPLUS spool 到动态日志文件名

Oracle SQLPLUS提示符设置

通过设置SQLPLUS ARRAYSIZE(行预取)加快SQL返回速度

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a02052cdb1ac7c77008a612b868fe87a.html