create user c##remote_user identified by oracle_4U container=all;
grant create session , sysoper
to c##remote_user
container=all;
2.在cdb1 中创建DBLINK
create database link link_cdb1
connect to c##remote_user identified by oracle_4U
using '192.168.133.134:1521/orclcdb';
3.在cdb1中,创建proxy pdb
create pluggable database proxy_pdb1 as proxy from pdb1@link_cdb1;
4.验证:
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
4 PROXY_PDB1 READ WRITE NO
。。。
SYS@cdb2 >conn / as sysdba
Connected.
SYS@cdb2 >show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
4 PROXY_PDB1 READ WRITE NO
SYS@cdb2 >
切换到 PROXY_PDB1代理PDB中去。
SYS@cdb2 >alter session set container=proxy_pdb1;
Session altered.
SYS@cdb2 >
SYS@cdb2 >select name from v$datafile;
NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/CDB1/proxy_pdb1/system01.dbf
/u01/app/oracle/oradata/CDB1/proxy_pdb1/sysaux01.dbf
/u01/app/oracle/oradata/CDB1/proxy_pdb1/undotbs01.dbf
SYS@cdb2 >
现在看到是新的代理pdb自己的数据文件
查看PDB,还是PROXY_PDB1
SYS@cdb2 >show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
4 PROXY_PDB1 READ WRITE NO
SYS@cdb2 >show con_name
3.再登录到CDB1/PDB1中去看,是否在代理PDB1中插入的值,在PDB1中,是否也出现了。
SYS@cdb1 >conn / as sysdba
Connected.
SYS@cdb1 >show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SYS@cdb1 >alter session set container=pdb1;