假如今天数据库宕了,而且今天只做了1级备份,全备是昨天做的,那我应该怎样来恢复数据库? 谢谢!

解决方案 »

  1.   

    通过RMAN恢复,RMAN如果不指定,首先会自动搜索备份来进行恢复。
      

  2.   

    总的步骤.
    1.先使用rman 来启动库到nomount 状态
    2.set dbid= (原来备份时候指定的id)
    3.用rman 恢复控制文件
    4.rman下挂载数据库 
    5.restore database
    6.recover database  (可以利用归档日志 不断recover只要你不open database resetlogs)
    7.sqlplus / as sysdba
      recover database using backup controlfile until cancel;
     最后alter database open resetlogs;
    |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    dbca删库$ export DISPLAY=10.154.81.23:0.0
    $ dbca
    $ crs_stat -t
    Name           Type           Target    State     Host        
    ------------------------------------------------------------
    ora....B1.lsnr application    ONLINE    ONLINE    dxdb1       
    ora.dxdb1.gsd  application    ONLINE    ONLINE    dxdb1       
    ora.dxdb1.ons  application    ONLINE    ONLINE    dxdb1       
    ora.dxdb1.vip  application    ONLINE    ONLINE    dxdb1       
    ora....B2.lsnr application    ONLINE    ONLINE    dxdb2       
    ora.dxdb2.gsd  application    ONLINE    ONLINE    dxdb2       
    ora.dxdb2.ons  application    ONLINE    ONLINE    dxdb2       
    ora.dxdb2.vip  application    ONLINE    ONLINE    dxdb2       
    $ /*
    srvctl remove database -d dxdb
    srvctl status database -d dxdb
    crs_stat
    */dd if=/dev/zero of=/dev/vgdx/rdxdb_rd11_512m bs=1024k count=512
    dd if=/dev/zero of=/dev/vgdx/rdxdb_rd13_512m bs=1024k count=512
    dd if=/dev/zero of=/dev/vgdx/rdxdb_rd12_512m bs=1024k count=512
    dd if=/dev/zero of=/dev/vgdx/rdxdb_rd23_512m bs=1024k count=512
    dd if=/dev/zero of=/dev/vgdx/rdxdb_rd22_512m bs=1024k count=512
    dd if=/dev/zero of=/dev/vgdx/rdxdb_rd21_512m bs=1024k count=512
    两个节点:
    $ pwd
    /oracle/admin/
    $ mkdir dxdb
    $ cd dxdb
    $ mkdir adump bdump cdump udump节点1:
    $cd /arch/DXDB/archivelog
    $cd 2009_06_05
    $rm o*
    cd ../2009_06_06
    rm o*节点2:
    $cd /arch/DXDB/autobackup
    $cd 2009_06_05
    $rm *
    $ cd /rman
    $ rmanRecovery Manager: Release 10.2.0.4.0 - Production on Sat Jun 6 19:58:55 2009Copyright (c) 1982, 2007, Oracle.  All rights reserved.RMAN> connect target /connected to target database: DXDB (DBID=2908250559, not open)RMAN> shutdown immediateusing target database control file instead of recovery catalog
    database dismounted
    Oracle instance shut downRMAN> set dbid=2908250559executing command: SET DBIDRMAN> startup nomount pfile='/oracle/product/10.2.0/db/dbs/initdxdb_rman.ora';connected to target database (not started)
    Oracle instance startedTotal System Global Area    8589934592 bytesFixed Size                     2069904 bytes
    Variable Size               1358957168 bytes
    Database Buffers            7214202880 bytes
    Redo Buffers                  14704640 bytesRMAN> restore controlfile from '/rman/cntrl_1759_1_688730210';Starting restore at 06-JUN-09
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=1088 devtype=DISKchannel ORA_DISK_1: restoring control file
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
    output filename=/dev/vgdx/rdxdb_ctl1_256m
    output filename=/dev/vgdx/rdxdb_ctl2_256m
    Finished restore at 06-JUN-09RMAN> alter database mount;database mounted
    released channel: ORA_DISK_1RMAN> run{
        allocate channel ch00 type disk;
        allocate channel ch01 type disk;
        allocate channel ch02 type disk;
        allocate channel ch03 type disk;
        allocate channel ch04 type disk;
        allocate channel ch05 type disk;
        allocate channel ch06 type disk;
        allocate channel ch07 type disk;
        allocate channel ch08 type disk;
        allocate channel ch09 type disk;
        allocate channel ch10 type disk;
        allocate channel ch11 type disk;
        restore database;
        release channel ch00;
        release channel ch01;
        release channel ch02;
        release channel ch03;
        release channel ch04;
        release channel ch05;
        release channel ch06;
        release channel ch07;
        release channel ch08;
        release channel ch09;
        release channel ch10;
        release channel ch11;
    }
    RMAN> run{
    2>     allocate channel ch00 type disk;
        allocate channel ch01 type disk;
        allocate channel ch02 type disk;
    3> 4> 5>     allocate channel ch03 type disk;
        allocate channel ch04 type disk;
        allocate channel ch05 type disk;
        allocate channel ch06 type disk;
    6> 7> 8> 9>     allocate channel ch07 type disk;
        allocate channel ch08 type disk;
        allocate channel ch09 type disk;
        allocate channel ch10 type disk;
    10> 11> 12> 13>     allocate channel ch11 type disk;
        restore database;
        release channel ch00;
        release channel ch01;
    14> 15> 16> 17>     release channel ch02;
        release channel ch03;
        release channel ch04;
        release channel ch05;
    18> 19> 20> 21>     release channel ch06;
        release channel ch07;
        release channel ch08;
        release channel ch09;
    22> 23> 24> 25>     release channel ch10;
        release channel ch11;
    }
    26> 27> 
    allocated channel: ch00
    channel ch00: sid=1088 devtype=DISKallocated channel: ch01
    channel ch01: sid=1087 devtype=DISKallocated channel: ch02
    channel ch02: sid=1086 devtype=DISKallocated channel: ch03
    channel ch03: sid=1085 devtype=DISKallocated channel: ch04
    channel ch04: sid=1084 devtype=DISKallocated channel: ch05
    channel ch05: sid=1083 devtype=DISKallocated channel: ch06
    channel ch06: sid=1082 devtype=DISKallocated channel: ch07
    channel ch07: sid=1081 devtype=DISKallocated channel: ch08
    channel ch08: sid=1080 devtype=DISKallocated channel: ch09
    channel ch09: sid=1079 devtype=DISKallocated channel: ch10
    channel ch10: sid=1078 devtype=DISKallocated channel: ch11
    channel ch11: sid=1077 devtype=DISKStarting restore at 06-JUN-09
    Starting implicit crosscheck backup at 06-JUN-09
    Crosschecked 34 objects
    Crosschecked 2 objects
    Finished implicit crosscheck backup at 06-JUN-09Starting implicit crosscheck copy at 06-JUN-09
    Finished implicit crosscheck copy at 06-JUN-09searching for all files in the recovery area
    cataloging files...
    cataloging doneList of Cataloged Files
    =======================
    File Name: /arch/DXDB/archivelog/2009_06_05/o1_mf_1_17262_52jzd4ys_.arc
    File Name: /arch/DXDB/archivelog/2009_06_05/o1_mf_1_17263_52jzfjbg_.arc
    File Name: /arch/DXDB/archivelog/2009_06_05/o1_mf_1_17264_52jzh0j5_.arc
    File Name: /arch/DXDB/archivelog/2009_06_05/o1_mf_1_17265_52k0h1yw_.arc
    File Name: /arch/DXDB/archivelog/2009_06_05/o1_mf_1_17266_52k1h28d_.arc
      

  3.   

    数据库宕了,是怎么宕了?
    是不是需要做恢复?先得搞清楚这些问题再说要是说恢复,两句话就可以
    restore database;
    recover database;