SQL>set lines 200 SQL>select'set newname for datafile '''|| name||''' to ''/dest_dir/'|| substr(name, instr(name, '/', -1) +1) ||''';'from v$datafile orderby file#; SQL>select'set newname for tempfile '''|| name ||''' to ''/dest_dir/'|| substr(name, instr(name, '/', -1) +1) ||''';'from v$tempfile orderby file#;
Restore database.
~]$ rman target / nocatalog
RMAN>sql'alter database mount';
RMAN> catalog startwith'/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> 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;
RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure ofalter db command at04/15/202614: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 at04/15/202616:03:55 needed for thread 1 ORA-00289: suggestion : /home/oracle/orcl/arch/1_20_1153845084.dbf ORA-00280: change 1322732for thread 1isin 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>
released channel: ch00 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of restore command at04/15/202616:34:19 RMAN-06026: some targets not found - aborting restore RMAN-06025: no backup of archived log for thread 1with sequence 21and starting SCN of1322761 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 14and starting SCN of1260687 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 13and starting SCN of1239019 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 12and starting SCN of1218908 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 11and starting SCN of1196654 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 10and starting SCN of1164995 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 9and starting SCN of1115335 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 8and starting SCN of1089088 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 7and starting SCN of1053728 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 6and starting SCN of1026897 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 5and starting SCN of996525 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 4and starting SCN of976473 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 3and starting SCN of954329 found to restore RMAN-06025: no backup of archived log for thread 1with sequence 2and starting SCN of925918 found to restore
Solution:
Specified sequence of archivelog that exist.
RMAN> restore archivelog from logseq=15 until logseq=20;