版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、RMAN作為Oracle強大的備份恢復(fù)工具,可以協(xié)助我們恢復(fù)數(shù)據(jù)庫到指定時間點,這便是Oracle不完全恢復(fù)的一種體現(xiàn),通過這種方法可以找回我們曾經(jīng)丟失的數(shù)據(jù)。這里以找回誤TRUNCATE表數(shù)據(jù)為例給大家演示一下RMAN的不完全恢復(fù)功能。1.調(diào)整數(shù)據(jù)庫為歸檔模式ora10gsecdb /home/oracle$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.1.0 - Production on Wed Oct 19 22:10:38 2011Copyright (c) 1982, 2005, Oracle. All rights
2、 reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionssysora10g> archive log list;Database log mode No Archiv
3、e ModeAutomatic archival DisabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 73Current log sequence
4、; 77sysora10g> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.sysora10g> startup mount;ORACLE instance started.Total System Global Area 536870912 bytesFixed Size
5、60; 1220460 bytesVariable Size 318767252 bytesDatabase Buffers 209715200 bytesRedo Buffers
6、 7168000 bytesDatabase mounted.sysora10g> alter database archivelog;Database altered.sysora10g> alter database open;Database altered.2.使用RMAN對數(shù)據(jù)庫進行備份1)備份數(shù)據(jù)庫ora10gsecdb /home/oracle$ rman target /Recovery Manager: Release 10.2.0.1.0 -
7、Production on Wed Oct 19 22:16:17 2011Copyright (c) 1982, 2005, Oracle. All rights reserved.connected to target database: ORA10G (DBID=4067278754)RMAN> backup database;Starting backup at 20111019 22:16:35using target database control file instead of recovery catalogallocated channel: ORA_DI
8、SK_1channel ORA_DISK_1: sid=214 devtype=DISKchannel ORA_DISK_1: starting full datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupsetinput datafile fno=00010 name=/oracle/ora10gR2/oradata/ora10g/tbs_perf_01.dbfinput datafile fno=00003 name=/oracle/ora10gR2/oradata/ora10g/sysaux01.d
9、bfinput datafile fno=00001 name=/oracle/ora10gR2/oradata/ora10g/system01.dbfinput datafile fno=00002 name=/oracle/ora10gR2/oradata/ora10g/undotbs01.dbfinput datafile fno=00005 name=/home/oracle/tbs_sec_d_01.dbfinput datafile fno=00004 name=/oracle/ora10gR2/oradata/ora10g/tbs_local_01.dbfinput datafi
10、le fno=00008 name=/oracle/ora10gR2/oradata/ora10g/tbs01.dbfinput datafile fno=00009 name=/oracle/ora10gR2/oradata/ora10g/tbs_secooler_01.dbfinput datafile fno=00016 name=/u01/app/oracle/oradata/PROD/disk1/INDX_01.dbfinput datafile fno=00017 name=/u01/app/oracle/oradata/PROD/disk1/TOOLS_01.dbfinput d
11、atafile fno=00007 name=/oracle/ora10gR2/oradata/ora10g/undotbs_guarantee.dbfinput datafile fno=00006 name=/oracle/ora10gR2/oradata/ora10g/users.dbfchannel ORA_DISK_1: starting piece 1 at 20111019 22:16:36channel ORA_DISK_1: finished piece 1 at 20111019 22:17:41piece handle=/oracle/ora10gR2/flash_rec
12、overy_area/ORA10G/backupset/2011_10_19/o1_mf_nnndf_TAG20111019T221636_79xpy532_.bkp tag=TAG20111019T221636 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:01:05channel ORA_DISK_1: starting full datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupsetinput dataf
13、ile fno=00011 name=/u01/app/oracle/oradata/PROD/disk1/DATA01_01.dbfinput datafile fno=00012 name=/u01/app/oracle/oradata/PROD/disk2/DATA01_02.dbfinput datafile fno=00013 name=/u01/app/oracle/oradata/PROD/disk3/DATA01_03.dbfinput datafile fno=00014 name=/u01/app/oracle/oradata/PROD/disk4/DATA01_04.db
14、finput datafile fno=00015 name=/u01/app/oracle/oradata/PROD/disk5/DATA01_05.dbfchannel ORA_DISK_1: starting piece 1 at 20111019 22:17:42channel ORA_DISK_1: finished piece 1 at 20111019 22:17:45piece handle=/oracle/ora10gR2/flash_recovery_area/ORA10G/backupset/2011_10_19/o1_mf_nnndf_TAG20111019T22163
15、6_79xq067w_.bkp tag=TAG20111019T221636 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:03Finished backup at 20111019 22:17:45Starting Control File and SPFILE Autobackup at 20111019 22:17:45piece handle=/db_backup/rman_backup/c-4067278754-20111019-00 comment=NONEFinished Cont
16、rol File and SPFILE Autobackup at 20111019 22:17:482)查看備份信息RMAN> list backup;List of Backup Sets=BS Key Type LV Size Device Type Elapsed Time Completion Time- - - - - - -48 Full 1.10G
17、 DISK 00:00:57 20111019 22:17:33 BP Key: 47 Status: AVAILABLE Compressed: NO Tag: TAG20111019T221636 Piece Name: /oracle
18、/ora10gR2/flash_recovery_area/ORA10G/backupset/2011_10_19/o1_mf_nnndf_TAG20111019T221636_79xpy532_.bkp List of Datafiles in backup set 48 File LV Type Ckp SCN Ckp Time Name - - - - - - 1
19、 Full 6494715 20111019 22:16:36 /oracle/ora10gR2/oradata/ora10g/system01.dbf 2 Full 6494715 20111019 22:16:36 /oracle/ora10gR2/oradata/ora10g/undotbs01.dbf 3 Full
20、 6494715 20111019 22:16:36 /oracle/ora10gR2/oradata/ora10g/sysaux01.dbf 4 Full 6494715 20111019 22:16:36 /oracle/ora10gR2/oradata/ora10g/tbs_local_01.dbf 5 Full 6494715
21、 20111019 22:16:36 /home/oracle/tbs_sec_d_01.dbf 6 Full 6494715 20111019 22:16:36 /oracle/ora10gR2/oradata/ora10g/users.dbf 7 Full 6494715 20111019 22:16:36 /oracle/ora10gR2/
22、oradata/ora10g/undotbs_guarantee.dbf 8 Full 6494715 20111019 22:16:36 /oracle/ora10gR2/oradata/ora10g/tbs01.dbf 9 Full 6494715 20111019 22:16:36 /oracle/ora10gR2/oradata/ora10g/tbs
23、_secooler_01.dbf 10 Full 6494715 20111019 22:16:36 /oracle/ora10gR2/oradata/ora10g/tbs_perf_01.dbf 16 Full 6494715 20111019 22:16:36 /u01/app/oracle/oradata/PROD/disk1/INDX_01.dbf 17
24、0; Full 6494715 20111019 22:16:36 /u01/app/oracle/oradata/PROD/disk1/TOOLS_01.dbfBS Key Type LV Size Device Type Elapsed Time Completion Time- - - - - - -49 Full 1.02M&
25、#160; DISK 00:00:01 20111019 22:17:43 BP Key: 48 Status: AVAILABLE Compressed: NO Tag: TAG20111019T221636
26、60; Piece Name: /oracle/ora10gR2/flash_recovery_area/ORA10G/backupset/2011_10_19/o1_mf_nnndf_TAG20111019T221636_79xq067w_.bkp List of Datafiles in backup set 49 File LV Type Ckp SCN Ckp Time Name - - - - - -
27、60; 11 Full 6494738 20111019 22:17:42 /u01/app/oracle/oradata/PROD/disk1/DATA01_01.dbf 12 Full 6494738 20111019 22:17:42 /u01/app/oracle/oradata/PROD/disk2/DATA01_02.dbf 13
28、160; Full 6494738 20111019 22:17:42 /u01/app/oracle/oradata/PROD/disk3/DATA01_03.dbf 14 Full 6494738 20111019 22:17:42 /u01/app/oracle/oradata/PROD/disk4/DATA01_04.dbf 15 Full 6494738
29、60; 20111019 22:17:42 /u01/app/oracle/oradata/PROD/disk5/DATA01_05.dbfBS Key Type LV Size Device Type Elapsed Time Completion Time- - - - - - -50 Full 6.83M DISK &
30、#160; 00:00:00 20111019 22:17:45 BP Key: 49 Status: AVAILABLE Compressed: NO Tag: TAG20111019T221745 Piece Name: /db_backup/rman_backup/c-
31、4067278754-20111019-00 Control File Included: Ckp SCN: 6494743 Ckp time: 20111019 22:17:45 SPFILE Included: Modification time: 20111019 22:11:533.模擬數(shù)據(jù)庫故障表的誤TRUNCATE1)連接到數(shù)據(jù)庫的sec用戶ora10gsecdb /home/oracle$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.1.0 - Prod
32、uction on Wed Oct 19 22:20:57 2011Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionssysora10g> conn sec/oracle_1Connected.2)查看T表中的數(shù)據(jù)行數(shù)secora10g> selec
33、t count(*) from t; COUNT(*)- 1000此時T表中包含1000條數(shù)據(jù)。3)查看當前時間,以便后續(xù)使用RMAN進行恢復(fù)secora10g> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'Session altered.secora10g> select sysdate from dual;SYSDATE-2011-10-19 22:21:384)這里模擬對T表的誤刪除(DDL類型的TRUNCATE方法)s
34、ecora10g> truncate table t;Table truncated.secora10g> select sysdate from dual;SYSDATE-2011-10-19 22:22:05secora10g> select count(*) from t; COUNT(*)- 04.使用RMAN恢復(fù)到故障發(fā)生之前的時間點我們這里恢復(fù)的時間點的目標是T表被刪除之前的2011-10-19 22:21:38時刻。【重要提醒】在使用R
35、MAN完成基于時間點的不完全恢復(fù)之前,最好對現(xiàn)場做一個備份,我們這里只需要備份數(shù)據(jù)庫的控制文件和日志文件即可。當恢復(fù)結(jié)束后不滿足我們要求時,可以恢復(fù)控制文件和日志文件后重新進行恢復(fù)。1)將數(shù)據(jù)庫啟動到mount狀態(tài)secora10g> conn / as sysdbaConnected.sysora10g> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.sysora10g> startup mount;ORACLE instance started.Total
36、System Global Area 536870912 bytesFixed Size 1220460 bytesVariable Size 318767252 bytesDatabase Buffers
37、; 209715200 bytesRedo Buffers 7168000 bytesDatabase mounted.2)使用RMAN腳本恢復(fù)數(shù)據(jù)庫到指定時間點(1)恢復(fù)腳本如下run allocate channel c1 type disk;allocate channel c2 type disk;sql 'alter
38、session set nls_date_format="yyyy-mm-dd hh24:mi:ss"'set until time = '2011-10-19 22:21:38'restore database;recover database;alter database open resetlogs;(2)恢復(fù)過程記錄RMAN> run 2> allocate channel c1 type disk;3> allocate channel c2 type disk;4> sql 'alter session s
39、et nls_date_format="yyyy-mm-dd hh24:mi:ss"'5> set until time = '2011-10-19 22:21:38'6> restore database;7> recover database;8> alter database open resetlogs;using target database control file instead of recovery catalogallocated channel: c1channel c1: sid=211 devtyp
40、e=DISKallocated channel: c2channel c2: sid=210 devtype=DISKsql statement: alter session set nls_date_format="yyyy-mm-dd hh24:mi:ss"executing command: SET until clauseStarting restore at 20111019 22:31:04channel c1: starting datafile backupset restorechannel c1: specifying datafile(s) to re
41、store from backup setrestoring datafile 00001 to /oracle/ora10gR2/oradata/ora10g/system01.dbfrestoring datafile 00002 to /oracle/ora10gR2/oradata/ora10g/undotbs01.dbfrestoring datafile 00003 to /oracle/ora10gR2/oradata/ora10g/sysaux01.dbfrestoring datafile 00004 to /oracle/ora10gR2/oradata/ora10g/tb
42、s_local_01.dbfrestoring datafile 00005 to /home/oracle/tbs_sec_d_01.dbfrestoring datafile 00006 to /oracle/ora10gR2/oradata/ora10g/users.dbfrestoring datafile 00007 to /oracle/ora10gR2/oradata/ora10g/undotbs_guarantee.dbfrestoring datafile 00008 to /oracle/ora10gR2/oradata/ora10g/tbs01.dbfrestoring
43、datafile 00009 to /oracle/ora10gR2/oradata/ora10g/tbs_secooler_01.dbfrestoring datafile 00010 to /oracle/ora10gR2/oradata/ora10g/tbs_perf_01.dbfrestoring datafile 00016 to /u01/app/oracle/oradata/PROD/disk1/INDX_01.dbfrestoring datafile 00017 to /u01/app/oracle/oradata/PROD/disk1/TOOLS_01.dbfchannel
44、 c1: reading from backup piece /oracle/ora10gR2/flash_recovery_area/ORA10G/backupset/2011_10_19/o1_mf_nnndf_TAG20111019T221636_79xpy532_.bkpchannel c2: starting datafile backupset restorechannel c2: specifying datafile(s) to restore from backup setrestoring datafile 00011 to /u01/app/oracle/oradata/PROD/disk1/DATA01_01.dbfrestoring datafile 00012 to /u01/app/oracle/oradata/PROD/disk2/DATA01_02.dbfrestoring datafile 00013 to /u01/app/oracle/oradata/PROD/disk3/DATA01_03.dbfrestoring dataf
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 16家車企保價協(xié)議書范文范本
- 《計算機網(wǎng)絡(luò)安全防護技術(shù)(第二版)》 課件 第5章 任務(wù)5.2 MAC泛洪攻擊與防御
- 種公豬的這些飼養(yǎng)能提高產(chǎn)
- 職業(yè)技術(shù)學院《集裝箱運輸實務(wù)》課程標準
- 《核能行業(yè)網(wǎng)絡(luò)安全同行評估績效目標與準則》(征求意見稿)
- 智慧水庫管理平臺解決方案
- 班組三級安全培訓(xùn)試題附參考答案(輕巧奪冠)
- 新員工入職前安全培訓(xùn)試題答案考點精練
- 項目管理人員安全培訓(xùn)試題【必考】
- 公司安全管理人員安全培訓(xùn)試題答案典型題匯編
- 分離轉(zhuǎn)換性障礙護理課件
- 2025年中考語文(部編版)教材解析及備課策略 課件
- 2024年陜西神渭煤炭管道運輸有限責任公司招聘筆試參考題庫含答案解析
- 2024年園林施工行業(yè)發(fā)展預(yù)測分析
- 蔬菜水果配送應(yīng)急預(yù)案
- 自媒體在房地產(chǎn)行業(yè)中的推廣與營銷策略
- 醫(yī)學科研誠信相關(guān)行為規(guī)范學習與警示教育考核試卷
- 2024年云南紅河州紅投能源集團有限公司招聘筆試參考題庫含答案解析
- 小學書法課程教學大綱
- 設(shè)備維保的應(yīng)急預(yù)案與急救措施
- 《新能源汽車電機及控制系統(tǒng)檢修》教案-第3課-驅(qū)動電機(一)
評論
0/150
提交評論