oracle 主机 | pdb | |
---|---|---|
源端 | 192.168.5.128 | pdb2 |
目标端 | 192.168.5.129 | pdb2dg |
前提条件:
1.源库必须处于归档模式
archive log list;
2.源库需要同步的pdb必须open。
1. 目标库创建REMOTE_RECOVERY_FILE_DEST参数文件,并设置参数
mkdir -p /tmp/fixfpdb
alter system set REMOTE_RECOVERY_FILE_DEST='/tmp/fixfpdb';
2.目标库执行duplicate 同步
duplicate pluggable database fixfpdb as dupfixfpdb to orcl from active database nofilenamecheck;
[oracle@19c_cdb ~]$ rman target sys/Oracle123@192.168.5.128:1521/orcl auxiliary sys/Oracle123
Recovery Manager: Release 19.0.0.0.0 - Production on Thu Apr 22 01:30:58 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1575995925)
connected to auxiliary database: ORCL (DBID=1575995925)
RMAN> duplicate pluggable database fixfpdb as dupfixfpdb to orcl from active database nofilenamecheck;
Starting Duplicate PDB at 22-APR-21
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=382 device type=DISK
current log archived
duplicating Online logs to Oracle Managed File (OMF) location
duplicating Datafiles to Oracle Managed File (OMF) location
contents of Memory Script:
{
set newname for clone datafile 16 to new;
set newname for clone datafile 17 to new;
set newname for clone datafile 18 to new;
set newname for clone datafile 20 to new;
restore
from nonsparse clone foreign pluggable database
"FIXFPDB"
from service '192.168.5.128:1521/orcl' ;
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 22-APR-21
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring foreign file 16 to /u01/oracle/oradata/ORCL/AF79DD4522FD0E17E0538105A8C043BD/datafile/o1_mf_system_tovst3j1_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring foreign file 17 to /u01/oracle/oradata/ORCL/AF79DD4522FD0E17E0538105A8C043BD/datafile/o1_mf_sysaux_rfvst3j8_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring foreign file 18 to /u01/oracle/oradata/ORCL/AF79DD4522FD0E17E0538105A8C043BD/datafile/o1_mf_undotbs1_1evst3jg_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring foreign file 20 to /u01/oracle/oradata/ORCL/AF79DD4522FD0E17E0538105A8C043BD/datafile/o1_mf_fixf_qpvst3jj_.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 22-APR-21
current log archived
contents of Memory Script:
{
set archivelog destination to '/tmp/fixfpdb';
restore clone force from service '192.168.5.128:1521/orcl'
foreign archivelog from scn 3467857;
}
executing Memory Script
executing command: SET ARCHIVELOG DESTINATION
Starting restore at 22-APR-21
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting archived log restore to user-specified destination
archived log destination=/tmp/fixfpdb
channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=24
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_AUX_DISK_1: starting archived log restore to user-specified destination
archived log destination=/tmp/fixfpdb
channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=25
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 22-APR-21
Performing import of metadata...
Finished Duplicate PDB at 22-APR-21
3.查看已同步的pdb
sqlplus / as sysdba
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB MOUNTED
4 PDB1 MOUNTED
5 DUPFIXFPDB READ WRITE NO
6 PDB3DG MOUNTED
10 NOCDB MOUNTED