How to Preserve Open Mode of PDBs When the CDB Restarts (Doc ID 1933511.1)
[oracle@db12cr2 ~]$ sqlplus / as sysdba sql*Plus: Release 12.2.0.1.0 Production on Wed Mar 8 01:56:25 2017 Copyright (c) 1982,2016,Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production sql> sql> set lines 300 sql> column NAME format a30 sql> col pdb format a30 sql> select PDB,INST_ID,NAME from gv$services order by 1; PDB INST_ID NAME ------------------------------ ---------- ------------------------------ CDB$ROOT 1 orclXDB CDB$ROOT 1 orcl CDB$ROOT 1 SYS$BACKGROUND CDB$ROOT 1 SYS$USERS HIGHGO1 1 highgo1--------->>>注意此处 HIGHGO2 1 highgo2--------->>>注意此处 HIGHGO3 1 highgo3--------->>>注意此处 7 rows selected. sql> select CON_ID,NAME,OPEN_MODE from V$PDBS; CON_ID NAME OPEN_MODE ---------- ------------------------------ ---------- 2 PDB$SEED READ ONLY 3 HIGHGO1 MOUNTED--------->>>注意此处 4 HIGHGO2 MOUNTED--------->>>注意此处 5 HIGHGO3 MOUNTED--------->>>注意此处 sql> sql> alter pluggable database highgo1 open; Pluggable database altered. sql> set lines 300 sql> column NAME format a30 sql> col pdb format a30 sql> select CON_ID,OPEN_MODE from V$PDBS; CON_ID NAME OPEN_MODE ---------- ------------------------------ ---------- 2 PDB$SEED READ ONLY 3 HIGHGO1 READ WRITE 4 HIGHGO2 MOUNTED 5 HIGHGO3 MOUNTED sql> alter pluggable database highgo1 save state;---->>注意此命令(其实此命令从12.1.0.2开始就有了). Pluggable database altered. sql> sql> exit Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production [oracle@db12cr2 ~]$ exit logout
[root@db12cr2 ~]# init 6 --------该命令仅限试验,后果自负------>>>重启os [root@db12cr2 ~]# [root@db12cr2 ~]# Connection closed by foreign host. Disconnected from remote host(192.168.80.12) at 16:01:09. Type `help' to learn how to use Xshell prompt. [c:\~]$ Disconnected from remote host(192.168.80.12) at 16:01:09. Type `help' to learn how to use Xshell prompt. [c:\~]$
Connecting to 192.168.80.12:22... Connection established. To escape to local shell,press 'Ctrl+Alt+]'. Last login: Wed Mar 8 05:37:33 2017 from 192.168.80.1 [root@db12cr2 ~]# su - oracle [oracle@db12cr2 ~]$ sqlplus / as sysdba sql*Plus: Release 12.2.0.1.0 Production on Wed Mar 8 06:33:09 2017 Copyright (c) 1982,Oracle. All rights reserved. Connected to an idle instance. sql> startup ORACLE instance started. Total System Global Area 587202560 bytes Fixed Size 8795424 bytes Variable Size 348130016 bytes Database Buffers 222298112 bytes Redo Buffers 7979008 bytes Database mounted. Database opened. sql> set lines 300 sql> column NAME format a30 sql> col pdb format a30 sql> select CON_ID,OPEN_MODE from V$PDBS; CON_ID NAME OPEN_MODE ---------- ------------------------------ ---------- 2 PDB$SEED READ ONLY 3 HIGHGO1 READ WRITE -------------->>>pdb状态. 4 HIGHGO2 MOUNTED 5 HIGHGO3 MOUNTED sql> select PDB,NAME from gv$services order by 1; PDB INST_ID NAME ------------------------------ ---------- ------------------------------ CDB$ROOT 1 orclXDB CDB$ROOT 1 orcl CDB$ROOT 1 SYS$BACKGROUND CDB$ROOT 1 SYS$USERS HIGHGO1 1 highgo1 HIGHGO2 1 highgo2 HIGHGO3 1 highgo3 7 rows selected. sql>原文链接:/oracle/210228.html