关于 oracle恢复的 概论

There are two type ways of backup:

  After completing this lesson, you should be able to do the following:
 
1: Describe media recovery.
2: Perform recovery in NOARCHIVELOG mode.
3: Perform complete recovery in ARCHIVELOG node.
4: Restore datafiles to different locations.
5: Relocate and recover a tablespace by using archived redo log files.
6: Describe read-only tablespace recovery.

Step1:
  Restoration:
  1: Restore files using operating system commands.
  2: Recovery files using the SQL*Plus recover command.
 
  Recovery in NOARCHIVELOG:
 
  You must restore the following database files:
  --All datafiles
  --Control files
 
  You can also restore the following files:
  --Redo log files  (When you shutdown the database gracefully,
                     the redo log file already write into the datafiles,
                     so this is not neccessary to backup)
  --Password file
  --parameter file
 
  This advantages:
  1: Easy to perform, with low risk of error.
  2: Recovery time the time it takes to restore all files
 
  Disadvantages:
  1: Data is lost and must be reappied manually
  2: The entire database is restored to the point of last whole closed backup.
 
--------------
  If you are required to recovery the database , the mainly steps are below:
 
  1: create pfile from spfile
  2: backup the original spfile
  3: vi pfile (update the control file path if the original disk is damaged).
  4: startup mount;
  5: select name from v$datafile;
    alter database rename file '/u01/oradata/morewood/users01.dbf' to '/u01/oradata/md/users01.dbf';
  6: select name from v$tempfile;
    alter database rename file '/u01/oradata/morewood/temp01.dbf' to '/u01/oradata/md/temp01.dbf';
  7: select member from v$logfile;
    alter database rename file '/u01/oradata/morewood/redo01.log' to '/u01/oradata/md/redo01.dbf';
  8: alter database open;
 

Step2:
  If you do not have any redo log files backup, what will you do?
 
  Below is detailed command:
 
  1: shutdown the instance.
  2: Restore the datafiles and the control files from the most recent whole database backup.
  3: Perform cancel-based recovery.
  4;Open the database with the resetlogs open.
 
  The recovery steps:
 
  1: startup mount;
  2: recover database until cancel using backup controlfiles; (cancel);
  3;alter database open resetlogs;
 
Notice:
  Please figure out when you should use the "using backup controlfile".
 

Step3:
  Study how to recovery the database in archivelog mode:
 
  Complete Recovery:
  1: Uses redo data or incremental backups
  2: Updates the database to the most current point time.
  3:Applies all redo changes.
 
  Incomplete Recovery:
  -- Uses backup and redo logs to produce a nocurrent version of the database.
 
  Details:
 
  Complete Recovery:(Archivelog Mode)
  -- make sure that datafile for restore are offline.
  -- Restore only lost or damanged datafiles.
  -- Do not restore the control files, redo log files. password files, or parameter files.
  -- Recover the datafiles.
 
  Advantages:
 
  1: Only need to restore lost files.
  2: Recovery all data to the time of failure using all redo and archive logs.
  3: Recovery time is the time it takes to restore lost files and appy all archive log files.
 
  Disadvantages:
  Must have all archived log files since the backup from which you are restoring.
 
----------

  Let us take a look at some important view about recovery:
 
  1: v$recover_file:
    This view is to determine which datafiles need recovery.
   
  2: v$archived_log:
    This is a list of all archvied redo log files for the database.
   
  3: v$recovery_log:
    This view is for a list of all archived redo log files required for recovery.
   
Notice 1:
  To determine which archived redo log files are needed, query v$archived_log and
  v$recovery_log. V$archived_log lists filenames for all archvied logs.
  v$recovery_log lists only that archived redo logs that the database needs to perform
  media recovery. It aslo incudes the probable names of the files, using LOG_ARCHIVE_FORMAT.
 
Notice 2:
  If the control file is not the current control file, the information from v$recover_file
  is not correct.
  So you can not use v$recover_file with a control file restored from backup or a
  control file that was re-created after the time of media failure.
 

Step4:
  Take a look at below recovery command:
 
  1: Recovery a mounted database:
  sql>recover database;
  sql>recover datafile '/u01/oradata/user01.dbf';
 
  2: Recover an open database:
  this time can not recover database
  sql>recover tablespace user;
  sql>recover datafile '/u01/oradata/user01.dbf';
 
-------------
  There are foure types of database recovery:
 
  1: Closed database recovery for:
   -- System datafiles
   -- Undo segment datafiles
     (above file is lost , should ensure the database in mounted mode)
    
   -- Whole database.
  
  2: Open database recovery, with database initially opened (for file lost).
 
  3: Open database recovery with database initially closed (for hardware failure).
 
  4: Data file recovery with no datafile backup.
    (using all the archived log files).
   

Step5:
  If you want to backup one tablespace when the database open, below command is needed:
 
  1: alter tablespace tablesapce_name begin backup;
  2: cd /u01/oradata/
  3: cp tbs01.dbf ./hot_bak/
  4: alter tablespace tablespace_name end backup;
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

shenghuiping2001

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值