Oracle12c_PDB的拔插與刪除

這里簡單介紹了拔出PDB,刪除PDB,插入PDB的操作方法:

1、unplug PDB

查看PDB信息:

SQL> select name,open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB_1                          READ WRITE
PDB_2                          READ WRITE
PDB_3                          READ WRITE
PDB_4                          READ WRITE

SQL> show con_name;

CON_NAME
------------------------------
CDB$ROOT

拔出PDB_4(必須連接到CDB$ROOT):

首先關(guān)閉PDB_4

SQL> alter pluggable database pdb_4 close immediate;

Pluggable database altered.

然后就可以unplug

SQL>  alter pluggable database pdb_4 unplug into '/home/oracle/unplugged_pdbs/pdb_4.xml';

Pluggable database altered.

XML文件中包含了每個數(shù)據(jù)文件的位置,以及初始化參數(shù)等信息。

2、drop PDB

關(guān)閉并且拔出PDB后才可以進(jìn)行刪除,刪除時可以一起刪除數(shù)據(jù)文件:

同樣需要連接到CDB$ROOT容器,執(zhí)行下列語句:

SQL> drop pluggable database pdb_4 keep datafiles;  

Pluggable database dropped.

SQL> select name,open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB_1                          READ WRITE
PDB_2                          READ WRITE
PDB_3                          READ WRITE

這里使用了keep datafiles保留了PDB_4的數(shù)據(jù)文件。另外,也可以使用inluding datafiles徹底刪除PDB的數(shù)據(jù)文件。

3、plug an unplugged PDB

plug PDB_4:

SQL> create pluggable database pdb_4_replug using '/home/oracle/unplugged_pdbs/pdb_4.xml' nocopy tempfile reuse;

Pluggable database created.

SQL> select name from v$pdbs;

NAME
------------------------------
PDB$SEED
PDB_1
PDB_2
PDB_3
PDB_4_REPLUG

SQL> select name,open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB_1                          READ WRITE
PDB_2                          READ WRITE
PDB_3                          READ WRITE
PDB_4_REPLUG                   MOUNTED

上述create pluggable database語句中,因為數(shù)據(jù)文件都在xml文件指定的位置,且仍使用原來的位置作為新

的pdb的數(shù)據(jù)文件的存儲位置,因此沒有包含其他子句。

另外一條plug PDB的語句也可能如下:

CREATE PLUGGABLE DATABASE pdbname
USING '/location/filename.xml'
SOURCE_FILE_NAME_CONVERT=('/location1/','/location2/')
MOVE
FILE_NAME_CONVERT=('/location2/','/location3/')
PATH_PREFIX='/location3/'
STORAGE (MAXSIZE 2G MAX_SHARED_TEMP_SIZE 100M);

這里xml文件中指示數(shù)據(jù)文件在/location1/中,而實際上數(shù)據(jù)文件在/location2/中,且最終我們要將數(shù)據(jù)文件

放在/location3/中

文章標(biāo)題:Oracle12c_PDB的拔插與刪除
當(dāng)前路徑:http://muchs.cn/article36/pioppg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊、云服務(wù)器網(wǎng)站營銷、服務(wù)器托管、虛擬主機、網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運營