文档课题:实现oracle 19c pdb在cdb重启后,自动开启相应pdb.标签:name,cdb,----------,SQL,oracle,pdb,NAME From: https://blog.51cto.com/u_12991611/5818335
[oracle@dbserver ~]$ sql / as sysdba
SQLcl: Release 19.1 Production on Wed Nov 02 14:26:19 2022
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.12.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB MOUNTED
SQL> alter pluggable database orclpdb open;
Pluggable database altered.
说明:如上所示,每次cdb开启后,对应的pdb在均mounted阶段,都需要重新open pdb.
如何解决这个问题呢?以下便是解决此问题操作过程.
SQL> select con_name,state from cdb_pdb_saved_states;
no rows selected
SQL> alter pluggable database all save state;
Pluggable database altered.
注意:若是集群环境,每个节点都要保存状态.
SQL> col con_name for a15
SQL> select con_name,state from cdb_pdb_saved_states;
CON_NAME STATE
--------------- --------------
ORCLPDB OPEN
SQL> col INSTANCE_NAME for a15
SQL> select instance_name,con_name,state from cdb_pdb_saved_states order by 1,2;
INSTANCE_NAME CON_NAME STATE
--------------- --------------- --------------
orclcdb ORCLPDB OPEN
SQL> select name from v$database;
NAME
---------
ORCLCDB
重启数据库确认.
SQL> startup force;
Total System Global Area 2415918600 bytes
Fixed Size 9137672 bytes
Variable Size 989855744 bytes
Database Buffers 1409286144 bytes
Redo Buffers 7639040 bytes
Database mounted.
Database opened.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB READ WRITE NO
说明:如上所示,cdb重启后对应的pdb自动read write.