0

I have daily backups of my test system which is taken daily full backups and also hourly arch backups. I need to restore one of these backups to another linux server. I've completed all steps until restoring the database (db in mounted mode). Here is my list of backups:

RMAN> list backup of database summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
8729   B  0  A DISK        21-JUN-24       1       1       YES        DATABASE_BKP
8731   B  0  A DISK        21-JUN-24       1       1       YES        DATABASE_BKP
8732   B  0  A DISK        21-JUN-24       1       1       YES        DATABASE_BKP
8733   B  0  A DISK        21-JUN-24       1       1       YES        DATABASE_BKP
8734   B  0  A DISK        21-JUN-24       1       1       YES        DATABASE_BKP
8735   B  0  A DISK        21-JUN-24       1       1       YES        DATABASE_BKP
8736   B  0  A DISK        21-JUN-24       1       1       YES        DATABASE_BKP
8737   B  0  A DISK        21-JUN-24       1       1       YES        DATABASE_BKP
8784   B  0  A DISK        22-JUN-24       1       1       YES        DATABASE_BKP
8786   B  0  A DISK        22-JUN-24       1       1       YES        DATABASE_BKP
8787   B  0  A DISK        22-JUN-24       1       1       YES        DATABASE_BKP
8788   B  0  A DISK        22-JUN-24       1       1       YES        DATABASE_BKP
8789   B  0  A DISK        22-JUN-24       1       1       YES        DATABASE_BKP
8790   B  0  A DISK        22-JUN-24       1       1       YES        DATABASE_BKP
8791   B  0  A DISK        22-JUN-24       1       1       YES        DATABASE_BKP
8792   B  0  A DISK        22-JUN-24       1       1       YES        DATABASE_BKP
8840   B  0  A DISK        23-JUN-24       1       1       YES        DATABASE_BKP
8842   B  0  A DISK        23-JUN-24       1       1       YES        DATABASE_BKP
8843   B  0  A DISK        23-JUN-24       1       1       YES        DATABASE_BKP
8844   B  0  A DISK        23-JUN-24       1       1       YES        DATABASE_BKP
8845   B  0  A DISK        23-JUN-24       1       1       YES        DATABASE_BKP
8846   B  0  A DISK        23-JUN-24       1       1       YES        DATABASE_BKP
8847   B  0  A DISK        23-JUN-24       1       1       YES        DATABASE_BKP
8848   B  0  A DISK        23-JUN-24       1       1       YES        DATABASE_BKP

How do i restore to 22 or 21 june? All backups on the list are at the same folder

2 Answers 2

2

You should use

set until time "to_date('2024-06-23:00:00:00', 'yyyy-mm-dd:hh24:mi:ss')";

Here is the full example

RMAN> run
{
allocate channel dev1 type disk;
set until time "to_date('2024-06-23:00:00:00', 'yyyy-mm-dd:hh24:mi:ss')";
restore database;
recover database;
}

RMAN> alter database open resetlogs;

Based on contents of the catalog RMAN should build recovery plan: restore datafiles and apply archivelogs.

4
  • Thanks for the script. I'll give it a try. BTW does oracle know it should only apply the 22nd jul backup? Or does it try to apply 21st jul backup first? Commented Jun 26 at 12:50
  • it will restore proper full backup files, apply differentials if any and apply all archivelogs until your date. For the last archive log it will apply it partially.
    – SergeyA
    Commented Jun 26 at 12:57
  • Actually i was asking about, if different full backups at same catalog will affect rman backup job. But thanks for the general order of restore anyways. Commented Jun 26 at 13:00
  • 1
    @postgresnewbie It will take the newest backup that is older than the requested date.
    – miracle173
    Commented Jul 8 at 10:17
-1

Start the DB instance and take it to Mount stage.

Connect to RMAN and issue below command:

run
{
RESTORE DATABASE from tag TAG20240627;
RECOVER DATABASE UNTIL TIME "TO_DATE('2024-06-27 11:22:33', 'YYYY-MM-DD HH24:MI:SS')";
sql 'ALTER DATABASE OPEN RESETLOGS';
}

Hope it helped !! :)

1
  • Thanks but as you can see from the query result, tag name is "DATABASE_BKP" , not a name contains specific date. Commented Jun 28 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.