eygle.com   eygle.com
eygle.com  
 

« 十年 | Blog首页 | 使用RMAN的备份及恢复一例-丢失所有控制文件 »

使用Oracle9i的自动控制文件备份功能

作者:eygle |【转载时请以超链接形式标明文章和作者信息及本声明
链接:
1.启用控制文件自动备份
[oracle@standby oracle]$ rman target /

Recovery Manager: Release 9.2.0.4.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database: PRIMARY (DBID=1367687269)

--注意记录这里的DBID,在此后的恢复中,你可能需要用到。

RMAN> configure controlfile autobackup on;

using target database controlfile instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN> exit


Recovery Manager complete.

在启用了自动备份以后,在数据库发生文件变化或备份等任务时,数据库会自动备份控制文件。
如果丢失了所有的控制文件及数据文件,我们可以尝试从自动备份中恢复控制文件及spfile文件。
2.丢失所有所有的控制文件的恢复尝试
[oracle@standby oradata]$ rman target /

Recovery Manager: Release 9.2.0.4.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database (not started)

首先启动数据库到nomount状态

RMAN> startup nomount;

Oracle instance started

Total System Global Area     135337420 bytes

Fixed Size                      452044 bytes
Variable Size                109051904 bytes
Database Buffers              25165824 bytes
Redo Buffers                    667648 bytes

尝试从自动备份中恢复控制文件

RMAN> restore controlfile to '/opt/oracle/oradata/control01.ctl' from autobackup;

Starting restore at 09-MAR-05

using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 03/09/2005 10:15:05
RMAN-06495: must explicitly specify DBID with SET DBID command

此时提示,必须显示的指定DBID,Oracle才能正确定位备份文件。

RMAN> set DBID=1367687269

executing command: SET DBID

RMAN> restore controlfile to '/opt/oracle/oradata/control01.ctl' from autobackup;

Starting restore at 09-MAR-05

using channel ORA_DISK_1
channel ORA_DISK_1: looking for autobackup on day: 20050309
channel ORA_DISK_1: autobackup found: c-1367687269-20050309-00
channel ORA_DISK_1: controlfile restore from autobackup complete
Finished restore at 09-MAR-05

指定DBID之后,控制文件可以恢复。

历史上的今天...
      >> 2009-03-09文章:
      >> 2008-03-09文章:
             深入理解数据库创建-补遗
------
这篇 【使用Oracle9i的自动控制文件备份功能】来自 eygle.com | CSDN网摘| del.icio.us|Google订阅 | 鲜果订阅 | 抓虾订阅

By eygle on 2005-03-09 11:46 | Comments (5) | Posted to Backup&Recovery | Edit |

