Restore database using rman-backup control file

Source: Internet
Author: User
From the above recovery process, we can see that all logs are applied, including online logs, archived logs to sequence9, but sequence is restored to 10. 10 as the current log. 8,

From the above recovery process, we can see that all logs are applied, including online logs, archived logs to sequence9, but sequence is restored to 10. 10 as the current log. 8,

1. Full database backup
RMAN> run {
Allocate channel c1 type disk maxpiecesize = 500 m;
Backup current controlfile format '+ dgasm/backup/ctl _ % d _ % s ';
Backup full database format' + dgasm/backup/db _ % d _ % s _ % p _ % T ';
SQL 'alter system archive log current ';
Release channel c1;
} 2> 3> 4> 5> 6> 7>
Using target database control file instead of recovery catalog
Allocated channel: c1
Channel c1: SID = 37 device type = DISK
Starting backup at 30-JUN-12
Channel c1: starting full datafile backup set
Channel c1: specifying datafile (s) in backup set
Including current control file in backup set
Channel c1: starting piece 1 at 30-JUN-12
Channel c1: finished piece 1 at 30-JUN-12
Piece handle = + DGASM/backup/ctl_ora11_37 tag = TAG20120630T094535 comment = NONE
Channel c1: backup set complete, elapsed time: 00:00:04
Finished backup at 30-JUN-12
Starting backup at 30-JUN-12
Channel c1: starting full datafile backup set
Channel c1: specifying datafile (s) in backup set
Input datafile file number = 00001 name = + DGASM/ora11/datafile/system.257.785186755
Input datafile file number = 00002 name = + DGASM/ora11/datafile/sysaux.258.785186845
Input datafile file number = 00003 name = + DGASM/ora11/datafile/undotbs1.259.785186901
Input datafile file number = 00004 name = + DGASM/ora11/datafile/users.272.787009469
Channel c1: starting piece 1 at 30-JUN-12
Channel c1: finished piece 1 at 30-JUN-12
Piece handle = + DGASM/backup/db_ora11_38_2017787311941 tag = TAG20120630T094541 comment = NONE
Channel c1: starting piece 2 at 30-JUN-12
Channel c1: finished piece 2 at 30-JUN-12
Piece handle = + DGASM/backup/db_ora11_38_2_787311941 tag = TAG20120630T094541 comment = NONE
Channel c1: backup set complete, elapsed time: 00:01:00
Channel c1: starting full datafile backup set
Channel c1: specifying datafile (s) in backup set
Including current control file in backup set
Including current SPFILE in backup set
Channel c1: starting piece 1 at 30-JUN-12
Channel c1: finished piece 1 at 30-JUN-12
Piece handle = + DGASM/backup/db_ora11_39_109787312002 tag = TAG20120630T094541 comment = NONE
Channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 30-JUN-12
SQL statement: alter system archive log current
Released channel: c1
RMAN>
2. perform operations
Create a haozg user and then create a table
SQL> create table haozg_hist as select * from v $ loghist;
Table created.
SQL> alter system switch logfile;
System altered.
SQL>/
System altered.
SQL>/
System altered.
SQL>/
System altered.
SQL>
SQL> create table test (id number, name varchar2 (13 ));
Table created.
SQL> insert into test select object_id, object_name from dba_objects where rownum = 1;
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL>/
System altered.
SQL>/
System altered.
3. Shut down the database, delete the control file, and simulate the bad control file.
Operate Under the grid user
ASMCMD> cd controlfile
ASMCMD> ls
Current.260.787304065
ASMCMD> rm-f *
4. Start the database to the nomount status.

5. Dump control files from backup set
RMAN> restore controlfile from '+ dgasm/backup/ctl_ora11_37 ';
Starting restore at 30-JUN-12
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 26 device type = DISK
Channel ORA_DISK_1: restoring control file
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Output file name = + DGASM/controlfile/control01.ctl
Finished restore at 30-JUN-12
RMAN>
6. Start the database to the mount status.
7. Restore the database
RMAN> recover database;
Starting recover at 30-JUN-12
Released channel: ORA_DISK_1
Starting implicit crosscheck backup at 30-JUN-12
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 26 device type = DISK
Crosschecked 19 objects
Finished implicit crosscheck backup at 30-JUN-12
Starting implicit crosscheck copy at 30-JUN-12
Using channel ORA_DISK_1
Crosschecked 8 objects
Finished implicit crosscheck copy at 30-JUN-12
Searching for all files in the recovery area
Cataloging files...
No files cataloged
Using channel ORA_DISK_1
RMAN-06900: WARNING: unable to generate V $ RMAN_STATUS or V $ RMAN_OUTPUT row
RMAN-06901: WARNING: disabling update of the V $ RMAN_STATUS and V $ RMAN_OUTPUT rows
Oracle error from target database:
ORA-19922: there is no parent row with id 0 and level 1

Starting media recovery
Archived log for thread 1 with sequence 8 is already on disk as file + DGASM/ora11/onlinelog/group_2.264.785192615
Archived log for thread 1 with sequence 9 is already on disk as file + DGASM/ora11/onlinelog/group_3.265.785192859
Archived log for thread 1 with sequence 10 is already on disk as file + DGASM/ora11/onlinelog/group_1.263.785192081
Archived log file name =/oracle/archivelog/1_1_787309225.dbf thread = 1 sequence = 1
Archived log file name =/oracle/archivelog/1_2_787309225.dbf thread = 1 sequence = 2
Archived log file name =/oracle/archivelog/1_3_787309225.dbf thread = 1 sequence = 3
Archived log file name =/oracle/archivelog/ipv4_787309225.dbf thread = 1 sequence = 4
Archived log file name =/oracle/archivelog/4245_787309225.dbf thread = 1 sequence = 5
Archived log file name =/oracle/archivelog/ipv6_787309225.dbf thread = 1 sequence = 6
Archived log file name =/oracle/archivelog/1_7_787309225.dbf thread = 1 sequence = 7
Archived log file name = + DGASM/ora11/onlinelog/group_2.264.785192615 thread = 1 sequence = 8
Archived log file name = + DGASM/ora11/onlinelog/group_3.265.785192859 thread = 1 sequence = 9
Archived log file name = + DGASM/ora11/onlinelog/group_1.263.785192081 thread = 1 sequence = 10
Media recovery complete, elapsed time: 00:00:02
Finished recover at 30-JUN-12
RMAN>
From the above recovery process, we can see that all logs are applied, including online logs, archived logs to sequence9, but sequence is restored to 10.
10 as the current log.
8. Open the database in resetlogs Mode
9. Check the existence of user and table data.
Summary: rman automatically uses datafile as the benchmark to apply all archived log files, including online log files, and incomplete recovery is completed. Oracle does not know the recovery end point, how many logs are there, how many logs are applied, and when logs exist, data is not lost. Dba is not involved in this process.
The content in v $ log comes from the control file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.