Oracle恢复至不同的SID实例

测试:
oracle源实例  SID=ORCL
oracle 目标实例  SID=YOYO
目标恢实例 SID=orcl 的数据库到SID=yoyo中

–源实例操作
1. backup format=’/home/oracle/bak/full_%d_%T_%s’ database include current controlfile plus archivelog;
查看源实例SID=ORCL备份历史:

RMAN> list backup summary;

using target database control file instead of recovery catalog
List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1       B  A  A DISK        20-JUN-20       1       1       NO         TAG20200620T112823
2       B  F  A DISK        20-JUN-20       1       1       NO         TAG20200620T112824
3       B  F  A DISK        20-JUN-20       1       1       NO         TAG20200620T112824
4       B  A  A DISK        20-JUN-20       1       1       NO         TAG20200620T112905

2.目前源实例SID=ORCL中的tb1只有2行数据库,最新的redolog的SEQUENCE是11,最新的archivelog的SEQUENCE是10:

SQL> select * from tb1;
	ID NAME
---------- --------------------------------------------------------------------------------
	 1 yo1
	 2 yo2


SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE	  MEMBERS ARC STATUS	       FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME	  CON_ID
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ --------- ----------
	 1	    1	      10   52428800	   512		1 YES INACTIVE		     1627592 20-JUN-20	    1627647 20-JUN-20	       0
	 2	    1	      11   52428800	   512		1 NO  CURRENT		     1627647 20-JUN-20	 2.8147E+14		       0
	 3	    1	       9   52428800	   512		1 YES INACTIVE		     1624541 20-JUN-20	    1627592 20-JUN-20	       0

SQL> archive log list;
Database log mode	       Archive Mode
Automatic archival	       Enabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     9
Next log sequence to archive   11
Current log sequence	       11


SQL> select SEQUENCE#,NAME,FIRST_CHANGE#,NEXT_CHANGE#,STATUS,COMPLETION_TIME,DELETED,ARCHIVED from  v$archived_log order by SEQUENCE# desc;
 SEQUENCE# NAME 									    FIRST_CHANGE# NEXT_CHANGE# S COMPLETIO DEL ARC
---------- -------------------------------------------------------------------------------- ------------- ------------ - --------- --- ---
	10 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_10_hgwbt0r	  1627592      1627647 A 20-JUN-20 NO  YES
	   l_.arc

	 9 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_9_hgwbrprn	  1624541      1627592 A 20-JUN-20 NO  YES
	   _.arc

	 8 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_8_hgw866bo	  1624444      1624541 A 20-JUN-20 NO  YES
	   _.arc

	 7 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_7_hgw81x8x	  1624439      1624444 A 20-JUN-20 NO  YES
	   _.arc

 SEQUENCE# NAME 									    FIRST_CHANGE# NEXT_CHANGE# S COMPLETIO DEL ARC
---------- -------------------------------------------------------------------------------- ------------- ------------ - --------- --- ---

	 6 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_6_hgw81rq6	  1618275      1624439 A 20-JUN-20 NO  YES
	   _.arc

3.现在往tb1表继续添加2行数据,commit后,多次switchlog,并且archive log
alter system archive log current;
alter system switch logfile;
select * from v$log;
select SEQUENCE#,NAME,FIRST_CHANGE#,NEXT_CHANGE#,STATUS,COMPLETION_TIME,DELETED,ARCHIVED from  v$archived_log order by SEQUENCE# desc;
archive log list;

SQL> insert into tb1 values(3,'yo3');
1 row created.

SQL> insert into tb1 values(33,'yo33');
1 row created.

SQL> select * from tb1;
	ID NAME
---------- --------------------------------------------------------------------------------
	 1 yo1
	 2 yo2
	 3 yo3
	33 yo33

SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE	  MEMBERS ARC STATUS	       FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME	  CON_ID
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ --------- ----------
	 1	    1	      10   52428800	   512		1 YES INACTIVE		     1627592 20-JUN-20	    1627647 20-JUN-20	       0
	 2	    1	      11   52428800	   512		1 NO  CURRENT		     1627647 20-JUN-20	 2.8147E+14		       0
	 3	    1	       9   52428800	   512		1 YES INACTIVE		     1624541 20-JUN-20	    1627592 20-JUN-20	       0

SQL> alter system switch logfile;
System altered.

SQL> alter system switch logfile;
System altered.

SQL> alter system switch logfile;
System altered.

SQL> alter system archive log current;
System altered.

SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE	  MEMBERS ARC STATUS	       FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME	  CON_ID
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ --------- ----------
	 1	    1	      13   52428800	   512		1 YES INACTIVE		     1628704 20-JUN-20	    1628708 20-JUN-20	       0
	 2	    1	      14   52428800	   512		1 YES INACTIVE		     1628708 20-JUN-20	    1628745 20-JUN-20	       0
	 3	    1	      15   52428800	   512		1 NO  CURRENT		     1628745 20-JUN-20	 2.8147E+14		       0

SQL> select * from tb1;
	ID NAME
---------- --------------------------------------------------------------------------------
	 1 yo1
	 2 yo2
	 3 yo3
	33 yo33 

4.再备份一次归档日志  backup  archivelog all  format=’/home/oracle/bak/full_%d_%T_%s’  delete input;

SQL> host rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 20 11:50:47 2020
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=1571355193)

RMAN> backup  archivelog all  format='/home/oracle/bak/full_%d_%T_%s'  delete input;

Starting backup at 20-JUN-20
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=264 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=6 RECID=1 STAMP=1043577720
input archived log thread=1 sequence=7 RECID=2 STAMP=1043577725
input archived log thread=1 sequence=8 RECID=3 STAMP=1043577862
input archived log thread=1 sequence=9 RECID=4 STAMP=1043580502
input archived log thread=1 sequence=10 RECID=5 STAMP=1043580544
input archived log thread=1 sequence=11 RECID=6 STAMP=1043581719
input archived log thread=1 sequence=12 RECID=7 STAMP=1043581727
input archived log thread=1 sequence=13 RECID=8 STAMP=1043581736
input archived log thread=1 sequence=14 RECID=9 STAMP=1043581767
input archived log thread=1 sequence=15 RECID=10 STAMP=1043581876
channel ORA_DISK_1: starting piece 1 at 20-JUN-20
channel ORA_DISK_1: finished piece 1 at 20-JUN-20
piece handle=/home/oracle/bak/full_ORCL_20200620_5 tag=TAG20200620T115117 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_6_hgw81rq6_.arc RECID=1 STAMP=1043577720
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_7_hgw81x8x_.arc RECID=2 STAMP=1043577725
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_8_hgw866bo_.arc RECID=3 STAMP=1043577862
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_9_hgwbrprn_.arc RECID=4 STAMP=1043580502
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_10_hgwbt0rl_.arc RECID=5 STAMP=1043580544
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_11_hgwcyqo4_.arc RECID=6 STAMP=1043581719
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_12_hgwcyzvw_.arc RECID=7 STAMP=1043581727
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_13_hgwcz881_.arc RECID=8 STAMP=1043581736
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_14_hgwd076g_.arc RECID=9 STAMP=1043581767
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_15_hgwd3nvj_.arc RECID=10 STAMP=1043581876
Finished backup at 20-JUN-20

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1       B  A  A DISK        20-JUN-20       1       1       NO         TAG20200620T112823
2       B  F  A DISK        20-JUN-20       1       1       NO         TAG20200620T112824
3       B  F  A DISK        20-JUN-20       1       1       NO         TAG20200620T112824
4       B  A  A DISK        20-JUN-20       1       1       NO         TAG20200620T112905
5       B  A  A DISK        20-JUN-20       1       1       NO         TAG20200620T115117

5.恢复源数据库的第一次备份加上后面的归档日志备份 到 新的目录, 测试实例SID=yoyo使用这些datafile/logfile是否恢复最新状态(tb1 新插入的2行数据):

SQL> host rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 20 11:55:10 2020
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=1571355193)

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name ORCL
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    790      SYSTEM               YES     /u01/app/oracle/oradata/orcl/system01.dbf
3    610      SYSAUX               NO      /u01/app/oracle/oradata/orcl/sysaux01.dbf
4    80       UNDOTBS1             YES     /u01/app/oracle/oradata/orcl/undotbs01.dbf
5    1243     EXAMPLE              NO      /u01/app/oracle/oradata/orcl/example01.dbf
6    5        USERS                NO      /u01/app/oracle/oradata/orcl/users01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    60       TEMP                 32767       /u01/app/oracle/oradata/orcl/temp01.dbf


RMAN> run{     
set newname for datafile 1 to '/u01/app/oracle/oradata/YOYO/datafile/system01.dbf';   
set newname for datafile 3 to '/u01/app/oracle/oradata/YOYO/datafile/sysaux02dbf';   
set newname for datafile 4 to '/u01/app/oracle/oradata/YOYO/datafile/undo03.dbf'; 
set newname for datafile 5 to '/u01/app/oracle/oradata/YOYO/datafile/example05.dbf';
set newname for datafile 6 to '/u01/app/oracle/oradata/YOYO/datafile/user06.dbf;   
restore database;
}