相关文章 随机文章
  • 深入理解数据库创建-补遗
  • 控制文件的SECTION 11是什么?
  • Oracle10g 控制文件的改变
  • Oracle10g Events CONTROLF的改变
  • 丢失所有文件、拥有全备份,缺少后增加的文件
  • 被人晃点
    见过这么高并发( logons current)的数据库么?
    请客吃饭 报名征集中...
    使用REF CURSOR处理Oracle的结果集
    Oracle跨版本导出EXP-00003错误的解决
    搜索本站:

    Listed below are links to weblogs that reference 使用Oracle9i的自动控制文件备份功能:

    » Oracle HowTo:如何获得数据库的DBID from Friends Life and Oracle
    在进行数据库恢复的过程中,很多时候我们需要知道Oracle数据库的DBID,通常有以下几种方法可以获得数据库的DBID. [Read More]

    Tracked on February 5, 2006 10:04 PM

    留言 (5)

    eygle 老大
    按照你的步骤模拟了一个操作
    前面的都成功
    ControlFile Autobackup 设置成功;
    backup database 也没问题
    但是恢复 Control File 的时候提示:
    RMAN> SET DBID=1958500524

    executing command: SET DBID
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00579: the following error occurred at 08/08/2005 13:45:55
    RMAN-03002: failure during compilation of command
    RMAN-03013: command type: CSET
    RMAN-06188: cannot use command when connected to target database

    数据库版本:
    SQL> select * from v$version;

    BANNER
    ----------------------------------------------------------------
    Oracle9i Enterprise Edition Release 9.0.1.1.0 - 64bit Production
    PL/SQL Release 9.0.1.1.0 - Production
    CORE 9.0.1.1.0 Production
    TNS for Solaris: Version 9.0.1.1.0 - Production
    NLSRTL Version 9.0.1.1.0 - Production


    请教 eygle 大哥
    是不是有版本的限制?

    Posted by: liyi at August 8, 2005 4:34 PM

    你已经连接到目标数据库,也就是dbid已经获得,就不再需要set dbid了

    Posted by: eygle at August 8, 2005 6:38 PM

    但是还是提示
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00579: the following error occurred at 08/08/2005 13:45:55
    RMAN-03002: failure during compilation of command
    RMAN-03013: command type: CSET
    RMAN-06188: cannot use command when connected to target database

    实在搞不明白了


    在测试之前做了数据库的全备份
    接着修改了所有的3个参数文件的后缀名模拟所有的参数文件丢失的灾难

    后来参考 http://www.dbanotes.net/Oracle/Rman_nocatalog_lost_controlfile_howto.htm
    一个接一个的恢复了 3 个控制文件
    数据库可以起到 Mount 状态
    但是如果直接 startup,提示如下:
    SQL> startup
    ORACLE instance started.

    Total System Global Area 286187904 bytes
    Fixed Size 434560 bytes
    Variable Size 218103808 bytes
    Database Buffers 67108864 bytes
    Redo Buffers 540672 bytes
    Database mounted.
    ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

    接着做了 alter database open resetlogs;
    提示需要从 old backup 里面恢复 SYSTEM01.dbf(忘记保留 Log 了,实在是汗颜)
    接着进行了数据文件的恢复
    提示:需要进行 SYSTEM01.dbf 的Media recovery
    5555~ 有点描述不清楚了

    不知道 eygle 老大可以从我逻辑混乱的描述里面看出哪些操作是很不正确的吗 请指教,拜谢!!

    Posted by: liyi at August 10, 2005 9:15 AM

    你好:
    如果我想将这个备份的文件到另外一台机器里去恢复,这个DBID还是原来的这个数据库的DBID吗?

    Posted by: rainbowbridg at October 24, 2005 1:36 PM

    Microsoft Windows XP [版本 5.1.2600]
    (C) 版权所有 1985-2001 Microsoft Corp.

    C:\Documents and Settings\Administrator>rman target sys/sys

    恢复管理器: 版本9.0.1.1.1 - Production

    (c) Copyright 2001 Oracle Corporation. All rights reserved.

    已连接到目标数据库 (未启动)

    RMAN>startup nomount

    Oracle 例程已启动

    总的系统全局区域为 118255568字节

    Fixed Size 282576字节
    Variable Size 83886080字节
    Database Buffers 33554432字节
    Redo Buffers 532480字节

    RMAN>restore controlfile from autobackup;

    启动 restore 于 24-6月 -09

    正在使用目标数据库控制文件替代恢复目录
    分配的通道: ORA_DISK_1
    通道 ORA_DISK_1: sid=10 devtype=DISK
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00579: the following error occurred at 06/24/2009 21:56:30
    RMAN-03002: failure during compilation of command
    RMAN-03013: command type: restore
    RMAN-03002: failure during compilation of command
    RMAN-03013: command type: IRESTORE
    RMAN-06495: must explicitly specify DBID with SET DBID command

    RMAN>set DBID=1141172078

    正在执行命令: SET DBID
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00579: the following error occurred at 06/24/2009 21:59:20
    RMAN-03002: failure during compilation of command
    RMAN-03013: command type: CSET
    RMAN-06188: cannot use command when connected to target database

    RMAN>EXIT


    恢复管理器完成。

    C:\Documents and Settings\Administrator>RMAN

    恢复管理器: 版本9.0.1.1.1 - Production

    (c) Copyright 2001 Oracle Corporation. All rights reserved.

    RMAN>SET DBID=1141172078

    正在执行命令: SET DBID

    RMAN>connect target sys/sys

    连接到目标数据库: (未安装)

    RMAN>startup nomunt

    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00579: the following error occurred at 06/24/2009 22:01:05
    RMAN-00558: error encountered while parsing input commands
    RMAN-01005: syntax error: found "identifier": expecting one of: "auxiliary,clon
    e,dba,force,mount,newline,nomount,pfile,;"
    RMAN-01008: the bad identifier was: nomunt
    RMAN-01007: at line 1 column 9 file: standard input

    RMAN>startup nomount

    数据库已经启动

    RMAN>restore controlfile from autobackup;

    启动 restore 于 24-6月 -09

    正在使用目标数据库控制文件替代恢复目录
    分配的通道: ORA_DISK_1
    通道 ORA_DISK_1: sid=8 devtype=DISK
    通道 ORA_DISK_1, 正在查找当天控制文件自动备份:20090624
    通道 ORA_DISK_1, 找到控制文件自动备份:c-1141172078-20090624-01
    通道 ORA_DISK_1, 控制文件自动备份恢复已完成
    正在复制控制文件
    输出文件名=C:\ORACLE\ORA90\ORADATA\LAOJIU\CONTROL01.CTL
    输出文件名=C:\ORACLE\ORA90\ORADATA\LAOJIU\CONTROL02.CTL
    输出文件名=C:\ORACLE\ORA90\ORADATA\LAOJIU\CONTROL03.CTL
    输出文件名=D:\CONTROL04.CTL
    完成 restore 于 24-6月 -09

    RMAN>startup mount

    数据库已经启动
    数据库已加载

    RMAN>run{
    2> allocate channel c1 device type disk;
    3> restore database;
    4> recover database;
    5> sql 'alter database open resetlogs';
    6> release channel c1;
    7> }

    释放的通道: ORA_DISK_1
    分配的通道: c1
    通道 c1: sid=8 devtype=DISK

    启动 restore 于 24-6月 -09

    通道 c1: 正在开始恢复数据文件备份集
    通道 c1: 正在指定从备份集恢复的数据文件
    正将数据文件00006恢复到C:\ORACLE\ORA90\ORADATA\LAOJIU\INDX01.DBF
    正将数据文件00008恢复到C:\ORACLE\ORA90\ORADATA\LAOJIU\USERS02.DBF
    通道 c1: 已恢复备份段 1
    段 handle=F:\BAK\20090624_LAOJIU_10_1.LEV1 tag=DBL1 params=NULL
    通道 c1: 恢复完成
    通道 c1: 正在开始恢复数据文件备份集
    通道 c1: 正在指定从备份集恢复的数据文件
    正将数据文件00003恢复到C:\ORACLE\ORA90\ORADATA\LAOJIU\CWMLITE01.DBF
    正将数据文件00005恢复到C:\ORACLE\ORA90\ORADATA\LAOJIU\EXAMPLE01.DBF
    通道 c1: 已恢复备份段 1
    段 handle=F:\BAK\20090624_LAOJIU_11_1.LEV1 tag=DBL1 params=NULL
    通道 c1: 恢复完成
    通道 c1: 正在开始恢复数据文件备份集
    通道 c1: 正在指定从备份集恢复的数据文件
    正将数据文件00002恢复到C:\ORACLE\ORA90\ORADATA\LAOJIU\UNDOTBS01.DBF
    正将数据文件00004恢复到C:\ORACLE\ORA90\ORADATA\LAOJIU\DRSYS01.DBF
    通道 c1: 已恢复备份段 1
    段 handle=F:\BAK\20090624_LAOJIU_12_1.LEV1 tag=DBL1 params=NULL
    通道 c1: 恢复完成
    通道 c1: 正在开始恢复数据文件备份集
    通道 c1: 正在指定从备份集恢复的数据文件
    正将数据文件00001恢复到C:\ORACLE\ORA90\ORADATA\LAOJIU\SYSTEM01.DBF
    正将数据文件00007恢复到C:\ORACLE\ORA90\ORADATA\LAOJIU\TOOLS01.DBF
    通道 c1: 已恢复备份段 1
    段 handle=F:\BAK\20090624_LAOJIU_13_1.LEV1 tag=DBL1 params=NULL
    通道 c1: 恢复完成
    完成 restore 于 24-6月 -09

    启动 recover 于 24-6月 -09

    正在开始介质的恢复

    通道 c1: 正在启动到默认目标的存档日志恢复
    通道 c1: 正在恢复存档日志
    存档日志线程 =1 序列=43
    通道 c1: 已恢复备份段 1
    段 handle=F:\BAK\20090624_LAOJIU_17_1.ARCH tag=null params=NULL
    通道 c1: 恢复完成
    存档日志文件名 =C:\ORACLE\ORA90\ORADATA\LAOJIU\ARCHIVE\1_43.DBF 线程 =1 序列 =43

    通道 c1: 正在启动到默认目标的存档日志恢复
    通道 c1: 正在恢复存档日志
    存档日志线程 =1 序列=44
    通道 c1: 已恢复备份段 1
    段 handle=F:\BAK\20090624_LAOJIU_18_1.ARCH tag=null params=NULL
    通道 c1: 恢复完成
    存档日志文件名 =C:\ORACLE\ORA90\ORADATA\LAOJIU\ARCHIVE\1_44.DBF 线程 =1 序列 =44

    无法找到存档日志
    存档日志线程 =1 序列=45
    释放的通道: c1
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00579: the following error occurred at 06/24/2009 22:03:24
    RMAN-03002: failure during compilation of command
    RMAN-03013: command type: recover
    RMAN-03006: non-retryable error occurred during execution of command: recover(4)

    RMAN-12004: unhandled exception during command execution on channel default
    RMAN-20000: abnormal termination of job step
    RMAN-06054: media recovery requesting unknown log: thread 1 scn 696910

    RMAN>

    Posted by: laojiu at June 24, 2009 10:06 PM

    发表留言:



    Remember Me?
    (输入验证码后方可评论,谢谢支持)



    CopyRight © 2004~2010 eygle.com, All rights reserved.