Backup:
Db_fullbak_jssbook.bat
Name = "code" class = "SQL"> SET Oracle_SID = jssbook
Rman target/LOG = c: \ ORACLE \ SCRIPT \ BACKUP \ LOGS \ BAK _ % DATE :~ 0, 10%. LOG
Export File = c: \ ORACLE \ SCRIPT \ BACKUP \ DB_FULLBAK_JSSBOOK.RMAN
Db_fullbak_jssbook.rman
[Plain]
- RUN {
- Configure retention policy to recovery window of 14 DAYS;
- Configure controlfile autobackup on;
- Configure controlfile autobackup format for device type disk to 'C: \ ORACLE \ BACKUP \ % F ';
- Allocate channel C1 device type disk format 'C: \ ORACLE \ BACKUP \ BAK _ % U ';
- BACKUP DATABASE SKIP INACCESSIBLE
- Plus archivelog filesperset 20
- Delete all input;
- Release channel C1;
- }
- Allocate channel for maintenance device type disk;
- Crosscheck backupset;
- Delete noprompt obsolete;
Construct Data:
...
Simulated loss:
...
Reboot error:
[SQL]
- SQL> startup
- The ORACLE routine has been started.
- Total SystemGlobalArea 612368384 bytes
- FixedSize1250428 bytes
- VariableSize192940932 bytes
- DatabaseBuffers 411041792 bytes
- Redo Buffers 7135232 bytes
- The database has been loaded.
- ORA-01157: unable to identify/lock data file 4-see DBWR trace file
- ORA-01110: data file 4:'C: \ ORACLE \ ORADATA \ JSSOOK \ JSSBOOK \ users01.dbf'
Fix:
[SQL]
- C: \ oracle \ script>SetOracle_sid = jssbook
- C: \ oracle \ script> rman target/
- Recovery MANAGER: Release 10.2.0.1.0-ProductionOnWednesday, September 16, February 1 22:37:06, 2012
- Copyright (c) 1982,200 5, Oracle.AllRights reserved.
- Connected to the target database: JSSBOOK (DBID = 1507698744, not enabled)
- RMAN> restore datafile 4
- 2>;
- Start restore from to 12
- Use the target database control file to replace the recovery directory
- Allocated channel: ORA_DISK_1
- Channel ORA_DISK_1: sid = 156 devtype = DISK
- Channel ORA_DISK_1: Recovering data file backup set
- Channel ORA_DISK_1: Specifies the data file to be recovered from the backup set.
- Restoring data file 00004 to C: \ ORACLE \ ORADATA \ JSSOOK \ JSSBOOK \ USERS01.DBF
- Channel ORA_DISK_1: Reading the BACKUP section C: \ ORACLE \ BACKUP \ BAK_0FN28OQ1_1_1
- Channel ORA_DISK_1: recovered backup segment 1
- Segment handle = C: \ ORACLE \ BACKUP \ BAK_0FN28OQ1_1_1 mark = TAG20120201T215721
- Channel ORA_DISK_1: Recovery completed, time: 00:00:36
- The restore is completed from month 1 to Month 12.
Recovery:
[SQL]
- RMAN> restore datafile 4
- 2>;
- Start restore from to 12
- Use the target database control file to replace the recovery directory
- Allocated channel: ORA_DISK_1
- Channel ORA_DISK_1: sid = 156 devtype = DISK
- Channel ORA_DISK_1: Recovering data file backup set
- Channel ORA_DISK_1: Specifies the data file to be recovered from the backup set.
- Restoring data file 00004 to C: \ ORACLE \ ORADATA \ JSSOOK \ JSSBOOK \ USERS01.DBF
- Channel ORA_DISK_1: Reading the BACKUP section C: \ ORACLE \ BACKUP \ BAK_0FN28OQ1_1_1
- Channel ORA_DISK_1: recovered backup segment 1
- Segment handle = C: \ ORACLE \ BACKUP \ BAK_0FN28OQ1_1_1 mark = TAG20120201T215721
- Channel ORA_DISK_1: Recovery completed, time: 00:00:36
- The restore is completed from month 1 to Month 12.
- RMAN> recover datafile 4
- 2>;
- Start recover from month 1 to Month 12
- Use channel ORA_DISK_1
- Restoring media...
- Media Recovery completed. Time: 00:00:02
- The recover is completed from month 1 to Month 12.
Verification:
[SQL]
- RMAN>Alter Database Open
- 2>;
- Database opened
- RMAN> host;
- Microsoft Windows XP [version 5.1.2600]
- (C) Copyright 1985-2001 Microsoft Corp.
- C: \ oracle \ script> sqlplus scott/tiger
- SQL * Plus: Release 10.2.0.1.0-ProductionOnWednesday, September 16, February 1 22:39:49, 2012
- Copyright (c) 1982,200 5, Oracle.AllRights reserved.
- Connect:
- OracleDatabase10g Enterprise Edition Release 10.2.0.1.0-Production
- WithThe Partitioning, OLAPAndData Mining options
- SQL>Select*FromTemp1;
- NAME
- --------------------
- Test1
- Test2
- Test3
- SQL>