參考文章:
How to Preserve Open Mode of PDBs When the CDB Restarts (Doc ID 1933511.1)
[[email protected] ~]$ 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, NAME, 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
[[email protected] ~]$ exit
logout
[[email protected] ~]# init 6 --------該指令僅限試驗,後果自負------>>>重新開機os
[[email protected] ~]#
[[email protected] ~]#
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
[[email protected] ~]# su - oracle
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed Mar 8 06:33:09 2017
Copyright (c) 1982, 2016, 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, NAME, 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, 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>