Recover database after disk loss (Doc ID 230829.1)
Recover database after disk loss (Doc ID 230829.1)
***Checked for relevance on 16-Apr-2014*** PURPOSE ------- This article aims at walking you through some of the common recovery techniques after a disk failure SCOPE & APPLICATION ------------------- All Oracle support Analysts, DBAs and Consultants who have a role to play in recovering an Oracle database Loss due to Disk Failure ------------------------ What can we lose due to disk failure: A) Control files B) Redo log files C) Archivelog files D) Datafiles E) Parameter file or SPFILE F) Oracle software installation Detecting disk failure ----------------------- 1) Run copy utilities like "dd" on unix 2) If using RAID mechanisms like RAID 5, parity information may mask the disk failure and more vigorous check would be needed 3) As always, check the Operating system log files 4) Another obvious case would be when the disk could not be seen or mounted by the OS. 5) On the Oracle side, run dbv if the file affected is a datafile 6) The best way to detect disk failure is by running Hardware diagnostic tools and OS specific disk utilities. Next Action ------------ Once the type of failure is identified, the next step is to rectify them. Options could be: (1) Replace the corrupted disk with a new one and mount them with the same name (say /oracle or D:\) (2) Replace the corrupted disk with a new one and mount them with a different name (say /oracle1 as the new mount point) (3) Decide to use another existing disk mounted with a different name (say /oracle2) The most common methods are (1) AND (3). Oracle Recovery --------------- Once the disk problem is sorted, the next step is to perform recovery at the Oracle level. This would depend on the type of files that is lost (see "Loss due to Disk Failure" section) and also on the type of disk recovery done as mentioned in the "Next Action" section above. (A) Control Files ------------------ Normally, we have multiplexing of controlfiles and they are expected to be placed in different disks. If one or more controlfile is/are lost,mount will fail as shown below: SQL> startup Oracle Instance started .... ORA-00205: error in identifying controlfile, check alert log for more info You can verify the controlfile copies using: SQL> select * from v$controlfile; **If atleast one copy of the controlfile is not affected by the disk failure, When the database is shutdown cleanly: (a) Copy a good copy of the controlfile to the missing location (b) Start the database Alternatively, remove the lost control file location specified in the init parameter control_files and start the database. **If all copies of the controlfile are lost due to the disk failure, then: Check for a backup controlfile. Backup controlfile is normally taken using either of the following commands: (a) SQL> alter database backup controlfile to '/backup/control.ctl'; -- This would have created a binary backup of the current controlfile -- -->If the backup was done in binary format as mentioned above, restore the file to the lost controlfile locations using OS copying utilities. --> SQL> startup mount; --> SQL> recover database using backup controlfile; --> SQL> alter database open; (b) SQL> alter database backup controlfile to trace; -- This would have created a readable trace file containing create controlfile script -- --> Edit the trace file created (check user_dump_dest for the location) and retain the SQL commands alone. Save this to a file say cr_ctrl.sql --> Run the script SQL> @cr_ctrl This would create the controlfile, recover database and open the database. ** If no copy of the controlfile or backup is available, then create a controlfile creation script using the datafile and redo log file information. Ensure that the file names are listed in the correct order as in FILE$. Then the steps would be similar to the one followed with cr_ctrl.sql script. Note that all controlfile related SQL maintenance operations are done in the database nomount state (B) Redo logs --------- In normal cases, we would not have backups of online redo log files. But the inactive logfile changes could already have been checkpointed on the datafiles and even archive log files may be available. SQL> startup mount Oracle Instance Started Database mounted ORA-00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: '/ORACLE/ORADATA/H817/REDO01.LOG' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) The system cannot find the file specified. ** Verify if the lost redolog file is Current or not. SQL> select * from v$log; SQL> select * from v$logfile; --> If the lost redo log is an Inactive logfile, you can clear the logfile: SQL> alter database clear logfile '/ORACLE/ORADATA/H817/REDO01.LOG'; Alternatively, you can drop the logfile if you have atleast two other logfiles: SQL> alter database drop logfile group 1; --> If the logfile is the Current logfile, then do the following: SQL> recover database until cancel; Type Cancel when prompted SQL>alter database open resetlogs; The 'recover database until cancel' command can fail with the following errors: ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below ORA-01194: file 1 needs more recovery to be consistent ORA-01110: data file 1: '/ORACLE/ORADATA/H817/SYSTEM01.DBF' In this case , restore an old backup of the database files and apply the archive logs to perform incomplete recovery. --> restore old backup SQL> startup mount SQL> recover database until cancel using backup controlfile; SQL> alter database open resetlogs; If the database is in noarchivelog mode and if ORA-1547, ORA-1194 and ORA-1110 errors occur, then you would have restore from an old backup and start the database. Note that all redo log maintenance operations are done in the database mount state (C) Archive logs ----------------- If the previous archive log files alone have been lost, then there is not much to panic. ** Backup the current database files using hot or cold backup which would ensure that you would not need the missing archive logs (D) Datafiles -------------- This obviously is the biggest loss. (1) If only a few sectors are damaged, then you would get ora-1578 when accessing those blocks. --> Identify the object name and type whose block is corrupted by querying dba_extents --> Based on the object type, perform appropriate recovery --> Check metalink Note:28814.1 for resolving this error (2) If the entire disk is lost, then one or more datafiles may need to be recovered . SQL> startup ORACLE instance started. ... Database mounted. ORA-01157: cannot identify/lock data file 3 - see DBWR trace file ORA-01110: data file 3: '/ORACLE/ORADATA/H817/USERS01.DBF' Other possible errors are ORA-00376 and ORA-1113 The views and queries to identify the datafiles would be: SQL> select file#,name,status from v$datafile; SQL> select file#,online,error from v$recover_file; ** If restoring to a replaced disk mounted with the same name, then : (1) Restore the affected datafile(s) using OS copy/restore commands from the previous backup (2) Perform recovery based on the type of datafile affected namely SYSTEM, ROLLBACK or UNDO, TEMP , DATA or INDEX. (3) The recover commands could be 'recover database', 'recover tablespace' or 'recover datafile' based on the loss and the database state ** If restoring to a different mount point, then : (1) Restore the files to the new location from a previous backup (2) SQL> STARTUP MOUNT (3) SQL> alter database rename file '/old path_name' to 'new path_name'; -- Do this renaming for all datafiles affected. -- (4) Perform recovery based on the type of datafile affected namely SYSTEM, ROLLBACK or UNDO, TEMP , DATA or INDEX. (5) The recover commands could be 'recover database', 'recover tablespace' or 'recover datafile' based on the loss and the database state The detailed steps of recovery based on the datafile lost and the Oracle error are outlined in the articles referenced at the end of this note. NOARCHIVELOG DATABASE ===================== The loss mentioned in (A),(B) and (D) would be different in this case wherever archive logs are involved. We will discuss the datafile loss scenarios here: (a) If the datafile lost is a SYSTEM datafile, restore the complete database from the previous backup and start the database. (b) If the datafile lost is Rollback related datafile with active transactions, restore from the previous backup and start the database. (c) If the datafile contains rollback with no active rollback segments, you can offline the datafile (after commenting the rollback_segments parameter assuming that they are private rollback segments) and open the database. (d) If the datafile is temporary, offline the datafile and open the database. Drop the tablespace and recreate the tablespace. (e) If the datafile is DATA or INDEX, **Offline the tablespace and start the database. **If you have a previous backup, restore it to a separate location. **Then export the objects in the affected tablespace ( using User or table level export). **Create the tablespace in the original database. **Import the objects exported above. If the database is 8i or above, you can also use Transportable tablespace feature. (E) Parameter file --------------- This is not a major loss and can be easily restored. Options are: (1) If there is a backup, restore the file (2) If there is no backup, copy sample file or create a new file and add the required parameters. Ensure that the parameters db_name, control_files, db_block_size, compatible are set correctly (3) If the spfile is lost, you can create it from the init parameter file if it is available (F) Oracle Software Installation ---------------------------- There are two ways to recover from this scenario: (1) If there is a backup of the Oracle home and Oracle Inventory, restore them to the respective directories. Note if you change the Oracle Home, the inventory would not be aware of thid new path and you would not be able to apply patchsets. Also restore to the same OS user and group. (2) Perform a fresh Install, bringing it to the same patchset level PRACTICAL SCENARIO ================== In most cases, when a disk is lost, more than one type of file could be lost. The recovery in this scenario would be: (1) A combination of each of these data loss recovery scenarios (2) Perform entire database restore from the more recent backup and apply archive logs to perform recovery. This is a highly preferred method but could be time consuming.
References
NOTE:184327.1 - ORA-1157 Troubleshooting
NOTE:198640.1 - How to Recover from a Lost or Deleted Datafile with Different Scenarios
NOTE:183327.1 - Common Causes and Solutions on ORA-376 Error Found in Backup & Recovery
NOTE:183367.1 - Common Causes and Solutions on ORA-1113 Error Found in Backup & Recovery
NOTE:117481.1 - Loss Of Online Redo Log And ORA-312 And ORA-313
|
|
- Oracle Database Products > Oracle Database Suite > Oracle Database > Oracle Database - Enterprise Edition > RDBMS > Backup/Recovery excludes RMAN and EBU
- Enterprise Management > Enterprise Manager Products > Managing Databases using Enterprise Manager > Enterprise Manager for Oracle Database
- Oracle Database Products > Oracle Database Suite > Oracle Database > Oracle Database - Standard Edition > Generic RDBMS > Backup/Recovery excludes RMAN and EBU
- Oracle Database Products > Oracle Database Suite > Oracle Database > Oracle Database - Personal Edition > RDBMS > Backup/Recovery excludes RMAN and EBU
|
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-1160649/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Recover physical standby database after loss of archive log(2)DatabaseHive
- Recover physical standby database after loss of archive log – roll forward(轉)DatabaseHiveForward
- Recover a Database Having Added a Datafile Since Last Backup (Doc ID 29430.1)DatabaseAST
- move linux os from disk A to disk B with 0 lossLinux
- recover database until cancel和 recover database區別Database
- Recover A Lost Datafile With No Backup (Doc ID 1060605.6)
- Recover_DatabaseDatabase
- rman recover databaseDatabase
- OHASD not Starting After Reboot on SLES (Doc ID 1325718.1)boot
- recover database until timeDatabase
- Master Note for Oracle Disk Manager (Doc ID 1226653.1)ASTOracle
- Open Resetlogs After Restore Hangs (Doc ID 1455666.1)REST
- 冷備手工完全恢復(recover database,recover tablespace,recover datafile)Database
- recover database using backup controlfile與 recover database 的區別Database
- * Master Note: Database Performance Overview (Doc ID 402983.1)ASTDatabaseORMView
- Troubleshooting Database Hang Issues (Doc ID 1378583.1)Database
- How to Duplicate a Database in NOARCHIVELOG mode (Doc ID 275480.1)DatabaseHive
- Oracle10G RMAN Database Duplication (Doc ID 259694.1)OracleDatabase
- How To Size the Database Smart Flash Cache (Doc ID 1317950.1)Database
- How to restore ASM based OCR after complete loss of the CRS diskgroupRESTASM
- Recover Database Fails with RMAN-06558 [ID 1185074.1]DatabaseAI
- Performing duplicate database with ASM/OMF/RMAN (Doc ID 340848.1)ORMDatabaseASM
- How To List All The Named Events Set For A Database (Doc ID 436036.1)Database
- Information On Installed Database Components and Schemas (Doc ID 472937.1)ORMDatabase
- Can Tapes Be Used For RMAN Convert Database (Doc ID 563816.1)Database
- RMAN10g: backup copy of database (Doc ID 266980.1)Database
- 12c-RECOVER PLUGGABLE DATABASEDatabase
- ORA-15024: discovered duplicately numbered ASM disk(Doc ID 1457185.1)ASM
- How to Collect Diagnostics for Database Hanging Issues (Doc ID 452358.1)Database
- Master Note of Linux OS Requirements for Database Server (Doc ID 851598.1)ASTLinuxUIREMDatabaseServer
- JavaVM Component Database PSU and RU Patches(Doc ID 1929745.1)JavaDatabase
- [轉帖]Release Schedule of Current Database Releases (Doc ID 742060.1)Database
- Oracle Database 12C 新功能 rman RECOVER TABLE (文件 ID 2047644.1)OracleDatabase
- recover database using backup controlfileDatabase
- ORA-1578 Corrupt Block Found in Encrypted Database (Doc ID 1329437.1)BloCDatabase
- recover database using backup controlfile理解Database
- recover database的四條語句區別 .Database
- recover database using backup control fileDatabase