真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

oraclecdb、pdb參考

CDB、PDB概念介紹

CDB與PDB是Oracle 12C引入的新特性,在ORACLE 12C數(shù)據(jù)庫引入的多租用戶環(huán)境(Multitenant Environment)中,允許一個數(shù)據(jù)庫容器(CDB)承載多個可插拔數(shù)據(jù)庫(PDB)。CDB全稱為Container Database,中文翻譯為數(shù)據(jù)庫容器,PDB全稱為Pluggable Database,即可插拔數(shù)據(jù)庫。在ORACLE 12C之前,實例與數(shù)據(jù)庫是一對一或多對一關系(RAC):即一個實例只能與一個數(shù)據(jù)庫相關聯(lián),數(shù)據(jù)庫可以被多個實例所加載。而實例與數(shù)據(jù)庫不可能是一對多的關系。當進入ORACLE 12C后,實例與數(shù)據(jù)庫可以是一對多的關系。下面為CDB與PDB的關系圖:

汝南網(wǎng)站建設公司創(chuàng)新互聯(lián)建站,汝南網(wǎng)站設計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為汝南上千余家提供企業(yè)網(wǎng)站建設服務。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設要多少錢,請找那個售后服務好的汝南做網(wǎng)站的公司定做!

oracle cdb、pdb參考

一個CDB容器數(shù)據(jù)庫通常包含CDB$ROOT、PDB$SEED組件:
a. CDB$ROOT存儲著ORACLE提供的元數(shù)據(jù)和Common User,Common User 是指在每個容器中都存在的用戶,查看:

show con_name;

oracle cdb、pdb參考
b.PDB$SEED是創(chuàng)建PDB數(shù)據(jù)庫的模板。一個CDB中有且只能有一個Seed,查看:

show pdbs

oracle cdb、pdb參考
c.PDB可插拔數(shù)據(jù)庫,CDB中可以有一個或多個PDB,查看:

show pdbs

oracle cdb、pdb參考

創(chuàng)建CDB容器數(shù)據(jù)庫

dbca在創(chuàng)建數(shù)據(jù)庫的時候,可以選擇是創(chuàng)建容器數(shù)據(jù)庫還是傳統(tǒng)的數(shù)據(jù)庫,如下圖選擇為創(chuàng)建CDB:

oracle cdb、pdb參考

創(chuàng)建pdb:

a.命令create pluggable database創(chuàng)建:

create pluggable database app1 admin user pdba identified by pdba123;

oracle cdb、pdb參考

指定路徑創(chuàng)建pdb:

mkdir -p /u01/app/oracle/oradata/prod/data

create pluggable database app1 admin user pdba identified by pdba123 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/prod/pdbseed','/u01/app/oracle/oradata/prod/data');

oracle cdb、pdb參考

b.dbca創(chuàng)建pdb:

oracle cdb、pdb參考

oracle cdb、pdb參考

oracle cdb、pdb參考

oracle cdb、pdb參考

oracle cdb、pdb參考

oracle cdb、pdb參考

oracle cdb、pdb參考

oracle cdb、pdb參考

oracle cdb、pdb參考

確認:

oracle cdb、pdb參考

啟動pdb:

alter pluggable database APP1 open;

oracle cdb、pdb參考

c. 克隆pdb數(shù)據(jù)庫:

alter system set db_create_file_dest='/u01/app/oracle/oradata/prod/';

oracle cdb、pdb參考

create pluggable database app3 from app2;

oracle cdb、pdb參考

刪除pdb

先關閉對應的pdb,然后刪除pdb:

alter pluggable database app3 close immediate;

drop pluggable database app3 including datafiles;

oracle cdb、pdb參考

只是刪除庫,不刪除文件:

drop pluggable database app3 keep datafiles;

oracle cdb、pdb參考

alter pluggable database app3 unplug into '/home/oracle/app3.xml';

oracle cdb、pdb參考

drop pluggable database app3 keep datafiles;

show pdbs

oracle cdb、pdb參考

create pluggable database app5 using '/home/oracle/app3.xml' nocopy;

oracle cdb、pdb參考

切換容器

切換到app1 pdb下面:

alter session set container=app1;

oracle cdb、pdb參考
切換到CDB容器

alter session set container=CDB$ROOT;???

oracle cdb、pdb參考

查看當前屬于哪個容器:

show con_name

oracle cdb、pdb參考

select sys_context('USERENV','CON_NAME') from dual;

oracle cdb、pdb參考

啟動、關閉pdb

a. 指定pdb進行關閉和啟動:

alter pluggable database app1 open;

oracle cdb、pdb參考

startup pluggable database app1;

oracle cdb、pdb參考

啟動到只讀模式,新建的pdb必須啟動一次后才可以設置為read only,否則報

ERROR at line 1:

ORA-65085: cannot open pluggable database in read-only mode:

可以從dba_pdbs視圖進行確認,對于NEW的pdb,需要先open:

SQL> col pdb_name for a10

SQL> select pdb_name,status from dba_pdbs;

PDB_NAME STATUS

---------- ----------

APP1 NORMAL

PDB$SEED NORMAL

APP2 NORMAL

APP3 NORMAL

APP4 NEW

新建一個app3 數(shù)據(jù)庫,然后執(zhí)行啟動到read only:

create pluggable database app3 from app2;

oracle cdb、pdb參考

alter pluggable database app3 open read only;

oracle cdb、pdb參考

alter pluggable database app3 open read only;

show pdbs;

oracle cdb、pdb參考

alter pluggable database app1 close immediate;

oracle cdb、pdb參考

b.切換到對應的pdb進行關閉啟動:
alter session set container= app1;?

startup;

oracle cdb、pdb參考

alter session set container= app1;

shutdown immediate;

oracle cdb、pdb參考

c.集中操作pdb:

開啟所有pdb:

alter pluggable database all open;?

oracle cdb、pdb參考

關閉所有pdb:

alter pluggable database all close immediate;

oracle cdb、pdb參考

pdb自動啟動:

oracle 12.1和oracle12.2版本,默認情況下PDB不會隨著CDB啟動而啟動,oracle 12.1只能通過觸發(fā)器實現(xiàn):

CREATE TRIGGER open_all_pdbs

AFTER STARTUP ON DATABASE

BEGIN

EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';

END ;

/

刪除觸發(fā)器:

drop trigger open_all_pdbs;

oracle12.2之后可以使用save state來保存pdb數(shù)據(jù)庫的當前狀態(tài)。

show pdbs;

alter pluggable database app1 save state;

oracle cdb、pdb參考

startup force;

show pdbs;

oracle cdb、pdb參考

查看state狀態(tài):

col con_name for a10

select con_name, state from dba_pdb_saved_states;

oracle cdb、pdb參考

刪除discard state狀態(tài):

alter pluggable database app1 discard state;

oracle cdb、pdb參考

查看pdb信息

查看所有pdb:
show pdbs

oracle cdb、pdb參考

col name for a20

select con_id,dbid,name,open_mode from v$pdbs;

oracle cdb、pdb參考

select name,cause ,type,message,status from pdb_plug_in_violations;


網(wǎng)站欄目:oraclecdb、pdb參考
文章轉載:http://weahome.cn/article/jgpgos.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部