加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Oracle 12.2中设置pdb随cdb启动而自动启动

发布时间:2020-12-12 15:17:29 所属栏目:百科 来源:网络整理
导读:参考文章: How to Preserve Open Mode of PDBs When the CDB Restarts (Doc ID 1933511.1) [oracle@db12cr2 ~]$ sqlplus / as sysdbaSQL*Plus: Release 12.2.0.1.0 Production on Wed Mar 8 01:56:25 2017Copyright (c) 1982,2016,Oracle. All rights reserve
参考文章:
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> 

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读