创建非多租户数据库的副本,转化为PDB数据库
环境:
catcdb为容器数据库
orcl为非多租户数据库,数据库版本与容器库一致
要求:
将orcl转为catdb的可插拔数据库
步骤:
-
在catcdb所在服务器配置好连接到orcl的连接串‘orcl’
orcl = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.11)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
-
登陆catcdb创建连接到orcl的dblink
create plublic database link orcl connect to system identified by oracle using 'orcl';
-
创建可拔插数据库catorcl
create pluggable database catorcl from non$cdb@orcl;
-
运行转化脚本
alter session set container=catorcl; @?/rdbms/admin/noncdb_to_pdb.sql; #比较慢,耐心等待 alter pluggable database pdbprod5 open;
-
删除catorcl中的服务信息
select * from dba_service; exec dbms_service.delete_service('ORCLXDB'); exec dbms_service.delete_service('ORCL');
-
重启catorcl
alter pluggable database catorcl close; alter pluggable database catorcl open;