Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

RMAN of Oracle Learning (14) recovery in actual combat-- based on point-in-time recovery

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Let's do a complete set first.

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: backupset 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 ORA_DISK_1: backupset complete Elapsed time: 00:00:01Finished backup at 2015-07-09 13:42:36

two。 Create a table and insert some data into it. Record the time and wait for a while before you 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 crystal table truncated.

Before 13:45:32 on 2015-07-09, there were 14 pieces of data in table T1. And then I did truncate. Let's now see if we can restore the database to 13:45:32 on 2015-07-09. That is, before T1 was dropped by truncate.

3. Shut down the database and then boot to the 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 339738624 bytesRedo Buffers 2379776 bytesDatabase mounted.

4. Restore the database

RMAN > RUN {ALLOCATE CHANNEL C1 TYPE DISK; ALLOCATE CHANNEL c2 TYPE DISK; SET UNTIL TIME = '2015-07-09 1315 4515 RMAN 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 exists.

SQL > conn scott/tiger Connected.SQL > select count (*) from T1; COUNT (*)-14SQL >

It can be seen that the data has been recovered.

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

UNTIL SEQUENCE or UNTIL SCN

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report