保存pdb1状态为open;
SQL> alter pluggable database pdb1 save state;
Pluggable database altered.
查看视图DBA_PDB_SAVED_STATES
SQL> select CON_NAME,STATE from DBA_PDB_SAVED_STATES;
CON_NAME STATE
---------- --------------
PDB1 OPEN
重启CDB,查看PDB的状态
SQL> startup force
ORACLE instance started.
Total System Global Area 1258291200 bytes
Fixed Size 8792296 bytes
Variable Size 469763864 bytes
Database Buffers 771751936 bytes
Redo Buffers 7983104 bytes
Database mounted.
Database opened.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
PDB$SEED READ ONLY NO
PDB1 READ WRITE NO
PDB2 MOUNTED
手动关闭PDB1,再查看DBA_PDB_SAVED_STATES视图
SQL> alter pluggable database pdb1 close immediate;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
PDB$SEED READ ONLY NO
PDB1 MOUNTED
PDB2 MOUNTED
SQL> select CON_NAME,STATE from DBA_PDB_SAVED_STATES;
CON_NAME STATE
---------- --------------
PDB1 OPEN
取消PDB的自启动功能,会删除数据字典中相应的记录
SQL> select * from DBA_PDB_SAVED_STATES;
no rows selected
重启CDB,验证pdb1状态
SQL> startup force
ORACLE instance started.
Total System Global Area 1258291200 bytes
Fixed Size 8792296 bytes
Variable Size 469763864 bytes
Database Buffers 771751936 bytes
Redo Buffers 7983104 bytes
Database mounted.
Database opened.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
PDB$SEED READ ONLY NO
PDB1 MOUNTED
PDB2 MOUNTED