Oracle Learning Rman (14) Resume combat-based on point-in-time recovery

Source: Internet
Author: User

1. Let's start with a fully prepared

rman> backup database ; starting backup at 2015/07/09 13:40:47allocated channel: ora_disk_1channel  ora_disk_1: sid=28 device type=diskchannel ora_disk_1: starting full  Datafile backup setchannel ora_disk_1: specifying datafile (s)  in backup  setinput datafile file number=00001 name=/u01/app/oracle/oradata/devdb/ system01.dbfinput datafile file number=00002 name=/u01/app/oracle/oradata/devdb/ sysaux01.dbfinput datafile file number=00005 name=/u01/app/oracle/oradata/devdb/ example01.dbfinput datafile file number=00003 name=/u01/app/oracle/oradata/devdb/ undotbs01.dbfinput datafile file number=00004 name=/u01/app/oracle/oradata/devdb/ users01.dbfchannel ora_disk_1: starting piece 1 at 2015/07/09  13:40:48channel ora_disk_1: finisHed piece 1 at 2015/07/09 13:42:34piece handle=/u01/app/oracle/fast_recovery_ area/devdb/backupset/2015_07_09/o1_mf_nnndf_tag20150709t134048_bsw2c0xq_.bkp tag=tag20150709t134048  comment=nonechannel ora_disk_1: backup set complete, elapsed time:  00:01:46channel ora_disk_1: starting full datafile backup setchannel ora_ Disk_1: specifying datafile (s)  in backup setincluding current control  file in backup setincluding current spfile in backup setchannel  Ora_disk_1: starting piece 1 at 2015/07/09 13:42:35channel ora_disk_1:  finished piece 1 at 2015/07/09 13:42:36piece handle=/u01/app/oracle/fast_ recovery_area/devdb/backupset/2015_07_09/o1_mf_ncsnf_tag20150709t134048_bsw2gcly_.bkp tag= Tag20150709t134048 comment=nonechannel&nBsp;ora_disk_1: backup set complete, elapsed time: 00:00:01finished backup  at 2015/07/09 13:42:36

2. Create a table and insert some data into it. Record the time, wait for a while and then truncate the table.

sql> alter user Scott account unlock; User altered. Sql> alter user Scott identified by Tiger; User altered. Sql> Conn scott/tigerconnected.sql> Select sysdate from dual; Sysdate-------------------2015/07/09 13:44:30sql> CREATE table t1 as select * from EMP; Table created. Sql> select Sysdate from dual; Sysdate-------------------2015/07/09 13:45:32sql> truncate table t1; Table truncated.

Prior to 2015/07/09 13:45:32, there were 14 data in table T1. Then did the truncate. Let's see if we can restore the database to 2015/07/09 13:45:32 this moment. That is, before T1 was truncate off.

3. Close the database and boot to mount state

Sql> conn/as sysdbaconnected.sql> shutdown immediatedatabase closed. Database dismounted. ORACLE instance shut down. Sql> Startup Mount;oracle instance started. Total System Global area 839282688 bytesfixed size 2233000 bytesvariable size 494931288 bytesdatabase buffers 339738 624 Bytesredo buffers 2379776 bytesdatabase mounted.


4. Recovering a Database

Rman> run {  allocate channel c1 type disk;  allocate  CHANNEL c2 TYPE DISK;  SET UNTIL TIME =  ' 2015/07/09  13:45:32 ';   restore database;  recover database;  alter database  OPEN RESETLOGS; }2> 3> 4> 5> 6> 7> 8>  using target database control file instead of recovery  catalogallocated channel: c1channel c1: sid=20 device type=diskallocated  channel: c2channel c2: sid=21 device type=diskexecuting command: set  Until clausestarting restore at 2015/07/09 13:50:59channel c1: starting  datafile backup set restorechannel c1: specifying datafile (s)  to  restore from backup setchannel c1: restoring datafile 00001 to /u01/app/oracle/oradata/devdb/ system01.dbfchannel c1: restoring datafile 00002 to /u01/app/oracle/oradata/ devdb/sysaux01.dbfchannel c1: restoring datafile 00003 to /u01/app/oracle/ oradata/devdb/undotbs01.dbfchannel c1: restoring datafile 00004 to /u01/app/ Oracle/oradata/devdb/users01.dbfchannel c1: restoring datafile 00005 to /u01/app /oracle/oradata/devdb/example01.dbfchannel c1: reading from backup piece /u01/ App/oracle/fast_recovery_area/devdb/backupset/2015_07_09/o1_mf_nnndf_tag20150709t134048_bsw2c0xq_.bkpchannel  c1: piece handle=/u01/app/oracle/fast_recovery_area/devdb/backupset/2015_07_09/o1_mf_nnndf_ tag20150709t134048_bsw2c0xq_.bkp tag=tag20150709t134048channel c1: restored backup  Piece 1channel c1: restore complete, elapsed time: 00:01:15finished restore at 2015/07/09  13:52:14starting recover at 2015/07/09 13:52:15starting media recoverymedia  recovery complete, elapsed time: 00:00:01finished recover at 2015/07/ 09 13:52:16database openedreleased channel: c1released channel: c2


5. Verify that the data is present.

Sql> Conn Scott/tiger connected.sql> Select COUNT (*) from T1; COUNT (*)----------14sql>

The visible data has been recovered.

Point-in-time recovery is a kind of incomplete recovery, and we can also recover based on SCN and log sequence.

UNTIL SEQUENCE or UNTIL SCN


This article is from the "Ding Dong" blog, please be sure to keep this source http://lqding.blog.51cto.com/9123978/1680877

Oracle Learning Rman (14) Resume combat-based on point-in-time recovery

Related Article

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.