ITPub博客

首页 > Linux操作系统 > Linux操作系统 > recover controlfile

recover controlfile

原创 Linux操作系统 作者:ad007520 时间:2010-10-14 16:50:14 0 删除 编辑

控制文件丢失
丢失前 如果有:
ex:
1、sqlplus>alter database backup controlfile to 'beifen.ctl';
or

2、rman>BACKUP CURRENT CONTROLFILE format  '/dms01/app/dump/rman/control.ctl01';

or

backup as copy current controlfile  format '/dms01/app/dump/rman/control.ctl';

or
rman>backup database include current controlfile;

3、修改rman configure
CONFIGURE CONTROLFILE AUTOBACKUP on;
则
ins 1:
startup nomount
cp beifen.ct /{..}/oradata/{实例}/control01.ctl
参数文件定义了几个control file 就cp几个
alter database mount;
SQL> recover database until cancel using BACKUP CONTROLFILE;
pecify log: {=suggested | filename | AUTO | CANCEL}
--输入日志所在路径 ex:/u01/app/oracle/oradata/orcl/redo01.log
sql>alter database open resetlogs;

ins 2:
step 1
RMAN> run{
2> startup nomount;
3> restore controlfile from '/u01/app/oracle/flash_recovery_area/ORCL/backupset/2010_10_12/o1_mf_ncnnf_TAG20101012T014922_6c7xq2l6_.bkp';
4> alter database mount;
5> }

Oracle instance started

Total System Global Area     167772160 bytes

Fixed Size                     1266392 bytes
Variable Size                 75500840 bytes
Database Buffers              88080384 bytes
Redo Buffers                   2924544 bytes

Starting restore at 12-OCT-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output filename=/u01/app/oracle/oradata/orcl/control01.ctl
output filename=/u01/app/oracle/oradata/orcl/control02.ctl
output filename=/u01/app/oracle/oradata/orcl/control03.ctl
Finished restore at 12-OCT-10

database mounted
released channel: ORA_DISK_1
step 2:
select * from v$log;查看current logfile

SQL> recover database until cancel using backup controlfile;
ORA-00279: change 814434 generated at 10/12/2010 01:43:41 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2010_10_12/o1_mf_1_1_%u_.arc
ORA-00280: change 814434 for thread 1 is in sequence #1


Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/orcl/redo01.log
Log applied.
Media recovery complete.
SQL> alter database open resetlogs;

Database altered.

ins 3:
前面step 1的语句 稍作调整 改成
RMAN> run{
2> startup nomount;
3> restore controlfile from autobackup;
4> alter database mount;
5> recover database;
6> alter database open resetlogs;
7> }

Oracle instance started

Total System Global Area     167772160 bytes

Fixed Size                     1266392 bytes
Variable Size                 75500840 bytes
Database Buffers              88080384 bytes
Redo Buffers                   2924544 bytes

Starting restore at 12-OCT-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK

recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: ORCL
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2010_10_12/o1_mf_s_732160879_6c7yfjp1_.bkp
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/u01/app/oracle/oradata/orcl/control01.ctl
output filename=/u01/app/oracle/oradata/orcl/control02.ctl
output filename=/u01/app/oracle/oradata/orcl/control03.ctl
Finished restore at 12-OCT-10

database mounted
released channel: ORA_DISK_1

Starting recover at 12-OCT-10
Starting implicit crosscheck backup at 12-OCT-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 12-OCT-10

Starting implicit crosscheck copy at 12-OCT-10
using channel ORA_DISK_1
Finished implicit crosscheck copy at 12-OCT-10

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2010_10_12/o1_mf_s_732160879_6c7yfjp1_.bkp

using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 1 is already on disk as file /u01/app/oracle/oradata/orcl/redo01.log
archive log filename=/u01/app/oracle/oradata/orcl/redo01.log thread=1 sequence=1
media recovery complete, elapsed time: 00:00:01
Finished recover at 12-OCT-10

database opened


over!

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21993926/viewspace-675966/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-06-28

  • 博文量
    137
  • 访问量
    287974