CDB重启后,PDBs默认是处于mounted状态
SQL> select name,open_mode from v$pdbs;NAME OPEN_MODE------------------------------ ----------PDB$SEED READ ONLYPDB1 READ WRITEPDB2 READ WRITESQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> startup ORACLE instance started.Total System Global Area 1174405120 bytesFixed Size 2923680 bytesVariable Size 436208480 bytesDatabase Buffers 721420288 bytesRedo Buffers 13852672 bytesDatabase mounted.Database opened.SQL> select name,open_mode from v$pdbs;NAME OPEN_MODE------------------------------ ----------PDB$SEED READ ONLYPDB1 MOUNTEDPDB2 MOUNTEDSQL>
命令"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 ONLYPDB1 READ WRITEPDB2 MOUNTEDSQL> 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 bytesFixed Size 2923680 bytesVariable Size 436208480 bytesDatabase Buffers 721420288 bytesRedo Buffers 13852672 bytesDatabase mounted.Database opened.SQL> select name,open_mode from v$pdbs;NAME OPEN_MODE------------------------------ ----------PDB$SEED READ ONLYPDB1 READ WRITEPDB2 MOUNTEDSQL>