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之后,控制文件可以恢复。

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

相关文章 随机文章
  • 深入理解数据库创建-补遗
  • 控制文件的SECTION 11是什么?
  • Oracle10g 控制文件的改变
  • Oracle10g Events CONTROLF的改变
  • 丢失所有文件、拥有全备份,缺少后增加的文件
  • Streams流复制的异常检测
    RMAN的"rman: can't open target"错误
    Oracle11g数据库的认证体系结构
    使用Perl连接Mysql数据库
    北京天下亦有雪
    网上相关主题:
    Google

    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

    留言 (4)

    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

    发表留言:



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



    CopyRight © 2004 eygle.com, All rights reserved.