041225

xiaoxiao2021-03-06  36

Database RMAN Target / Rman> Startup MountRman> RESTORE DATABASE; RMAN> RECOVER DATABASE; RMAN> ALTABASE OPEN RESETLOGS;

RMAN Target / RMan> Startup MountRman> Restore Database; Rman> ALTABASE OPEN

Use the RMAN recovery file to a new location Use the set newname command to recover files to new location set newname for datafile 1 to '/

Use the switch command to record changes in the control file Switch DataFile All;

Restoring Datafiles to a New LocationIf you have experienced media failure such as the loss of a disk drive, you may need torestore the datafiles to a new location.Example1. Connect to RMAN. Rman target 2. Mount the database. RMAN> STARTUP MOUNT3. Use RMAN to restore the datafile to the new location and record the change in the control file run {set newname for datafile 1 to /system01.dbf ... restore database;.?? switch datafile all; recover database; alter Database open;

Recovery tablespace Using RMAN to Recover a TablespaceIf you have determined that you need to restore and recover the users tablespace, issue the RMAN commands as follows: run {sql 'alter tablespace users offline immediate' restore tablespace users; recover tablespace users; sql ' Alter TableSpace Uses Online '}

There Are Three Types of Incomplete Recovery: Time-Based RecoveryCancel-based RecoveryChange-Based Recovery

RECOVER Command Overview1.Recover a database until cancel: RECOVER DATABASE until cancel2.Recover a database until time: RECOVER DATABASE until time '2002-07-24: 14: 22: 03'3.Recover using backup control file: RECOVER DATABASE until time '2002-07-24: 14: 22: 03'using backup controlfile

Use the Using Backup ControlFile clause, then be sure to use the Until statement

Incomplete Recovery Using UNTIL TIMEShut down the database and begin recovery Because the approximate time of the failure is known and the database structure has not changed since 11:44 am, you can use the UNTIL TIME method:.. 1 If the database is open, shut it down by using either the NORMAL, IMMEDIATE, or TRANSACTIONAL options.2. Restore all datafiles from backup (the most recent if possible). You may need to restore archived logs. If there is enough space available, restore to the LOG_ARCHIVE_DEST location or use the ALTER SYSTEM ARCHIVE LOG START tO or SET LOGSOURCE to change the location.3 Mount the database.Incomplete Recovery Using UNTIL TIME (continued) 4 Recover the database:.. SQL> recover database until time ' 2002-03-09: 11: 44: 00 'ORA-00279: Change 148448 ... 03/09/02 17:04:20 Needed for thread ora-00289: suggestion: / disk1 / archive / arch_6 .rdo ora-00280: Change 148448 for thread 1 is in sequence # 6 log applied .... Media Recovery Complete.5. To Synchroniz e datafiles with control files and redo logs, open the database by using the RESETLOGS option: SQL> alter database open resetlogs; SQL> archive log list ... Oldest online log sequence 0 Next log sequence to archive 1 Current log sequence 1 6. Before performing the whole closed database backup, query the EMPLOYEES table to make sure it exists. When recovery is successful and the backup has completed, notify users that the database isavailable for use, and any data entered after the recovery time (11:44 am Will Need to be reentered.

. Incomplete Recovery Using UNTIL CANCELYou are concerned about block corruption in the EMPLOYEES table resulting from disk error Because redo logs are contained on the same disk, you decide to check the status of redo logs and archived logs: SQL> SELECT * FROM v $ logfile ; Group # status member ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- 2 /disk1/data/log2a.rdo 1 /disk1/data/log1a.rdosql> Select * from v $ log; g # ... seq # bytes members arc status ... first_time - ... ---- ------ ---------------- ... -------------- 1 ... 49 153600 1 no current ... 02-03-09: 11: 55 2 ... 48 153600 1 no inactive ... 02-03-09: 11: 34INCOMPLETE Recovery Using Until Cancel (Continued) After Searching Through the / disk1 / data directory, you notice tria red, you, you can, you cannot Recover p Ast this point. Querying V $ log_history confirms the Absence of Archived log seq 48 (log2a.rdo): SQL> SELECT * FROM V $ log_history; recid stamp ... first_change first_time ----------- - ... ------------ ---------- 1 318531466 ... 88330 02-02-28: 12: 43 47 319512880 ... 309067 02- 03-09: 11: 26Because this is an OLTP system, the output from V $ LOG shows that an extra 10 minutes of work will be lost if the database is recovered before applying log2a.rdo Users are not happy about losing work, but. Can Recover That Work. You Can Recover The Database As Follows: 1. Shut Down The Database.2. RESTORE All DataFiles from The Most Recent Backup.3. You ALREADY HAVE A VALID Backup, SO Mount The DataBase.

转载请注明原文地址:https://www.9cbs.com/read-76452.html

New Post(0)