只有.DBF、.CTL如何恢复数据库 ORACLE 9i 

解决方案 »

  1.   

    没有太多意外的话,就可以恢复。先见pfile,然后mount 然后open,然后调整文件路径即可。
      

  2.   

    既然你说只有dbf和控制文件,那就说明没有归档日志,在线日志和参数文件,这个恢复比较麻烦.
    用oracle本身的恢复来做貌似比较困难,流程大概如下
    1.创建pfile
    2.创建控制文件
    3.恢复dbf到指定位置
    4.打开隐藏参数 _allow_resetlogs_corruption
    5.打开数据库
    过程比较复杂另外,你可以选择使用odu,这个是国内一个dba写的第三方工具,可以直接读取dbf中的数据,具体参照
    http://www.laoxiong.net/category/odu
      

  3.   

    如果有rman备份,可以参照如下:下面是数据中的数据文件,参数文件,控制文件全部丢失,只有RMAN备份的文件,包括数据文件,参数文件,控制文件。恢复数据库到备份状态
    RMAN> delete backup;
    RMAN> backup database;
    RMAN> backup spfile;
    RMAN> shutdown abort;
    Oracle instance shut down
    [oracle@huang11 ~]$ rm /sof/oracle/oradata/orcl/* -rf 
    [oracle@huang11 ~]$ rm /sof/oracle/admin/orcl -rf
    [oracle@huang11 ~]$ rm /sof/oracle/10g/dbs/*orcl* -rf
    [oracle@huang11 ~]$ rm /sof/oracle/10g/dbs/*ORCL* -rf
    RMAN> startup nomount;
    startup failed: ORA-01078: failure in processing system parameters
    LRM-00109: could not open parameter file '/sof/oracle/10g/dbs/initorcl.ora'
    下面是恢复spfile文件。
    RMAN> restore spfile from '/sof/oracle/flash_recovery_area/ORCL/backupset/2010_01_19/o1_mf_nnsnf_TAG20100119T113309_5ob9zoq0_.bkp';
    RMAN> startup force;
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of startup command at 01/19/2010 11:36:50
    RMAN-04014: startup failed: ORA-09925: Unable to create audit trail file
    Linux Error: 2: No such file or directory
    Additional information: 9925
    [oracle@huang11 ~]$ mkdir /sof/oracle/admin/orcl/{a,b,c,d,u}dump -p
    RMAN> startup force;
    Oracle instance started
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of startup command at 01/19/2010 11:40:25
    ORA-00205: error in identifying control file, check alert log for more info
    RMAN> restore controlfile from '/sof/oracle/flash_recovery_area/ORCL/backupset/2010_01_19/o1_mf_ncsnf_TAG20100119T113155_5ob9yth6_.bkp';
    Starting restore at 19-JAN-10
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=157 devtype=DISK
    channel ORA_DISK_1: restoring control file
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of restore command at 01/19/2010 11:41:13
    ORA-19870: error reading backup piece /sof/oracle/flash_recovery_area/ORCL/backupset/2010_01_19/o1_mf_ncsnf_TAG20100119T113155_5ob9yth6_.bkp
    ORA-19504: failed to create file "/sof/oracle/oradata/orcl/control01.ctl"
    ORA-27040: file create error, unable to create file
    Linux Error: 2: No such file or directory
    [oracle@huang11 ~]$ mkdir /sof/oracle/oradata/orcl
    RMAN> restore controlfile from '/sof/oracle/flash_recovery_area/ORCL/backupset/2010_01_19/o1_mf_ncsnf_TAG20100119T113155_5ob9yth6_.bkp';
    Starting restore at 19-JAN-10
    using channel ORA_DISK_1
    channel ORA_DISK_1: restoring control file
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
    output filename=/sof/oracle/oradata/orcl/control01.ctl
    output filename=/sof/oracle/oradata/orcl/control02.ctl
    output filename=/sof/oracle/oradata/orcl/control03.ctl
    Finished restore at 19-JAN-10
    RMAN> alter database mount;
    database mounted
    released channel: ORA_DISK_1
    RMAN> restore database;
    RMAN> recover database;
    Starting recover at 19-JAN-10
    using channel ORA_DISK_1
    starting media recovery
    unable to find archive log
    archive log thread=1 sequence=1
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of recover command at 01/19/2010 11:43:12
    RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 560763
    SQL> alter database open resetlogs;
    Database altered.
    如果这里还是不能成功的时候我们就要加隐藏参数。
    SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;
    SQL> shutdown abort;
    SQL> startup force;
    SQL> alter database open resetlogs;s
    成功后取消隐藏参数。
    SQL> alter system reset "_allow_resetlogs_corruption" scope=spfile sid='*';
    System altered.
    SQL> shutdown immediate;
    SQL> startup
    下面我们查看数据是否能正常查询。
    SQL> select count(*) from luo.luo;
      COUNT(*)
    ----------
            14
      

  4.   

    有log文件我没说全不好意思!