目录
目标
将源端的non-CDB 迁移到目标端的CDB中
参考文档
38.6 Creating a PDB Using a Non-CDB
环境信息
| 源端 | 目标端 |
实例名 | orcl | root:oracdb pdb:ncdb |
版本 | 12.2.0.1 | 12.2.0.1 |
实施过程
利用DBMS_PDB.DESCRIBE存储过程来插入non-CDB,实现将non-CDB数据库插入到CDB中
制作pdb xml文件
以只读方式打开non-CDB
SQL*Plus: Release 12.2.0.1.0 Production on Mon Mar 22 10:24:08 2021 |
运行DBMS_PDB.DESCRIBE生成xml文件
BEGIN |
查看xml文件
[oracle@oracle12c ~]$ ll *.xml |
兼容性检查
在CDB中进行兼容性检查
SET SERVEROUTPUT ON |
返回YES即兼容性无问题
关闭non-CDB
[oracle@oracle12c ~]$ export ORACLE_SID=orcl |
创建pdb
使用生成的non-CDB xml创建pdb
CREATE PLUGGABLE DATABASE ncdb USING '/home/oracle/orcl.xml' |
SQL> show pdbs |
pdb已经建完并启动到mount状态
继续执行脚本@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
SQL> alter session set container=ncdb; |
启动pdb
SQL> show pdbs; |
验证数据
以scott用户连接到pdb
[oracle@oracle12c ~]$ sqlplus scott/tiger@192.168.106.10/ncdb |
查看原库数据
[oracle@oracle12c ~]$ sqlplus scott/tiger@192.168.106.10/orcl |
至此non-CDB插入CDB完成