CDB重启后,PDBs默认是处于mounted状态
SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY PDB1 READ WRITE PDB2 READ WRITE SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 1174405120 bytes Fixed Size 2923680 bytes Variable Size 436208480 bytes Database Buffers 721420288 bytes Redo Buffers 13852672 bytes Database mounted. Database opened. SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY PDB1 MOUNTED PDB2 MOUNTED SQL>
命令"alter pluggable database ... save state",可以让CDB重启后,pdb维持其关机前的状态。
取消设置使用"alter pluggable database ... discard state"。
SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY PDB1 READ WRITE PDB2 MOUNTED SQL> alter pluggable database pdb1 save state; Pluggable database altered. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ; ORACLE instance started. Total System Global Area 1174405120 bytes Fixed Size 2923680 bytes Variable Size 436208480 bytes Database Buffers 721420288 bytes Redo Buffers 13852672 bytes Database mounted. Database opened. SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY PDB1 READ WRITE PDB2 MOUNTED SQL>