建立、克隆pdb---oracle 12c 學習(1)
SQL> select * from v$version;
BANNER CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production 0
PL/SQL Release 12.1.0.2.0 - Production 0
CORE 12.1.0.2.0 Production 0
TNS for Linux: Version 12.1.0.2.0 - Production 0
NLSRTL Version 12.1.0.2.0 - Production 0
SQL> select sys_context('userenv','con_name') from dual;
SYS_CONTEXT('USERENV','CON_NAME')
------------------------------------------------------------------------------------------------------------------------------------
CDB$ROOT
SQL> select con_id,dbid,con_uid,guid,name,open_mode,create_scn,total_size,block_size from v$pdbs;
CON_ID DBID CON_UID GUID NAME OPEN_MODE CREATE_SCN TOTAL_SIZE BLOCK_SIZE
---------- ---------- ---------- -------------------------------- ------------ ---------- ---------- ---------- ----------
2 4264868981 4264868981 0951B9CFB39C2060E0530100007F6961 PDB$SEED READ ONLY 1594434 870318080 8192
3 3977202490 3977202490 09521ABB982E7F0BE0530100007FD46A XJNY READ WRITE 1753354 917504000 8192
--建立一個新PDB
SQL> CREATE PLUGGABLE DATABASE wapdb ADMIN USER wapadmin IDENTIFIED BY wapadmin ;
Pluggable database created.
SQL> select con_id,dbid,con_uid,guid,name,open_mode,create_scn,total_size,block_size from v$pdbs;
CON_ID DBID CON_UID GUID NAME OPEN_MODE CREATE_SCN TOTAL_SIZE BLOCK_SIZE
---------- ---------- ---------- -------------------------------- ---------- ---------- ---------- ---------- ----------
2 4264868981 4264868981 0951B9CFB39C2060E0530100007F6961 PDB$SEED READ ONLY 1594434 870318080 8192
3 3977202490 3977202490 09521ABB982E7F0BE0530100007FD46A XJNY READ WRITE 1753354 917504000 8192
4 4211777660 4211777660 0986C60CA76145FDE0530100007F304E WAPDB MOUNTED 1896905 0 8192
--克隆一個新pdb
SQL> create pluggable database mbs from wapdb;
create pluggable database mbs from wapdb
*
ERROR at line 1:
ORA-65139: Mismatch between XML metadata file and data file
/home/db/oracle/oradata/SMS/0986C60CA76145FDE0530100007F304E/datafile/o1_mf_system_b856b39h_.dbf for value of fcpsb (1897165 in the
plug XML file, 1904147 in the data file)
嘗試將wapdb以read only模式開啟
SQL> alter session set container=wapdb;
Session altered.
SQL> alter database open read only;
Database altered.
SQL> alter session set container=cdb$root;
Session altered.
SQL> select sys_context('userenv','con_name') from dual;
SYS_CONTEXT('USERENV','CON_NAME')
------------------------------------------------------------------------------------------------------------------------------------
CDB$ROOT
SQL> create pluggable database mbs from wapdb;
Pluggable database created.
SQL> alter pluggable database mbs open;
Warning: PDB altered with errors.
SQL> select con_id,dbid,con_uid,guid,name,open_mode,create_scn,total_size,block_size from v$pdbs;
CON_ID DBID CON_UID GUID NAME OPEN_MODE CREATE_SCN TOTAL_SIZE BLOCK_SIZE
---------- ---------- ---------- -------------------------------- ---------- ---------- ---------- ---------- ----------
2 4264868981 4264868981 0951B9CFB39C2060E0530100007F6961 PDB$SEED READ ONLY 1594434 870318080 8192
3 3977202490 3977202490 09521ABB982E7F0BE0530100007FD46A XJNY READ WRITE 1753354 917504000 8192
4 4211777660 4211777660 0986C60CA76145FDE0530100007F304E WAPDB READ ONLY 1896905 870318080 8192
5 1281880106 1281880106 0987D2D2C15B4758E0530100007F4AA4 MBS READ WRITE 1905674 891289600 8192
可見,在克隆pdb時,需要將源pdb已read only模式開啟
BANNER CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production 0
PL/SQL Release 12.1.0.2.0 - Production 0
CORE 12.1.0.2.0 Production 0
TNS for Linux: Version 12.1.0.2.0 - Production 0
NLSRTL Version 12.1.0.2.0 - Production 0
SQL> select sys_context('userenv','con_name') from dual;
SYS_CONTEXT('USERENV','CON_NAME')
------------------------------------------------------------------------------------------------------------------------------------
CDB$ROOT
SQL> select con_id,dbid,con_uid,guid,name,open_mode,create_scn,total_size,block_size from v$pdbs;
CON_ID DBID CON_UID GUID NAME OPEN_MODE CREATE_SCN TOTAL_SIZE BLOCK_SIZE
---------- ---------- ---------- -------------------------------- ------------ ---------- ---------- ---------- ----------
2 4264868981 4264868981 0951B9CFB39C2060E0530100007F6961 PDB$SEED READ ONLY 1594434 870318080 8192
3 3977202490 3977202490 09521ABB982E7F0BE0530100007FD46A XJNY READ WRITE 1753354 917504000 8192
--建立一個新PDB
SQL> CREATE PLUGGABLE DATABASE wapdb ADMIN USER wapadmin IDENTIFIED BY wapadmin ;
Pluggable database created.
SQL> select con_id,dbid,con_uid,guid,name,open_mode,create_scn,total_size,block_size from v$pdbs;
CON_ID DBID CON_UID GUID NAME OPEN_MODE CREATE_SCN TOTAL_SIZE BLOCK_SIZE
---------- ---------- ---------- -------------------------------- ---------- ---------- ---------- ---------- ----------
2 4264868981 4264868981 0951B9CFB39C2060E0530100007F6961 PDB$SEED READ ONLY 1594434 870318080 8192
3 3977202490 3977202490 09521ABB982E7F0BE0530100007FD46A XJNY READ WRITE 1753354 917504000 8192
4 4211777660 4211777660 0986C60CA76145FDE0530100007F304E WAPDB MOUNTED 1896905 0 8192
--克隆一個新pdb
SQL> create pluggable database mbs from wapdb;
create pluggable database mbs from wapdb
*
ERROR at line 1:
ORA-65139: Mismatch between XML metadata file and data file
/home/db/oracle/oradata/SMS/0986C60CA76145FDE0530100007F304E/datafile/o1_mf_system_b856b39h_.dbf for value of fcpsb (1897165 in the
plug XML file, 1904147 in the data file)
嘗試將wapdb以read only模式開啟
SQL> alter session set container=wapdb;
Session altered.
SQL> alter database open read only;
Database altered.
SQL> alter session set container=cdb$root;
Session altered.
SQL> select sys_context('userenv','con_name') from dual;
SYS_CONTEXT('USERENV','CON_NAME')
------------------------------------------------------------------------------------------------------------------------------------
CDB$ROOT
SQL> create pluggable database mbs from wapdb;
Pluggable database created.
SQL> alter pluggable database mbs open;
Warning: PDB altered with errors.
SQL> select con_id,dbid,con_uid,guid,name,open_mode,create_scn,total_size,block_size from v$pdbs;
CON_ID DBID CON_UID GUID NAME OPEN_MODE CREATE_SCN TOTAL_SIZE BLOCK_SIZE
---------- ---------- ---------- -------------------------------- ---------- ---------- ---------- ---------- ----------
2 4264868981 4264868981 0951B9CFB39C2060E0530100007F6961 PDB$SEED READ ONLY 1594434 870318080 8192
3 3977202490 3977202490 09521ABB982E7F0BE0530100007FD46A XJNY READ WRITE 1753354 917504000 8192
4 4211777660 4211777660 0986C60CA76145FDE0530100007F304E WAPDB READ ONLY 1896905 870318080 8192
5 1281880106 1281880106 0987D2D2C15B4758E0530100007F4AA4 MBS READ WRITE 1905674 891289600 8192
可見,在克隆pdb時,需要將源pdb已read only模式開啟
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10972173/viewspace-1361793/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 12C 新特性之 PDB熱克隆(本地克隆、遠端異機克隆)Oracle
- 建立AIX克隆盤AI
- Oracle 12c多租戶特性詳解:PDB 的建立、克隆與維護Oracle
- 全面學習ORACLE Scheduler特性(1)建立jobsOracle
- oracle 12c使用dblink克隆pdbOracle
- RXSwift學習(1)—tableView的簡單建立SwiftView
- 12c 資料泵克隆使用者
- Oracle 建立PDB-本地克隆Oracle
- Oracle 建立PDB-遠端克隆Oracle
- Java學習筆記【1】陣列的宣告和建立Java筆記陣列
- 12c RAC 和 CDB/PDB 學習
- 和luster學習在Linux建立庫函式(1)(轉)Linux函式
- oracle學習(建立表)Oracle
- 學習1
- ASP.NET MVC 學習心得 (1) - 怎樣建立簡單程式ASP.NETMVC
- QT學習筆記1(安裝、建立和訊號與槽)QT筆記
- 12c ASM中建立ACFSASM
- 【JavaScript學習】JavaScript物件建立JavaScript物件
- Vuex學習(1)Vue
- flask學習1Flask
- Kettle學習1
- Vue學習-1Vue
- php學習(1)PHP
- rack學習1
- odoo學習-1Odoo
- Jquery學習1jQuery
- AJAX學習1
- js學習1JS
- Java學習(1)Java
- NLP學習1
- 大資料學習環境準備[1] - 建立虛擬機器大資料虛擬機
- Oracle 12c 手動建立CDBOracle
- Praat 學習日誌1--安裝和建立專案(入門必看)
- python學習1Python
- java學習之旅-1Java
- DNS深入學習-1DNS
- 學習筆記1筆記
- Vue學習心得(1)Vue