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):
首先关闭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文件中包含了每个数据文件的位置,以及初始化参数等信息。
2、drop PDB
关闭并且拔出PDB后才可以进行删除,删除时可以一起删除数据文件:
同样需要连接到CDB$ROOT容器,执行下列语句:
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的数据文件。另外,也可以使用inluding datafiles彻底删除PDB的数据文件。
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语句中,因为数据文件都在xml文件指定的位置,且仍使用原来的位置作为新
的pdb的数据文件的存储位置,因此没有包含其他子句。
另外一条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文件中指示数据文件在/location1/中,而实际上数据文件在/location2/中,且最终我们要将数据文件
放在/location3/中
新闻名称:Oracle12c_PDB的拔插与删除
文章源于:http://pwwzsj.com/article/pioppg.html
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):
首先关闭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文件中包含了每个数据文件的位置,以及初始化参数等信息。
2、drop PDB
关闭并且拔出PDB后才可以进行删除,删除时可以一起删除数据文件:
同样需要连接到CDB$ROOT容器,执行下列语句:
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的数据文件。另外,也可以使用inluding datafiles彻底删除PDB的数据文件。
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语句中,因为数据文件都在xml文件指定的位置,且仍使用原来的位置作为新
的pdb的数据文件的存储位置,因此没有包含其他子句。
另外一条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文件中指示数据文件在/location1/中,而实际上数据文件在/location2/中,且最终我们要将数据文件
放在/location3/中
新闻名称:Oracle12c_PDB的拔插与删除
文章源于:http://pwwzsj.com/article/pioppg.html