在oracle12c中,需要更改默认的pdb服务名,否则将会出现rac集群中,当有一个pdb出现问题时不可用(特别是当一个pdb服务没有起来时),整个rac集群不可用的状况。
如下是具体的处理办法。
Connecting To A 12c RAC Pluggable Database
Intermittently Fails With ORA-1033 (Doc ID 1998112.1)
ORA-01033: ORACLE initialization or shutdown in progress
1.1.1CAUSE
The issue is caused by 2 factors:
1. The service name used to connect to the PDB is the name of the PDB itself
2. The PDB is not open on all RAC instances
Using the name of a PDB as a service name is not a good practice in a RAC
environment as the Instance will register thePDB name with the SCAN and node
listeners as soon as the PDB is mounted. This can cause connects to be directed
to database instances that have the PDB mounted (not open) and can result in an
ORA-1033 error when connecting a as non-SYSDBA user.
1.1.2SOLUTION
1. Create a CRS service with a name other than the PDB name -
e.g.:
$ORACLE_HOME/bin/srvctl add service -databaseracdb-pdbpdb_name-spdb_srv-i
"racinst1,racinst2"
2. Start the service through srvctl:
$ORACLE_HOME/bin/srvctl start service -databaseracdb-pdbpdb_name-spdb_srv
3. Have users connect using the new service - here's a sample TNS entry for the
tnames.ora:
PDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = lc4-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME =pdb_srv)
)
)
1.1.3实际执行过程
oracle用户下执行,只需要在主节点一个节点执行就可以,如果在其他节点执行,会报该服务已经存在。
root@inmsh01
~]# su - oracle
[oracle@inmsh01
~]$ $ORACLE_HOME/bin/srvctl add service
-database znwgs -pdb tygisdb -s tygisdb_srv -preferred "ZNWGS1" -a
"ZNWGS2,ZNWGS3"
[oracle@inmsh01
~]$ $ORACLE_HOME/bin/srvctl start service -db znwgs -s tygisdb_srv
[oracle@inmsh01 ~]$