Oracle 19c 启动和关闭实例保存PDB状态

简介: 十年以上 MySQL Oracle DBA从业者,MySQL 5.7 OCP, 微信号: jinjushuke

当前有一个PDB 打开模式为READ WRITE

[oracle@DGMOGGM19C ~]$ sql [email protected]:1521/pdb1 as sysdba
SQLcl: Release 19.1 Production on Wed Aug 23 10:19:47 2023
Copyright (c) 1982, 2023, Oracle. All rights reserved.
New version: 23.2.0 available to download
Password? (**?) **
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED


    3 PDB1                           READ WRITE NO        

SQL> connect / as sysdba
Connected.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED


    2 PDB$SEED                       READ ONLY  NO        
    3 PDB1                           READ WRITE NO  

实例shutdown 后再startup,PDB1 为mount状态

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1140850592 bytes
Fixed Size 9133984 bytes
Variable Size 738197504 bytes
Database Buffers 385875968 bytes
Redo Buffers 7643136 bytes
Database mounted.
Database opened.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED


    2 PDB$SEED                       READ ONLY  NO        
    3 PDB1                           MOUNTED NO        

SQL>
启动PDB1后,保存PDB1打开模式状态

SQL> alter pluggable database pdb1 open;
Pluggable database altered.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED


    2 PDB$SEED                       READ ONLY  NO        
    3 PDB1                           READ WRITE NO        

SQL> alter pluggable database all save state;
Pluggable database altered.
SQL> select con_name,state from dba_pdb_saved_states;
CON_NAME STATE


PDB1 OPEN

再重启实例试试,查看PDB1的默认状态

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1140850592 bytes
Fixed Size 9133984 bytes
Variable Size 738197504 bytes
Database Buffers 385875968 bytes
Redo Buffers 7643136 bytes
Database mounted.
Database opened.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED


    2 PDB$SEED                       READ ONLY  NO        
    3 PDB1                           READ WRITE NO        

SQL>
现在PDB1的打开模式自动为读写了。

你可能感兴趣的:(oracle,数据库)