snippetMinor
ORACLE restore - how to restore specific .bkp file?
Viewed 0 times
filehowbkpspecificoraclerestore
Problem
I just started working with oracle and I have some issue.
My database is NONARCHIVELOG mode.
I made two backups:
they are at locations:
I want to restore second file from 7th April.
I read some guide on:
http://orafusion.com/art_rman3.htm
but I can not find command how to specify restore command with specific backup files from these two (or more). It does not say on this link and on other links I read.
I want to use it with RMAN commands.
what will be the commands to restore my older backup?
I found
but how it will know what file to restore?
Also does it always need to restore spfile and control file because I did not create some additional backups (just ran command
Thank you!!
My database is NONARCHIVELOG mode.
I made two backups:
they are at locations:
/opt/oracle/flash_recovery_area/CTGINST1/backupset/ol_mf_____20130408.bkp
/opt/oracle/flash_recovery_area/CTGINST1/backupset/ol_mf_____20130407.bkpI want to restore second file from 7th April.
I read some guide on:
http://orafusion.com/art_rman3.htm
but I can not find command how to specify restore command with specific backup files from these two (or more). It does not say on this link and on other links I read.
I want to use it with RMAN commands.
what will be the commands to restore my older backup?
I found
RMAN> restore database;but how it will know what file to restore?
Also does it always need to restore spfile and control file because I did not create some additional backups (just ran command
backup database)Thank you!!
Solution
TL;DR: Just supply the tag of the backup you want to restore the database from, for example
DISCLAIMER
The solution provided here is based solely on my own experience, you use it on your own risk. I'm not liable for any damages (including data loss) caused by using this solution.
Also, do I always need to restore spfile and control file because I
did not create some additional backups (just ran command
By default RMAN is configured to automatically back up control file and spfile after every successful backup and on every database structural change (for example, adding datafiles) which causes these changes to be reflected in control files. Thus after every successful database backup with
You can determine if autobackup is enabled by issuing
Since you supplied the paths to the backup sets you want to restore your database from, I assume that you obtained them from your current control file using RMAN. It won't hurt to save this information and other information about your existing backups to a plain text file because you will restore one of the previous control files and chances are this information will be lost:
You'll need to restore your database AND control file(s), because the database datafile headers of every datafile should be in sync with control file(s), i. e. they should have the same System Change Number (SCN).
As I already said, you just need to supply the tag name to restore the database from a specific backup. You can determine which tags were assigned to the backups by you or by the system, the completion date and time of the backups, and other information about backups saying
`RMAN> list backup;
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
78 Full 300.26M DISK 00:01:40 10-APR-13 05:10:32
BP Key: 78 Status: AVAILABLE Compressed: YES Tag: TAG20130410T050852
Piece Name: /u01/app/oracle/fast_recovery_area/OCAEXAM/backupset/2013_04_10/o1_mf_nnndf_TAG20130410T050852_8pbc14yv_.bkp
List of Datafiles in backup set 78
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------ ----
1 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/system01.dbf
2 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/sysaux01.dbf
3 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/undotbs01.dbf
4 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/users01.dbf
5 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/example01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
79 Full 9.39M DISK 00:00:02 10-APR-13 05:10:39
BP Key: 79 Status: AVAILABLE Compressed: NO Tag: TAG20130410T051037
Piece Name: /u01/app/oracle/fast_recovery_area/OCAEXAM/autobackup/2013_04_10/812350360_8pbk.bkp
SPFILE Included: Modification time: 10-APR-13 04:55:39
SPFILE db_unique_name: OCAEXAM
Control File Included: Ckp SCN: 3985848 Ckp time: 10-APR-13 04:52:40
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
80 Full 300.30M DISK 00:01:39 10-APR-13 05:18:03
BP Key: 80 Status: AVAILABLE Compressed: YES Tag: DELETE_ME
Piece Name: /u01/app/oracle/fast_recovery_area/OCAEXAM/backupset/2013_04_10/o1_mf_nnndf_DELETE_ME_8pbch94j_.bkp
List of Datafiles in backup set 80
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------ ----
1 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/system01.dbf
2 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/sysaux01.dbf
3 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/undotbs01.dbf
4 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/users01.dbf
5 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/example01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
81 Full 9.39M DISK 00:00:01 10-APR-13 05:18:11
BP Key: 81 Status: AVAI
restore database from tag 'INTERESTING_TAG';DISCLAIMER
The solution provided here is based solely on my own experience, you use it on your own risk. I'm not liable for any damages (including data loss) caused by using this solution.
Also, do I always need to restore spfile and control file because I
did not create some additional backups (just ran command
backup
database)?By default RMAN is configured to automatically back up control file and spfile after every successful backup and on every database structural change (for example, adding datafiles) which causes these changes to be reflected in control files. Thus after every successful database backup with
backup database, the spfile and control file will be automatically backed up.You can determine if autobackup is enabled by issuing
show controlfile autobackup; in RMAN, and enable it saying configure controlfile autobackup on; in RMAN.Since you supplied the paths to the backup sets you want to restore your database from, I assume that you obtained them from your current control file using RMAN. It won't hurt to save this information and other information about your existing backups to a plain text file because you will restore one of the previous control files and chances are this information will be lost:
[oracle@oca ~]$ export NLS_DATE_FORMAT='DD-MON-YY HH24:MI:SS'
[oracle@oca ~]$ rman target=/ log 'list_backup.txt'
RMAN> list backup;
RMAN> exit;
You'll need to restore your database AND control file(s), because the database datafile headers of every datafile should be in sync with control file(s), i. e. they should have the same System Change Number (SCN).
As I already said, you just need to supply the tag name to restore the database from a specific backup. You can determine which tags were assigned to the backups by you or by the system, the completion date and time of the backups, and other information about backups saying
list backup in RMAN (we already saved this info to the text file). Here's the output of list backup in my sample installation:`RMAN> list backup;
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
78 Full 300.26M DISK 00:01:40 10-APR-13 05:10:32
BP Key: 78 Status: AVAILABLE Compressed: YES Tag: TAG20130410T050852
Piece Name: /u01/app/oracle/fast_recovery_area/OCAEXAM/backupset/2013_04_10/o1_mf_nnndf_TAG20130410T050852_8pbc14yv_.bkp
List of Datafiles in backup set 78
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------ ----
1 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/system01.dbf
2 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/sysaux01.dbf
3 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/undotbs01.dbf
4 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/users01.dbf
5 Full 3985848 10-APR-13 04:52:40 /u01/app/oracle/oradata/ocaexam/example01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
79 Full 9.39M DISK 00:00:02 10-APR-13 05:10:39
BP Key: 79 Status: AVAILABLE Compressed: NO Tag: TAG20130410T051037
Piece Name: /u01/app/oracle/fast_recovery_area/OCAEXAM/autobackup/2013_04_10/812350360_8pbk.bkp
SPFILE Included: Modification time: 10-APR-13 04:55:39
SPFILE db_unique_name: OCAEXAM
Control File Included: Ckp SCN: 3985848 Ckp time: 10-APR-13 04:52:40
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
80 Full 300.30M DISK 00:01:39 10-APR-13 05:18:03
BP Key: 80 Status: AVAILABLE Compressed: YES Tag: DELETE_ME
Piece Name: /u01/app/oracle/fast_recovery_area/OCAEXAM/backupset/2013_04_10/o1_mf_nnndf_DELETE_ME_8pbch94j_.bkp
List of Datafiles in backup set 80
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------ ----
1 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/system01.dbf
2 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/sysaux01.dbf
3 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/undotbs01.dbf
4 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/users01.dbf
5 Full 3986589 10-APR-13 05:12:33 /u01/app/oracle/oradata/ocaexam/example01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
81 Full 9.39M DISK 00:00:01 10-APR-13 05:18:11
BP Key: 81 Status: AVAI
Code Snippets
RMAN> sql 'alter database open resetlogs';Context
StackExchange Database Administrators Q#39475, answer score: 5
Revisions (0)
No revisions yet.