1. Back up the source library and copy it to the target environment
2. Restore the control file.
Start the database to nomount state
restore controlfile from 'control file backup set';
3. Register the backup set
under RMAN: catalog start with 'the directory where the backup set is located';
4. Restore the database and
get the datafile
select 'set newname for datafile' || file # || ' to '||chr(39)||replace(name,'+DATAC1/fjprd/datafile/','/fjdev/')||chr(39)||';' from v$datafile;
Recovery script (this is suitable for files distributed in different directories)
ORACLE_SID=FJPRD
export ORACLE_SID
$ORACLE_HOME/bin/rman target / log=/export/home/orafjdev/rman_fjprd_20190122.log <<EOF
run { set newname for datafile 1 to '/data2/fjdev/fjdevdata/system.1088.890937449'; restore database; switch datafile all; recover database;
If the data files are all in one directory, use
set newname for database to '/home/oradata/hbdb/%b'; you can
pay attention to this switch datafile all; very important
5. Finally, I encountered an error when alter database open resetlogs:
due to The redolog in the rac environment is in asm, and the controlfile needs to be rebuilt to redirect the redolog file path.
SQL> alter database backup controlfile to trace as '/home/orafjdev/kkk.sql';
SQL> shutdown immediate
Modify the log file path in the control file, Then rebuild the control file
and remove the log of thread2#, just keep a few, not all of them.
6. Use recover database using backup controlfile until cancel; restore
and follow the prompts to restore the archive:
restore archivelog sequence between 61148 and 61155 thread 1;
restore archivelog sequence between 65008 and 65012 thread 2;
re-recover database using backup controlfile;until
7. Execute alter database open resetlogs after completion;
prompt: ORA-38856: Cannot mark instance UNNAMED_INSTANCE_2 (redo thread 2) as enabled
This is a bug, pfile adds: _ no_recovery_through_resetlogs=TRUE
to resetlogs again. After the recovery is complete, comment no_recovery_through_resetlogs=TRUE
8. select THREAD#, STATUS, ENABLED from v$thread;
process and delete useless thread#
alter database disable thread 2;
9. Add tempfile
select tablespace_name from dba_tablespaces where contents='TEMPORARY';
ALTER TABLESPACE TEMP01 ADD TEMPFILE '/data6 /fjdev/fjdevdata/temp01.764.890940701' size 4000M autoextend off;
10. Process undo
show parameter undo
select tablespace_name from dba_tablespaces where contents='UNDO';
rop tablespace APPS_UNDOTBS2 restart including contents and datafiles
database; 1 Normal.