RMAN> run{     
set newname for datafile 1 to '/u01/app/oracle/oradata/YOYO/datafile/system01.dbf';   
restore datafile 1;
}2> 3> 4> 

executing command: SET NEWNAME
Starting restore at 20-JUN-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=263 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/YOYO/datafile/system01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/bak/full_ORCL_20200620_2
channel ORA_DISK_1: piece handle=/home/oracle/bak/full_ORCL_20200620_2 tag=TAG20200620T112824
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 20-JUN-20
RMAN> run{
     set archivelog destination to '/home/oracle/bak2';
     restore archivelog low logseq 6;}
2> 3> 

executing command: SET ARCHIVELOG DESTINATION
using target database control file instead of recovery catalog
Starting restore at 20-JUN-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK
channel ORA_DISK_1: starting archived log restore to user-specified destination
archived log destination=/home/oracle/bak2
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=6
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=7
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=8
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=9
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=10
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=11
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=12
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=13
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=14
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=15
channel ORA_DISK_1: reading from backup piece /home/oracle/bak/full_ORCL_20200620_5
channel ORA_DISK_1: piece handle=/home/oracle/bak/full_ORCL_20200620_5 tag=TAG20200620T115117
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 20-JUN-20

–目标实例操作
1.目标库当前的datafile

RMAN> report schema;
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name YOYO
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    780      SYSTEM               YES     /u01/app/oracle/oradata/YOYO/datafile/o1_mf_system_hgwb7n71_.dbf
3    580      SYSAUX               NO      /u01/app/oracle/oradata/YOYO/datafile/o1_mf_sysaux_hgwb6k0c_.dbf
4    60       UNDOTBS1             YES     /u01/app/oracle/oradata/YOYO/datafile/o1_mf_undotbs1_hgwb92ob_.dbf
6    5        USERS                NO      /u01/app/oracle/oradata/YOYO/datafile/o1_mf_users_hgwb91l4_.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    60       TEMP                 32767       /u01/app/oracle/oradata/YOYO/datafile/o1_mf_temp_hgwbbg8w_.tmp

2.备份目标数据库的controlfile,修改 datafile 指向恢复过来的datafile以create new controlfile(这里并没有使用源数据库的spfile 和controlfile ,
因为源目标SID不一样,从源数据库拿过来的文件还要修改DB_name和controlfile路径等,这里就直接使用目标库上本身的文件)
alter database backup controlfile to trace as ‘/home/oracle/bak2/yoyoctl.txt

3.shutdown数据后,startup nomount,然后create new controlfile:

SQL> CREATE CONTROLFILE SET DATABASE "YOYO" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/u01/app/oracle/oradata/YOYO/onlinelog/o1_mf_1_hgwc7smv_.log',
    '/u01/app/oracle/fast_recovery_area/YOYO/onlinelog/o1_mf_1_hgwc7svx_.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 2 (
    '/u01/app/oracle/oradata/YOYO/onlinelog/o1_mf_2_hgwc7tc3_.log',
    '/u01/app/oracle/fast_recovery_area/YOYO/onlinelog/o1_mf_2_hgwc7tn7_.log'
  ) SIZE 50M BLOCKSIZE 512,
  GROUP 3 (
    '/u01/app/oracle/oradata/YOYO/onlinelog/o1_mf_3_hgwc7v54_.log',
    '/u01/app/oracle/fast_recovery_area/YOYO/onlinelog/o1_mf_3_hgwc7vhl_.log'
  ) SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u01/app/oracle/oradata/YOYO/datafile/system01.dbf',
  '/u01/app/oracle/oradata/YOYO/datafile/sysaux02dbf',
  '/u01/app/oracle/oradata/YOYO/datafile/undo03.dbf',
  '/u01/app/oracle/oradata/YOYO/datafile/example05.dbf',
  '/u01/app/oracle/oradata/YOYO/datafile/user06.dbf'
CHARACTER SET WE8MSWIN1252
;  2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28  

Control file created.

SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01100: database already mounted

创建控制文件
SET or REUSE:
仅仅有数据文件头的database name与參数文件的db_name一致,在重建控制文件时才用reuse.
恢复过来的数据库文件里面db name还是旧的orcl,这里要改变数据文件头的db_name使他们与參数的新db_name=yoyo一致,就需要使用set

noresetlogs or resetlogs:
假如用的是noresetlogs的选项,那么controlfile里面的系统scn和controlfile里面记录的数据文件scn号,源于redo logs中的Current log/active log头.
前提是redolog能完好,这个选项并不清除redo log file中的内容与重置redo头的scn号;反之,resetlog会清空redo log file中的内容,sequence由1重新算.

