Oracle Study Notes: A bit of understanding about backup, restoration, and recovery (go @)
Http://www.cnblogs.com/jinzhenshui/archive/2009/03/10/1407666.html
Oracle provides a wide range of Flexible backup, restoration, and recovery management mechanisms and measures!
The three concepts must be clarified first:
- Backup-Backup: "photographing" and archiving based on status points
- Restore-restore: Roll Back To The status point of the "photo", file unarchive, and file reset.
- Recovery-recover: roll forward from the "photograph" status point to repeat all changes. This includes manual recover and automatic SMON-managed Recove. It's also our 99% management work!
Management methods provided by Oracle
- SQL (plus) Statement, original, but recommended!
- RMAN
- Operating System
- OEM
Oracle management mechanism: (my personal understanding) through control file, datafile, online redo file, archived Redo, undo FileInternal IDIdentify whether the entire system is consistent !! I guess thisInternal IDIt is composed of SCN and SCN at resetlogs! Cross-resetlogs recovery is allowed in 10 Gb. I guess this oracle buddy may be allowed to use SCN as the consistent identification under some conditions!
If? And? Inconsistent :?..
- Online: Don't talk nonsense! Resetlogs
- Controlfile: Restore or create controlfile. You can select resetlogs or noresetlogs. The key is: whether datafile is consistent with online to determine whether resetlogs is used.
- Datafile: [restore first] And then recover. Decide whether to resetlogs based on the situation. Or create controlfile. This requires resetlogs.
- The combination of the above situations can also be applied in various stages.
- Archived redo is not continuous, inconsistent, and damaged: even if God is present, it is impossible to apply these files for recover. Find out how much value these archive redo logs can be used. If not, delete them. These files are necessary for recovery! Whether it is not completely restored to SCN, time, sequence #, and cancel, it is essentially to apply SCN in sequence !!!
- What is the role of the Undo file in the recover process? I have not yet figured out that it is necessary to only provide the undospace space for the control file. Oracle cannot afford it. At the end of the recover process, oracle does not perform any processing or just reinitialize the file. The commit transaction in online redo will be applied to datafile, and no commit transaction will be directly deleted from the online redo file, otherwise, the Undo content in the rollback undo file will be processed according to the automatic recover of SMON. At this time, the Undo file does not exist, so there will be no problem!
Management types provided by Oracle
- Cold and Hot: whether Oracle-related files are locked
- Logical and physical: Oracle Data, file structure and data
- Complete and incomplete: whether it is all Dongdong (related files, related data, related history ...)
Backup: objects include datafile, undofile, archived logfile, spfile, and controlfile.
- OS cold backup: Shut down the Oracle database and keep all relevant files consistent. Copy, And then..., resetlogs for resetlogs and noresetlogs for noresetlogs.
- Datafile Hot Backup: As for Oracle backup status, alter database {begin | end} backup, and then copy,
- Hot Standby of controlfile: Alter Database Backup controlfile to filespec [reuse]
- Hot Standby of controlfile for standby: Alter database create {physical | logical} standby controlfile as filespec [reuse]
- Spfile | hot backup of pfile: Direct Copy under OS. Because Oracle does not lock this file.
- Hot Backup of PWD files: Direct Copy under OS. Because Oracle does not lock this file.
- Hot Standby of archived log: directly copy .................................... ............ that's all!
- Hot Backup in RMAN mode: Copy, path, name, and history of the manual OS will be hidden. Therefore: it is highly recommended. However, be sure to back up all relevant files. Otherwise, it will be difficult to handle it!
- Exp logic inverted backup, pay attention to the setting of nls_lang
- The expdp server returns a backup. Note: Set directory objects.
Restore:
- Such as spfile | pfile, pwdsid, and archivedlog can be used for restore anytime, anywhere, provided that they are indeed valid
- Controfile: In nomount status, you can use the cold backup to directly restore the data;
- Datafile: In the nomount status, you can use the cold backup to directly restore the data;
- Restore in RMAN mode: Copies, paths, names, and historical records of a manual OS are hidden. Therefore: it is highly recommended.
- IMP logical Import
- Import impdp server Logic
Recover: There is nothing to say. Basically, it depends on online redo and archived redo for full or incomplete recovery !!! Therefore, the archived redo file is crucial!
- Recover in RMAN mode: Copies, paths, names, and historical records of a manual OS are hidden. Therefore: it is highly recommended.
- Recover {cancel | continue [Default]} -- Mount -- Cancel, continue Recove session
- Recover logfile 'filespec '-- Mount -- directly apply logfile for Recove session
- Recover [automatic] [from 'location']... [Test] [Allow n upload uption] -- Mount -- Automatic indicates that Recove automatically searches for the local available log_archive_dest [_ 1] or the specified location's archived redo file conforming to log_archive_famat, and applying, if the file is not found or terminated, the recommended Automatic File Name of prompt is displayed. Simulate the recover when the test is used. Allow n Upton indicates that n bad blocks are allowed to exist in the archived redo file. For test, a value greater than 1 can be specified. When applying recover, it can only be 0 or 1.
- Recover database until {cancel | time datatime | change SCN} [using backup controlfile] -- Mount -- recover the entire databaseTime Point, SCN, cancel
- Recover tablespace TBS ,...
- Recover datafile {filenumber | filename },...
- Recover standby tablespace TBS,... until controlfile
- Recover standby datafile {filenumber | filename},... until controlfile
- Recover managed standby database:
- Using current logfile [nodelay] [Disconnect]
- Until change SCN [nodelay] [Disconnect]
- Finish [force] [{Wait | Nowait}]
- Cancel [{immediate | {Wait | Nowait}]