PDB克隆遷移轉換
測試環境
源 10.8.98.150 19c
目標 10.8.98.103 19c
noncdb 遷移轉成pdb見
http://blog.itpub.net/70004783/viewspace-2854421/
1、本地克隆pdb
1.1環境檢查
Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO
1.2 透過PDB$SEED建立新的pdb
SQL> CREATE PLUGGABLE DATABASE PDB1 ADMIN USER PDB1ADMIN IDENTIFIED BY PASS ROLES=(CONNECT) FILE_NAME_CONVERT=('/u01/app/oracle/oradata/PROD/pdbseed/','/u01/app/oracle/oradata/PROD/pdb1/'); Pluggable database created.
1.3透過pdb1克隆建立新的pdb2
SQL> create pluggable database pdb2 from pdb1 file_name_convert=('pdb1','pdb2'); Pluggable database created. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 PDB2 MOUNTED
#####################################
相容性參考文件http://blog.itpub.net/70004783/viewspace-2854421/
2、跨伺服器克隆pdb(我這邊是跨伺服器克隆插拔式資料庫PDB2)
2.1本地複製異地進行插入方式
2.1.1源環境克隆
源pdb開啟到read only模式, 再生成xml檔案。
SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 4 PDB2 MOUNTED SQL> alter pluggable database open read only; Pluggable database altered. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 4 PDB2 READ ONLY NO SQL> SQL> begin 2 dbms_pdb.describe(PDB_DESCR_FILE=>'/home/oracle/pdb2.xml'); 3 end; 4 / PL/SQL procedure successfully completed. SQL>
複製xml以及pdb2檔案到目標環境,且目標環境建立相應的目錄
目標環境 mkdir -p /u01/app/oracle/oradata/PROD/pdb2/ 源環境 scp pdb2.xml 10.8.98.103:/home/oracle/ [oracle@dbserver pdb2]$ pwd /u01/app/oracle/oradata/PROD/pdb2 [oracle@dbserver pdb2]$ scp * 10.8.98.103:/u01/app/oracle/oradata/PROD/pdb2/ oracle@10.8.98.103's password: sysaux01.dbf 100% 310MB 77.5MB/s 00:04 system01.dbf 100% 270MB 90.0MB/s 00:03 temp012022-01-29_11-07-13-474-AM.dbf 100% 36MB 61.5MB/s 00:00 undotbs01.dbf 100% 100MB 57.6MB/s 00:01
目標環境插入pdb2
SQL> create pluggable database pdb2 using '/home/oracle/pdb2.xml' nocopy ; create pluggable database pdb2 using '/home/oracle/pdb2.xml' nocopy * ERROR at line 1: ORA-27038: created file already exists ORA-01119: error in creating database file '/u01/app/oracle/oradata/PROD/pdb2/temp012022-01-29_11-07-13-474-AM.dbf' SQL>
報錯: 這裡設定了tempfile reuse,如果不設定oracle會自動嘗試建立tempfile,但是此tempfile已經手工複製了,就會報錯:
所以將
/u01/app/oracle/oradata/PROD/pdb2/temp012022-01-29_11-07-13-474-AM.dbf
檔案在目標端刪除後,重新目標端插入pdb2
[oracle@dbserver pdb2]$ rm -f temp012022-01-29_11-07-13-474-AM.dbf SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 4 PDB1 MOUNTED 5 NONCDB MOUNTED SQL> SQL> SQL> create pluggable database pdb2 using '/home/oracle/pdb2.xml' nocopy ; Pluggable database created. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 4 PDB1 MOUNTED 5 NONCDB MOUNTED 7 PDB2 MOUNTED SQL> alter pluggable database pdb2 open; Pluggable database altered. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 4 PDB1 MOUNTED 5 NONCDB MOUNTED 7 PDB2 READ WRITE NO SQL>
#########################################
3、dblink方式
源端建立使用者用於dblink
SQL> alter session set container = pdb3; Session altered. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 5 PDB3 READ WRITE NO SQL> SQL> create user remote_clone_user identified by remote_clone_user; User created. SQL> grant create session,create pluggable database to remote_clone_user; Grant succeeded. SQL>
在目標端建立到非cdb的資料庫連結
首先目標端的tnsnames.ora新增本地連結名稱給dblink使用,我這裡加了tns_150_pdb3,並且測試tnsping OK.
[oracle@dbserver admin]$ tnsping tns_150_pdb3 TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 15-FEB-2022 10:49:33 Copyright (c) 1997, 2019, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.98.150)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICA TED) (SERVICE_NAME = pdb3))) OK (110 msec) [oracle@dbserver admin]$ cat tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. PROD = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = prod) ) ) tns_150 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.98.150)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = prod) ) ) tns_150_pdb3 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.98.150)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdb3) ) ) LISTENER_PROD = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
在目標端建立dblink
SQL> create database link pdb3_clone_link connect to remote_clone_user identified by remote_clone_user using 'tns_150_pdb3'; Database link created.
登入測試
SQL> desc user_tables@PDB3_CLONE_LINK; Name Null? Type ----------------------------------------- -------- ---------------------------- TABLE_NAME NOT NULL VARCHAR2(128) TABLESPACE_NAME VARCHAR2(30) CLUSTER_NAME VARCHAR2(128) IOT_NAME VARCHAR2(128) STATUS VARCHAR2(8) INITIAL_EXTENT NUMBER NEXT_EXTENT NUMBER MIN_EXTENTS NUMBER 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
在目標端執行資料庫克隆,記住 先在 目標端建立好對應的目錄
SQL> !mkdir -p /u01/app/oracle/oradata/PROD/pdb3_clone/ SQL> create pluggable database pdb3_clone from pdb3@pdb3_clone_link file_name_convert=('/u01/app/oracle/oradata/PROD/pdb3/','/u01/app/oracle/oradata/PROD/pdb3_clone/'); Pluggable database created. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB3_CLONE READ WRITE NO 4 PDB1 MOUNTED 5 NONCDB MOUNTED 7 PDB2 READ WRITE NO
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70004783/viewspace-2855682/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【BUILD_ORACLE】使用Oracle資料泵線上不停機克隆/遷移PDBUIOracle
- oracle 19c pdb遷移Oracle
- Oracle 建立PDB-本地克隆Oracle
- Oracle 建立PDB-遠端克隆Oracle
- 多租戶:在Oracle12.2中 從Non-CDB遷移到PDB,從PDB遷移另一個CDB中Oracle
- 12c跨平臺完成PDB的備份遷移
- RMAN備份恢復典型案例——跨平臺遷移pdb
- .net core遷移實踐:專案檔案csproj的轉換
- 1.3.2.1. 通過克隆Cloning方式建立PDB
- Z002-O001-02 克隆本地 PDB
- 容器和映象轉化、遷移方式【轉】
- Z003-O001-03 克隆遠端 PDB
- Oracle RAC 遷移替換 OCR 盤Oracle
- 飛槳萬能轉換小工具X2Paddle,教你玩轉模型遷移模型
- noncdb轉pdb
- 飛槳上線萬能轉換小工具,教你玩轉TensorFlow、Caffe等模型遷移模型
- wsl遷移儲存位置(轉載)
- Z005-O001-05 DBCA 靜默克隆本地 PDB
- Oracle 12c系列(七) | Non-CDB轉換為PDBOracle
- oracle RAC 更換儲存遷移資料Oracle
- Z006-O001-06 DBCA 靜默克隆遠端 PDB
- Kubernetes跨StorageClass遷移,切換Rainbond預設SCAI
- 網站遷移更換伺服器的方法網站伺服器
- Oracle 12.2 新特性:線上PDB資料庫克隆(Pluggable Hot Clone)Oracle資料庫
- 5 切換和故障轉移操作
- 轉轉MySQL機房遷移半小時結束戰鬥?MySql
- 棧遷移
- 遷移公告
- Spring Cloud Alibaba遷移指南(二):零程式碼替換 EurekaSpringCloud
- 服務遷移之路 | Spring Cloud向Service Mesh轉變SpringCloud
- 【遷移】SqlServer 遷移到 MySQL 方法ServerMySql
- docker映象遷移Docker
- 賬號遷移
- Jenkins Job遷移Jenkins
- 移動端html展示word文件轉換方法HTML
- 遷移資料庫的檔案到不同路徑(轉)資料庫
- [論文閱讀] 顏色遷移-N維pdf遷移
- 部落格園cnblog部落格遷移到Hexo(提供格式轉換)Hexo