RMAN Restore on Linux

Restore Spfile

~]$ rman target / nocatalog

RMAN> startup nomount
RMAN> restore spfile from '/backup/spfile_01uuf10m_1_1.bak';
RMAN> shutdown abort

Restore Controlfile

(Option) Modify the controlfile path:

SQL> startup nomount
SQL> alter system set control_files = '/home/oracle/orcl/control01.ctl','/home/oracle/orcl/control02.ctl' scope=spfile;
SQL> shutdown abort

Restore controlfile.

~]$ rman target / nocatalog

RMAN> startup nomount
RMAN> set dbid <dbid>

RMAN> restore controlfile from '/backup/cntrl_46_1_730733685';

Restore Datafile

(Option) - Modify the datafile and tempfile path.

SQL> set lines 200
SQL> select 'set newname for datafile ''' || name|| ''' to ''/dest_dir/' || substr(name, instr(name, '/', -1) + 1) || ''';' from v$datafile order by file#;
SQL> select 'set newname for tempfile ''' || name || ''' to ''/dest_dir/' || substr(name, instr(name, '/', -1) + 1) || ''';' from v$tempfile order by file#;

Restore database.

~]$ rman target / nocatalog

RMAN> sql 'alter database mount';

RMAN> catalog start with '/backup/';
RMAN> run {
allocate channel ch00 type disk;
allocate channel ch01 type disk;
-- specify the new location for each datafile
-- set newname for database to '/datafile/%U.dbf';
-- set newname for datafile 1 to '/oracle/oradata/datafile01.dbf';
-- set newname for tempfile 1 to '/oracle/oradata/tempfile01.dbf';
restore database;
-- switch datafile all;
-- switch tempfile all;
release channel ch00;
release channel ch01;
}

Restore Tablespace

RMAN> run {
sql 'alter tablespace users offline immediate';
sql 'alter tablespace tools offline immediate';
-- specify the new location for each datafile
-- set newname for datafile '/olddisk/users01.dbf' to '/newdisk/users01.dbf';
-- set newname for datafile '/olddisk/tools01.dbf' to '/newdisk/tools01.dbf';
-- set newname for datafile '/olddisk/trgt/tools01.dbf' to '+dgroup';
restore tablespace users, tools;
-- switch datafile all;
recover tablespace users, tools;
}

RMAN> sql 'alter tablespace users online';
RMAN> sql 'alter tablespace tools online';

Restore Archivelog

(Option) - Modify the archivelog path.

SQL> alter system set log_archive_dest_1='location=/home/oracle/orcl/arch' scope=both;

Restore archivelog.

~]$ rman target / nocatalog

RMAN> list backup of archivelog all;

RMAN> run {
allocate channel ch00 type disk;
-- set archivelog destination to '/backup/arch/';
-- restore archivelog from logseq=15 until logseq=20;
restore archivelog all;
release channel ch00;
}

SQL> set logsource /backup/rman/arch
SQL> alter database using backup controlfile until cancel;

Recover Database

  • Using RMAN
RMAN> recover database;
  • Using SQLPLUS
SQL> recover database until cancel;

SQL> recover database using backup controlfile;

SQL> recover database using backup controlfile until cancel;

Open Resetlogs

(Option) - Modify redolog path.

SQL> set lines 200
SQL> select 'alter database rename file ''' || member || ''' to ''/dest_dir/' || substr(member, instr(member, '/', -1) + 1) || ''';' from v$logfile;

Open resetlogs.

alter database open resetlogs;

Troubleshooting

ORA-01152: file 1 was not restored from a sufficiently old backup

ORA-01152

RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 04/15/2026 14:28:07
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/home/oracle/orcl/system01.dbf'

Solution:

Recover database.

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 1322732 generated at 04/15/2026 16:03:55 needed for thread 1
ORA-00289: suggestion : /home/oracle/orcl/arch/1_20_1153845084.dbf
ORA-00280: change 1322732 for thread 1 is in sequence #20


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log
'/home/oracle/orcl/arch/1_20_1153845084.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3


ORA-00308: cannot open archived log
'/home/oracle/orcl/arch/1_20_1153845084.dbf'
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.

RMAN-06025: no backup of archived log for thread 1 with sequence 2 and starting SCN of 925918 found to restore

RMAN> run {
allocate channel ch00 type disk;
set archivelog destination to '/home/oracle/orcl/arch/';
restore archivelog all;
release channel ch00;
}2> 3> 4> 5> 6>

allocated channel: ch00
channel ch00: SID=125 device type=DISK

executing command: SET ARCHIVELOG DESTINATION

Starting restore at 15-APR-26

released channel: ch00
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/15/2026 16:34:19
RMAN-06026: some targets not found - aborting restore
RMAN-06025: no backup of archived log for thread 1 with sequence 21 and starting SCN of 1322761 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 14 and starting SCN of 1260687 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 13 and starting SCN of 1239019 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 12 and starting SCN of 1218908 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 11 and starting SCN of 1196654 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 10 and starting SCN of 1164995 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 9 and starting SCN of 1115335 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 8 and starting SCN of 1089088 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 7 and starting SCN of 1053728 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 6 and starting SCN of 1026897 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 5 and starting SCN of 996525 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 4 and starting SCN of 976473 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 3 and starting SCN of 954329 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 2 and starting SCN of 925918 found to restore

Solution:

Specified sequence of archivelog that exist.

RMAN> restore archivelog from logseq=15 until logseq=20;

Reference

How to restore the control file and recover database to the most recent available with Oracle database.mhtml |