操作系统为Oracle Linux 7.1 数据库为Oracle 12.2.0.1,今天在登录pdb时使用sysdba权限登录正常,使用非sysdba权限登录出现ora-01033错误,错误信息如下:
[root@jytest1 ~]# su - oracle Last login: Tue May 16 18:32:29 CST 2017 [oracle@jytest1 ~]$ sqlplus /nolog SQL*Plus: Release 12.2.0.1.0 Production on Tue May 16 18:39:42 2017 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL> conn sys/xxzx7817600@jypdb as sysdba Connected. SQL> conn jy/jy@jypdb ERROR: ORA-01033: ORACLE initialization or shutdown in progress Process ID: 0 Session ID: 0 Serial number: 0 Warning: You are no longer connected to ORACLE.
在MOS上有篇文档” Connecting To A 12c RAC Pluggable Database Intermittently Fails With ORA-1033 (Doc ID 1998112.1)”描述相关问题,原因有两个,一是pdb所使用的服务名与pdb数据库名相同,二是PDB没有在所有RAC实例上open,说使用pdb数据库名作为服务名对于RAC来说不是一个最佳方案,因为当实例使用SCAN来注册pdb名时并且节点监听到pdb被mounted。这可能造成连接被发送到pdb被mounted的实例上,当以非sysdba权限登录时就会出现ora-0133错误。
pdb的服务名确实是使用pdb名作为其服务名
[grid@jytest1 ~]$ lsnrctl status LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 16-MAY-2017 18:42:17 Copyright (c) 1991, 2016, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 02-MAY-2017 11:14:02 Uptime 14 days 7 hr. 28 min. 15 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/product/12.2.0/crs/network/admin/listener.ora Listener Log File /u01/app/grid/diag/tnslsnr/jytest1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.175)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.171)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=jytest1.jydba.net)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.2.0/db/admin/jy/xdb_wallet))(Presentation=HTTP)(Session=RAW)) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_CRS" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_DATA" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_TEST" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "4b2c6373ae2547cce053ab828a0a7ca3" has 1 instance(s). Instance "jy1", status READY, has 1 handler(s) for this service... Service "4e0ba8d9d278217be053ab828a0a1330" has 1 instance(s). Instance "jycs1", status READY, has 1 handler(s) for this service... Service "jy" has 1 instance(s). Instance "jy1", status READY, has 1 handler(s) for this service... Service "jyXDB" has 1 instance(s). Instance "jy1", status READY, has 1 handler(s) for this service... Service "jycs" has 1 instance(s). Instance "jycs1", status READY, has 1 handler(s) for this service... Service "jycsXDB" has 1 instance(s). Instance "jycs1", status READY, has 1 handler(s) for this service... Service "jycspdb" has 1 instance(s). Instance "jycs1", status READY, has 1 handler(s) for this service... Service "jypdb" has 1 instance(s). Instance "jy1", status READY, has 1 handler(s) for this service... Service "orcl" has 1 instance(s). Instance "orcl1", status READY, has 1 handler(s) for this service... The command completed successfully
pdb数据库在所有实例上都open了
SQL> select open_mode from v$database; OPEN_MODE -------------------- READ WRITE
给pdb增加服务名jypdb_srv
[grid@jytest1 ~]$ su - oracle Password: Last login: Tue May 16 18:39:02 CST 2017 on pts/0 [oracle@jytest1 ~]$ srvctl add service -db jy -pdb jypdb -s jypdb_srv -preferred "jy1" -available "jy2" [oracle@jytest1 ~]$ srvctl start service -db jy -s jypdb_srv [grid@jytest1 ~]$ lsnrctl status LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 16-MAY-2017 18:56:55 Copyright (c) 1991, 2016, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 02-MAY-2017 11:14:02 Uptime 14 days 7 hr. 42 min. 54 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/product/12.2.0/crs/network/admin/listener.ora Listener Log File /u01/app/grid/diag/tnslsnr/jytest1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.175)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.171)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=jytest1.jydba.net)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.2.0/db/admin/jy/xdb_wallet))(Presentation=HTTP)(Session=RAW)) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_CRS" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_DATA" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_TEST" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "4b2c6373ae2547cce053ab828a0a7ca3" has 2 instance(s). Instance "jy1", status READY, has 1 handler(s) for this service... Instance "jy1", status READY, has 2 handler(s) for this service... Service "4e0ba8d9d278217be053ab828a0a1330" has 1 instance(s). Instance "jycs1", status READY, has 1 handler(s) for this service... Service "jy" has 1 instance(s). Instance "jy1", status READY, has 1 handler(s) for this service... Service "jyXDB" has 1 instance(s). Instance "jy1", status READY, has 1 handler(s) for this service... Service "jycs" has 1 instance(s). Instance "jycs1", status READY, has 1 handler(s) for this service... Service "jycsXDB" has 1 instance(s). Instance "jycs1", status READY, has 1 handler(s) for this service... Service "jycspdb" has 1 instance(s). Instance "jycs1", status READY, has 1 handler(s) for this service... Service "jypdb" has 2 instance(s). Instance "jy1", status READY, has 1 handler(s) for this service... Instance "jy1", status READY, has 2 handler(s) for this service... Service "jypdb_srv" has 2 instance(s). Instance "jy1", status READY, has 1 handler(s) for this service... Instance "jy1", status READY, has 2 handler(s) for this service... Service "orcl" has 1 instance(s). Instance "orcl1", status READY, has 1 handler(s) for this service... The command completed successfully
使用新服务名再次以非sysdba权限登录成功
SQL> conn jy/jy@jypdb_srv
Connected.
SQL>