4.recovery使用归档日志到sequence 15: 通过tb1判断确实恢复至最新状态:
recover database using backup controlfile until cancel;

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 1627185 generated at 06/20/2020 11:20:06 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/fast_recovery_area/YOYO/archivelog/2020_06_20/o1_mf_1_10_%u_.arc
ORA-00280: change 1627185 for thread 1 is in sequence #10

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/home/oracle/bak2/1_10_1043574458.dbf
ORA-00279: change 1627229 generated at 06/20/2020 11:20:54 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/fast_recovery_area/YOYO/archivelog/2020_06_20/o1_mf_1_11_%u_.arc
ORA-00280: change 1627229 for thread 1 is in sequence #11
ORA-00278: log file '/home/oracle/bak2/1_10_1043574458.dbf' no longer needed
for this recovery

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/home/oracle/bak2/1_11_1043574458.dbf
ORA-00279: change 1627494 generated at 06/20/2020 11:24:31 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/fast_recovery_area/YOYO/archivelog/2020_06_20/o1_mf_1_12_%u_.arc
ORA-00280: change 1627494 for thread 1 is in sequence #12
ORA-00278: log file '/home/oracle/bak2/1_11_1043574458.dbf' no longer needed
for this recovery

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/home/oracle/bak2/1_12_1043574458.dbf
ORA-00279: change 1627497 generated at 06/20/2020 11:24:32 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/fast_recovery_area/YOYO/archivelog/2020_06_20/o1_mf_1_13_%u_.arc
ORA-00280: change 1627497 for thread 1 is in sequence #13
ORA-00278: log file '/home/oracle/bak2/1_12_1043574458.dbf' no longer needed
for this recovery

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/home/oracle/bak2/1_13_1043574458.dbf
ORA-00279: change 1627500 generated at 06/20/2020 11:24:35 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/fast_recovery_area/YOYO/archivelog/2020_06_20/o1_mf_1_14_%u_.arc
ORA-00280: change 1627500 for thread 1 is in sequence #14
ORA-00278: log file '/home/oracle/bak2/1_13_1043574458.dbf' no longer needed
for this recovery

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/home/oracle/bak2/1_14_1043574458.dbf
ORA-00279: change 1627561 generated at 06/20/2020 11:25:34 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/fast_recovery_area/YOYO/archivelog/2020_06_20/o1_mf_1_15_%u_.arc
ORA-00280: change 1627561 for thread 1 is in sequence #15
ORA-00278: log file '/home/oracle/bak2/1_14_1043574458.dbf' no longer needed
for this recovery

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/home/oracle/bak2/1_15_1043574458.dbf
ORA-00279: change 1627650 generated at 06/20/2020 11:27:05 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/fast_recovery_area/YOYO/archivelog/2020_06_20/o1_mf_1_16_%u_.arc
ORA-00280: change 1627650 for thread 1 is in sequence #16
ORA-00278: log file '/home/oracle/bak2/1_15_1043574458.dbf' no longer needed
for this recovery

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log
'/u01/app/oracle/fast_recovery_area/YOYO/archivelog/2020_06_20/o1_mf_1_16_%u_.ar
c'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

SQL> alter database open resetlogs;
Database altered.

SQL> select * from tb1;
	ID NAME
---------- ------
	 1 yo1
	 2 yo2
	 3 yo3
	33 yo33

SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/YOYO/datafile/system01.dbf
/u01/app/oracle/oradata/YOYO/datafile/sysaux02dbf
/u01/app/oracle/oradata/YOYO/datafile/undo03.dbf
/u01/app/oracle/oradata/YOYO/datafile/example05.dbf
/u01/app/oracle/oradata/YOYO/datafile/user06.dbf

5.目标库SID=YOYO,但是dbid还是和源数据库一致(dbid存在于controlfile和datafile中):

SQL> select dbid from v$database;
      DBID
----------
1571355193

SQL> host rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 20 12:12:46 2020
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
connected to target database: YOYO (DBID=1571355193)

RMAN> report schema;
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name YOYO

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    790      SYSTEM               YES     /u01/app/oracle/oradata/YOYO/datafile/system01.dbf
3    610      SYSAUX               NO      /u01/app/oracle/oradata/YOYO/datafile/sysaux02dbf
4    80       UNDOTBS1             YES     /u01/app/oracle/oradata/YOYO/datafile/undo03.dbf
5    1243     EXAMPLE              NO      /u01/app/oracle/oradata/YOYO/datafile/example05.dbf
6    5        USERS                NO      /u01/app/oracle/oradata/YOYO/datafile/user06.dbf
RMAN> 

本文地址:https://blog.csdn.net/aryoyo/article/details/107893458

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