<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 39  文章 - 1  trackbacks - 0

      RMAN備份歸檔模式下?lián)p壞(丟失)多個數(shù)據(jù)文件,進(jìn)行整個數(shù)據(jù)庫的恢復(fù)

      1、連接數(shù)據(jù)庫,創(chuàng)建測試表并插入記錄

      SQL*Plus: Release 8.1.6.0.0 - Production on Tue May 6 13:46:32 2003 oracle培訓(xùn)

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

      SQL> connect internal/password as sysdba;

      Connected.

      SQL> create table test(a int);

      Table created

      SQL> insert into test values(1);

      1 row inserted

      SQL> commit;

      Commit complete

      2、備份數(shù)據(jù)庫

      DOS下 C:>\ rman cmdfile=bakup.rcv msglog=backup.log;

      以下是backup.log內(nèi)容。

      Recovery Manager: Release 8.1.6.0.0 - Production

      RMAN> # script:bakup.rcv

      2> # creater:chenjiping

      3> # date:5.8.2003

      4> # desc:backup all database datafile in archive with rman

      5>

      6> #connect database

      7> connect rcvcat rman/rman@back;

      8> connect target internal/virpure;

      9>

      10> #start backup database

      11> run{

      12> allocate channel c1 type disk;

      13> backup full tag 'dbfull' format 'd:\backup\full%u_%s_%p' database

      14> include current controlfile;

      15> sql 'alter system archive log current';

      16> release channel c1;

      17> }

      18> #end

      19>

      RMAN-06008: connected to recovery catalog database

      RMAN-06005: connected to target database: TEST (DBID=1788174720)

      RMAN-03022: compiling command: allocate

      RMAN-03023: executing command: allocate

      RMAN-08030: allocated channel: c1

      RMAN-08500: channel c1: sid=15 devtype=DISK

      RMAN-03022: compiling command: backup

      RMAN-03023: executing command: backup

      RMAN-08008: channel c1: starting full datafile backupset

      RMAN-08502: set_count=4 set_stamp=494074368 creation_time=15-MAY-03

      RMAN-08010: channel c1: specifying datafile(s) in backupset

      RMAN-08522: input datafile fno=00002 name=D:\ORACLE\ORADATA\TEST\RBS01.DBF

      RMAN-08522: input datafile fno=00001 name=D:\ORACLE\ORADATA\TEST\SYSTEM01.DBF

      RMAN-08011: including current controlfile in backupset

      RMAN-08522: input datafile fno=00005 name=D:\ORACLE\ORADATA\TEST\TOOLS01.DBF

      RMAN-08522: input datafile fno=00004 name=D:\ORACLE\ORADATA\TEST\TEMP01.DBF

      RMAN-08522: input datafile fno=00006 name=D:\ORACLE\ORADATA\TEST\INDX01.DBF

      RMAN-08522: input datafile fno=00003 name=D:\ORACLE\ORADATA\TEST\USER01.DBF

      RMAN-08013: channel c1: piece 1 created

      RMAN-08503: piece handle=D:\BACKUP\FULL04EN5UG0_4_1 comment=NONE

      RMAN-08525: backup set complete, elapsed time: 00:01:16

      RMAN-03023: executing command: partial resync

      RMAN-08003: starting partial resync of recovery catalog

      RMAN-08005: partial resync complete

      RMAN-03022: compiling command: sql

      RMAN-06162: sql statement: alter system archive log current

      RMAN-03023: executing command: sql

      RMAN-03022: compiling command: release

      RMAN-03023: executing command: release

      RMAN-08031: released channel: c1

      Recovery Manager complete.

      到這里表示備份成功。

      3、繼續(xù)在測試表中插入記錄

      SQL> insert into test values(2);

      1 row inserted

      SQL> commit;

      Commit complete

      SQL> select * from test;

      A

      ---------------------------------------

      1

      2

      SQL> alter system switch logfile;

      System altered.

      SQL> alter system switch logfile;

      System altered.

      4、關(guān)閉數(shù)據(jù)庫,模擬丟失數(shù)據(jù)文件

      SQL> shutdown immediate;

      Database closed.

      Database dismounted.

      ORACLE instance shut down

      C:\>del D:\ORACLE\ORADATA\TEST\SYSTEM01.DBF

      C:\>del D:\ORACLE\ORADATA\TEST\INDX01.DBF

      C:\>del D:\ORACLE\ORADATA\TEST\TOOLS01.DBF

      C:\>del D:\ORACLE\ORADATA\TEST\RBS01.DBF

      5、啟動數(shù)據(jù)庫,檢查錯誤

      SQL> STARTUP

      ORACLE instance started.

      Total System Global Area 102020364 bytes

      Fixed Size 70924 bytes

      Variable Size 85487616 bytes

      Database Buffers 16384000 bytes

      Redo Buffers 77824 bytes

      Database mounted.

      ORA-01157: cannot identify/lock data file 1 - see DBWR trace file

      ORA-01110: data file 1: 'D:\ORACLE\ORADATA\TEST\SYSTEM01.DBF'

      查詢v$recover_file

      SQL> select * from v$recover_file;

      FILE# ONLINE ERROR CHANGE# TIME

      ---------- ------- ------------------ ---------- -----------

      1 ONLINE FILE NOT FOUND 0

      2 ONLINE FILE NOT FOUND 0

      5 ONLINE FILE NOT FOUND 0

      6 ONLINE FILE NOT FOUND 0

      可以知道有四個數(shù)據(jù)文件需要恢復(fù)

      6、利用RMAN進(jìn)行恢復(fù)

      C:\>rman

      Recovery Manager: Release 8.1.6.0.0 - Production

      RMAN> connect rcvcat rman/rman@back

      RMAN-06008: connected to recovery catalog database

      RMAN> connect target internal/virpure

      RMAN-06005: connected to target database: TEST (DBID=1788174720)

      RMAN> run{

      2> allocate channel c1 type disk;

      3> restore database;

      4> recover database;

      5> sql 'alter database open';

      6> release channel c1;

      7> }

      RMAN-03022: compiling command: allocate

      RMAN-03023: executing command: allocate

      RMAN-08030: allocated channel: c1

      RMAN-08500: channel c1: sid=17 devtype=DISK

      RMAN-03022: compiling command: restore

      RMAN-03025: performing implicit partial resync of recovery catalog

      RMAN-03023: executing command: partial resync

      RMAN-08003: starting partial resync of recovery catalog

      RMAN-08005: partial resync complete

      RMAN-03022: compiling command: IRESTORE

      RMAN-03023: executing command: IRESTORE

      RMAN-08016: channel c1: starting datafile backupset restore

      RMAN-08502: set_count=4 set_stamp=494074368 creation_time=15-MAY-03

      RMAN-08089: channel c1: specifying datafile(s) to restore from backup set

      RMAN-08523: restoring datafile 00001 to D:\ORACLE\ORADATA\TEST\SYSTEM01.DBF

      RMAN-08523: restoring datafile 00002 to D:\ORACLE\ORADATA\TEST\RBS01.DBF

      RMAN-08523: restoring datafile 00003 to D:\ORACLE\ORADATA\TEST\USER01.DBF

      RMAN-08523: restoring datafile 00004 to D:\ORACLE\ORADATA\TEST\TEMP01.DBF

      RMAN-08523: restoring datafile 00005 to D:\ORACLE\ORADATA\TEST\TOOLS01.DBF

      RMAN-08523: restoring datafile 00006 to D:\ORACLE\ORADATA\TEST\INDX01.DBF

      RMAN-08023: channel c1: restored backup piece 1

      RMAN-08511: piece handle=D:\BACKUP\FULL04EN5UG0_4_1 tag=DBFULL params=NULL

      RMAN-08024: channel c1: restore complete

      RMAN-03023: executing command: partial resync

      RMAN-08003: starting partial resync of recovery catalog

      RMAN-08005: partial resync complete

      RMAN-03022: compiling command: recover

      RMAN-03022: compiling command: recover(1)

      RMAN-03022: compiling command: recover(2)

      RMAN-03022: compiling command: recover(3)

      RMAN-03023: executing command: recover(3)

      RMAN-08054: starting media recovery

      RMAN-03022: compiling command: recover(4)

      RMAN-06050: archivelog thread 1 sequence 327 is already on disk as file D:\ORACLE\ORADATA\TEST\ARCHIVE\TESTT001S00327.ARC

      RMAN-06050: archivelog thread 1 sequence 328 is already on disk as file D:\ORACLE\ORADATA\TEST\ARCHIVE\TESTT001S00328.ARC

      RMAN-06050: archivelog thread 1 sequence 329 is already on disk as file D:\ORACLE\ORADATA\TEST\ARCHIVE\TESTT001S00329.ARC

      RMAN-06050: archivelog thread 1 sequence 330 is already on disk as file D:\ORACLE\ORADATA\TEST\ARCHIVE\TESTT001S00330.ARC

      RMAN-03023: executing command: recover(4)

      RMAN-08515: archivelog filename=D:\ORACLE\ORADATA\TEST\ARCHIVE\TESTT001S00327.ARC thread=1 sequence=327

      RMAN-08515: archivelog filename=D:\ORACLE\ORADATA\TEST\ARCHIVE\TESTT001S00328.ARC thread=1 sequence=328

      RMAN-08055: media recovery complete

      RMAN-03022: compiling command: sql

      RMAN-06162: sql statement: alter database open

      RMAN-03023: executing command: sql

      RMAN-03022: compiling command: release

      RMAN-03023: executing command: release

      RMAN-08031: released channel: c1

      RMAN>

      7、檢查數(shù)據(jù)庫的數(shù)據(jù)(完全恢復(fù))

      SQL> select * from test;

      A

      ---------------------------------------

      1

      2

      說明:

      1、只要有備份與歸檔存在,RMAN也可以實現(xiàn)數(shù)據(jù)庫的完全恢復(fù)(不丟失數(shù)據(jù))

      2、同OS備份數(shù)據(jù)庫恢復(fù),適合于丟失大量數(shù)據(jù)文件,或包含系統(tǒng)數(shù)據(jù)文件在內(nèi)的數(shù)據(jù)庫的恢復(fù)

      3、目標(biāo)數(shù)據(jù)庫在mount下進(jìn)行,如果恢復(fù)成功,再打開數(shù)據(jù)庫。

      4、RMAN的備份與恢復(fù)命令相對比較簡單并可靠,建議有條件的話,都采用RMAN進(jìn)行數(shù)據(jù)庫的備份。

    posted on 2013-08-14 11:44 親愛的小孩 閱讀(202) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 色噜噜亚洲精品中文字幕| 毛片a级毛片免费播放下载| 亚洲性在线看高清h片| 天天综合亚洲色在线精品| 免费理论片51人人看电影| 亚洲狠狠婷婷综合久久蜜芽| 成人男女网18免费视频| 亚洲国产精品精华液| 免费人成在线观看视频播放 | 国产精品区免费视频| 国产亚洲人成无码网在线观看| 国产精品青草视频免费播放| 久久亚洲国产精品123区| 国产精品美女久久久免费| 亚洲日本va在线视频观看| 无码日韩精品一区二区免费暖暖 | 免费国产黄网站在线观看视频 | 少妇亚洲免费精品| 国产亚洲精品自在线观看| 国产一精品一AV一免费| 亚洲精品在线视频观看| 成全高清视频免费观看| 一级毛片免费不卡| 亚洲毛片在线观看| 女人18毛片水最多免费观看| 色爽黄1000部免费软件下载| 亚洲欧洲日韩不卡| 日韩人妻无码免费视频一区二区三区| 免费看一级高潮毛片| 亚洲AV无码国产丝袜在线观看 | 国产免费69成人精品视频| 国产人成网在线播放VA免费| 亚洲福利在线观看| 在线精品免费视频无码的| free哆拍拍免费永久视频 | 亚洲国产天堂在线观看| 女人18毛片特级一级免费视频| 一级特黄录像视频免费| 亚洲精品动漫在线| 亚洲不卡无码av中文字幕| 8x8x华人永久免费视频|