关于数据库:Oracle-19c-启动和关闭实例保存PDB状态

50次阅读

共计 1623 个字符,预计需要花费 5 分钟才能阅读完成。

简介:十年以上 MySQL Oracle DBA 从业者,MySQL 5.7 OCP,微信号: jinjushuke
以后有一个 PDB 关上模式为 READ WRITE

[oracle@DGMOGGM19C ~]$ sql sys@192.168.3.107: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 的关上模式主动为读写了。

正文完
 0