RMAN> reset database 等价操作recover cancel resetlogs

To provide information on restore and recovery of a Noarchivelog Database.

Details

When performing a consistent backup (also known as cold or offline backup)
with  Recovery Manager, it will backup the datafiles and generate a backup
controlfile, the online redo logs are never backed up by RMAN.

Hence, after a full database restore, the database has to be opened with
RESETLOGS, because online redo logs are not available. The OPEN RESETLOGS
command will create the online redo logs based on information from the
database's controlfile.

Usually, an OPEN RESETLOGS is only permitted, if it is preceded by an
incomplete or complete recovery, or after recovery with a backup controlfile.
Since the backup is consistent, and neither online logs nor archivelogs are
available to apply, a "fake" recovery had to be performed in Oracle7, to allow
an  OPEN RESETLOGS in the recovery session.  However, RMAN in Oracle8 and above
does not support syntax for a cancel-based recovery, so a separate SVRMGR 
session would be necessary to perform the additional recovery step.

This would be the scenario :

 In SQLPLUS
    - startup nomount
 In RMAN

      run {
      allocate channel c1 type disk;
      restore controlfile to '<pathname>';
      replicate controlfile from '<pathname>';
      sql "alter database mount";
      restore database;
      recover database noredo;
      sql 'alter database open resetlogs';
      release channel c1;
      }

     RMAN> reset database

NOTE: Only use the noredo option on the RECOVER command if the database is running 
      in NOARCHIVELOG mode 

 In SQLPLUS
    -  recover database until cancel using backup controlfile, 'cancel'
    -  alter database open resetlogs
 In RMAN
    -  reset database

Initiating a separate SQLPLUS session to allow and perform an OPEN RESETLOGS is
a big inconvenience because it introduces more potential to jeopardize the
database recovery and hence the consistency and integrity of the database.

From Oracle8, the conditions have changed, under which an OPEN RESETLOGS
can be done. This allows the user to achieve a full database restore and an
OPEN RESETLOGS without the need to perform a fake recovery step outside RMAN.

From Oracle8 we can execute an OPEN RESETLOGS without prior fake recovery, if

  - both controlfile and datafiles are checkpointed at the same SCN, and
  - this controlfile is a backup controlfile

These conditions are true for a consistent, full backup of a NOARCHIVELOG
database using RMAN. So, a more pratical and convenient way to restore and
recover a consistent, full backup of a NOARCHIVELOG database is to OPEN
RESETLOGS the database just after the restore of the datafiles and the
backup controlfile:

 In SQLPLUS
    - startup nomount
 In RMAN
    - allocate channel c1;
    - restore controlfile to '<pathname>';
    - replicate controlfile from '<pathname>';
    - sql 'alter database mount';
    - restore database;
    - sql 'alter database open resetlogs';
    - release channel c1;
    - reset database

This mechanism also works well without RMAN. If you have a consistent
backup of datafiles having used OS utilities (like cp, tar, dd etc.),
as well as a backup controlfile having executed an ALTER DATABASE BACKUP
CONTROLFILE TO 'file' command, you can proceed as followed:

 - Restore datafiles and backup controlfile
 - In SQLPLUS
    - startup mount
    - alter database open resetlogs
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值