Oracle 建立PDB-Plugging In an Unplugged PDB
Oracle 建立PDB-Plugging In an Unplugged PDB
一: Unplugging PDB
---187 伺服器將
SQL > alter session set container = chenpdb ;
Session altered.
--- 檢視資料檔案
SQL > select file_name from dba_data_files ;
FILE_NAME
--------------------------------------------------------------------------------
/ u01 / app / oracle19 / oradata / CHENDB / chenpdb / system01.dbf
/ u01 / app / oracle19 / oradata / CHENDB / chenpdb / sysaux01.dbf
/ u01 / app / oracle19 / oradata / CHENDB / chenpdb / undotbs01.dbf
/ u01 / app / oracle19 / oradata / CHENDB / chenpdb / users01.dbf
--- 檢視臨時檔案
SQL > select file_name from dba_temp_files ;
FILE_NAME
--------------------------------------------------------------------------------
/ u01 / app / oracle19 / oradata / CHENDB / chenpdb / temp01.dbf
--控制檔案
SQL > select name from v$controlfile ;
NAME
--------------------------------------------------------------------------------
/ u01 / app / oracle19 / oradata / CHENDB / control01.ctl
/ u01 / app / oracle19 / oradata / CHENDB / control02.ctl
---日誌檔案
SQL > select member from v$logfile ;
MEMBER
--------------------------------------------------------------------------------
/ u01 / app / oracle19 / oradata / CHENDB / redo03.log
/ u01 / app / oracle19 / oradata / CHENDB / redo02.log
/ u01 / app / oracle19 / oradata / CHENDB / redo01.log
SQL > conn / as sysdba
--- 提前備份chenpdb資料庫
SQL > alter pluggable database chenpdb close immediate ;
SQL > alter pluggable database chenpdb unplug into '/home/oracle/chenpdb01.xml' ;
SQL > drop pluggable database chenpdb keep datafiles ;
Pluggable database dropped.
SQL > show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
[oracle @ rac1 ~]$ ll - rth chenpdb *
- rw - r --r-- 1 oracle asmadmin 7.5K Mar 30 15:02 chenpdb.xml
- rw - r --r-- 1 oracle asmadmin 7.5K Mar 30 15:09 chenpdb01.xml
二:Plug Unplugging PDB
---187 將chenpdb資料庫插回187伺服器,並重新命名為chenpdb01
SQL > create pluggable database chenpdb01 using '/home/oracle/chenpdb01.xml' ;
ERROR at line 1 :
ORA - 65018 : FILE_NAME_CONVERT or NOCOPY must be specified
SQL >
create pluggable database chenpdb01 using '/home/oracle/chenpdb01.xml'
FILE_NAME_CONVERT = ( '/u01/app/oracle19/oradata/CHENDB/chenpdb/' ,
'/u01/app/oracle19/oradata/CHENDB/chenpdb/' );
ERROR at line 1 :
ORA - 65180 : duplicate file name encountered -
/ u01 / app / oracle19 / oradata / CHENDB / chenpdb / system01.dbf
SQL > create pluggable database chenpdb01 using '/home/oracle/chenpdb01.xml' nocopy ;
Pluggable database created.
SQL > alter pluggable database chenpdb01 open ;
Pluggable database altered.
SQL > show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
4 CHENPDB01 READ WRITE NO
---222 將187伺服器拔下的chenpdb資料庫插入到222伺服器上,並重新命名cjcpdb05
[oracle @ cjcos ~]$ mkdir chenpdb
---187
[oracle @ rac1 ~]$ scp chenpdb01.xml 192.168 .2.222 :/ home / oracle /
[oracle @ rac1 chenpdb]$ pwd
/ u01 / app / oracle19 / oradata / CHENDB / chenpdb
[oracle @ rac1 chenpdb]$ scp * 192.168 .2.222 :/ home / oracle / chenpdb
---222
[oracle @ cjcos ~]$ ll - rth / home / oracle / chenpdb
total 716 M
- rw - r ----- 1 oracle oinstall 341M Mar 30 15:27 sysaux01.dbf
- rw - r ----- 1 oracle oinstall 271M Mar 30 15:27 system01.dbf
- rw - r ----- 1 oracle oinstall 101M Mar 30 15:27 undotbs01.dbf
- rw - r ----- 1 oracle oinstall 5.1M Mar 30 15:27 users01.dbf
SQL >
set serveroutput on
DECLARE
l_result BOOLEAN ;
BEGIN
l_result := DBMS_PDB.check_plug_compatibility ( pdb_descr_file => '/home/oracle/chenpdb01.xml' ,
pdb_name => 'CHENPDB' );
IF l_result THEN
DBMS_OUTPUT.PUT_LINE ( 'Yes' );
ELSE
DBMS_OUTPUT.PUT_LINE ( 'No' );
END IF ;
END ;
/
Yes
PL / SQL procedure successfully completed.
---- 將chenpdb01.xml中/u01/app/oracle19/oradata/CHENDB路徑改成/home/oracle
SQL >
CREATE PLUGGABLE DATABASE cjcpdb05 USING '/home/oracle/chenpdb01.xml'
FILE_NAME_CONVERT = ( '/home/oracle/chenpdb/' ,
'/u01/app/oracle12/oradata/cjcpdb05/' );
Pluggable database created.
--- 對應告警日誌資訊
2020 - 03 - 30 T16 : 03 : 31.128371 + 08 : 00
CREATE PLUGGABLE DATABASE cjcpdb05 USING '/home/oracle/chenpdb01.xml'
FILE_NAME_CONVERT = ( '/home/oracle/chenpdb/' ,
'/u01/app/oracle12/oradata/cjcpdb05/' )
2020 - 03 - 30 T16 : 04 : 19.547571 + 08 : 00
CJCPDB05 ( 7 ): Endian type of dictionary set to little
2020 - 03 - 30 T16 : 04 : 21.656166 + 08 : 00
****************************************************************
Pluggable Database CJCPDB05 with pdb id - 7 is created as UNUSABLE.
If any errors are encountered before the pdb is marked as NEW ,
then the pdb must be dropped
local undo - 1 , localundoscn - 0 x0000000000000118
****************************************************************
CJCPDB05 ( 7 ): Autotune of undo retention is turned on.
2020 - 03 - 30 T16 : 04 : 23.125207 + 08 : 00
CJCPDB05 ( 7 ): Undo initialization recovery : err : 0 start : 1187946727 end : 1187946728 diff : 1 ms ( 0.0 seconds )
CJCPDB05 ( 7 ): [ 1687 ] Successfully onlined Undo Tablespace 2 .
CJCPDB05 ( 7 ): Undo initialization online undo segments : err : 0 start : 1187946729 end : 1187946770 diff : 41 ms ( 0.0 seconds )
CJCPDB05 ( 7 ): Undo initialization finished serial : 0 start : 1187946726 end : 1187946772 diff : 46 ms ( 0.0 seconds )
CJCPDB05 ( 7 ): Database Characterset for CJCPDB05 is AL32UTF8
CJCPDB05 ( 7 ): JIT : pid 1687 requesting stop
CJCPDB05 ( 7 ): Buffer Cache flush started : 7
CJCPDB05 ( 7 ): Buffer Cache flush finished : 7
2020 - 03 - 30 T16 : 04 : 25.217625 + 08 : 00
Completed : CREATE PLUGGABLE DATABASE cjcpdb05 USING '/home/oracle/chenpdb01.xml'
FILE_NAME_CONVERT = ( '/home/oracle/chenpdb/' ,
'/u01/app/oracle12/oradata/cjcpdb05/' )
SQL > show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 CJCPDB01 MOUNTED
4 CJCPDB02 MOUNTED
5 CJCPDB03 MOUNTED
6 CJCPDB04 MOUNTED
7 CJCPDB05 MOUNTED
SQL > alter session set container = cjcpdb05 ;
Session altered.
SQL > startup
SQL > show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 CJCPDB01 MOUNTED
4 CJCPDB02 MOUNTED
5 CJCPDB03 MOUNTED
6 CJCPDB04 MOUNTED
7 CJCPDB05 READ WRITE NO
SQL > select file_name from dba_data_files ;
FILE_NAME
--------------------------------------------------------------------------------
/ u01 / app / oracle12 / oradata / cjcpdb05 / system01.dbf
/ u01 / app / oracle12 / oradata / cjcpdb05 / sysaux01.dbf
/ u01 / app / oracle12 / oradata / cjcpdb05 / undotbs01.dbf
/ u01 / app / oracle12 / oradata / cjcpdb05 / users01.dbf
SQL > conn chen / oracle @ cjcpdb05
SQL > select count (*) from employees_01 ;
COUNT (*)
----------
107
歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2683385/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【PDB】Oracle 建立pdb說明(create pluggable database)OracleDatabase
- Oracle 建立PDB-from ScratchOracle
- Oracle 建立PDB-本地克隆Oracle
- Oracle 建立PDB-遠端克隆Oracle
- oracle 19c CDB vs pdb 建立Oracle
- Oracle 12c系列(二)|PDB的建立Oracle
- 【PDB】 為Oracle pdb新增服務(pdb add service)Oracle
- Part III PDB建立概述-Oracle多租戶管理員指南Oracle
- 【PDB】Oracle pdb維護常用sql命令OracleSQL
- 【PDB】pdb閃回,Oracle還原點Oracle
- 【PDB】Oracle跨PDB檢視查詢Oracle
- 【PDB】Oracle PDB資源管理參考Oracle
- oracle 19c建立非OMF檔案命名格式的PDBOracle
- Oracle 12.2 新特性: Online PDB relocate (PDB hot move)Oracle
- Oracle:PDB 引數管理Oracle
- 1.3.2.2 Creation of a PDB by Plugging In(通過插入的方式建立PDB)
- 1.3.2. 建立一個PDB
- 1.3.2.4 建立一個代理PDB
- 1.3.2.2.1. 插拔方式建立PDB
- oracle19c連pdbOracle
- 【RECO_ORACLE】Oracle閃回PDB的方法Oracle
- 【ASK_ORACLE】Oracle如何重新命名PDBOracle
- Z001-001 從 PDB$SEED 種子容器建立 PDB
- Oracle 12c 使用FILE_NAME_CONVERT建立pdb報錯 ORA-01276Oracle
- Oracle 12.2新特性: PDB級閃回資料庫(Flashback PDB)Oracle資料庫
- 【CDB】Oracle CDB/PDB常用管理命令Oracle
- oracle 19c pdb遷移Oracle
- 1.3.2.3. 透過Relocating方式建立PDB
- 1.3.2.1.2.1. 通過快照方式建立PDB
- 1.3.2.3. 通過Relocating方式建立PDB
- oracle 12c rman備份pdbOracle
- Oracle 12c系列(五)|PDB RefreshOracle
- Oracle 12c系列(六)|Relocate a PDBOracle
- Oracle 18C新特性之PDB snapshot Carousel--PDB快照輪播Oracle
- oracle 12c PDB隨CDB啟動和連結PDB的方式Oracle
- 【PDB】Oracle資料庫如何檢查和設定pdb最大儲存大小Oracle資料庫
- 1.3.2.1.1. 通過種子Seed建立PDB
- 1.3.2.1. 通過克隆Cloning方式建立PDB