


版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、rman 快速入門指南1. what is rman? 什么是 rman?32. terminology 專業(yè)詞匯解釋32.1. backup sets 備份集合32.2. backup pieces 備份片32.3. image copies 鏡像備份32.4. full backup sets 全備份集合32.5. incremental backup sets 增量備份集合32.6. file multiplexing42.7. recovery catalog resyncing 恢復(fù)名目同步43. the recovery catalog 恢復(fù)名目43.1. 恢復(fù)名目的概念43.2.
2、 建立恢復(fù)名目43.3. 使用恢復(fù)名目的優(yōu)勢(shì)54. starting rman 啟動(dòng) rman54.1. 使用不帶恢復(fù)名目的 rman64.2. 使用帶恢復(fù)名目的 rman64.3. 使用 rman65. 注冊(cè)或者注銷目標(biāo)數(shù)據(jù)庫65.1. 注冊(cè)目標(biāo)數(shù)據(jù)庫65.2. 注銷目標(biāo)數(shù)據(jù)庫76. 將已有的備份操作86.1. 加入名目數(shù)據(jù)庫86.2. 從名目數(shù)據(jù)庫中刪除87. 在非歸檔模式下備份97.1. 數(shù)據(jù)庫完全備份的例子97.2. 備份表空間的例子107.3. 備份單獨(dú)數(shù)據(jù)文件107.4. 備份數(shù)據(jù)文件117.5. 備份把握文件118. 歸檔模式下的備份118.1. backing up archi
3、ved logs 備份歸檔日志118.2. backing up the online logs 備份聯(lián)機(jī)日志129. incremental backups 增量備份139.1. level 0增量備份策略的基礎(chǔ)139.2. 使用增量備份的案例1310. recovery 恢復(fù)1410.1. database open,datafile deleted 數(shù)據(jù)庫打開時(shí),文件被刪除1410.2. complete restore (lost online redo) and rollforward- database closed完全還原(丟失聯(lián)機(jī)日志)并且前滾 - 數(shù)據(jù)庫關(guān)閉1410.3. r
4、estore of a subset of datafiles, complete recovery 還原數(shù)據(jù)文件的子集,完全恢復(fù)1511. scripts 腳本1512. corruption detection1613. channels 通道1614. report & list commands1714.1. list1714.2. report1715. 小提示181. what is rman? 什么是 rman?rman 可以用來備份和還原數(shù)據(jù)庫文件、歸檔日志和把握文件。它也可以用來執(zhí)行完全或不完全的數(shù)據(jù)庫恢復(fù)。留意:rman 不能用于備份初始化參數(shù)文件和口令文件。rma
5、n 啟動(dòng)數(shù)據(jù)庫上的 oracle 服務(wù)器進(jìn)程來進(jìn)行備份或還原。備份、還原、恢復(fù)是由這些進(jìn)程驅(qū)動(dòng)的。rman 可以由oem 的backup manager gui 來把握,但在本文章里不作重點(diǎn)爭(zhēng)辯。2. terminology 專業(yè)詞匯解釋2.1. backup sets 備份集合備份集合有下面的特性:Ø 包括一個(gè)或多個(gè)數(shù)據(jù)文件或歸檔日志Ø 以 oracle 專有的格式保存Ø 有一個(gè)完全的全部的備份片集合構(gòu)成Ø 構(gòu)成一個(gè)完全備份或增量備份2.2. backup pieces 備份片一個(gè)備份集由若干個(gè)備份片組成。每個(gè)備份片是一個(gè)單獨(dú)的輸出文件。一個(gè)備份片的大
6、小是有限制的;假如沒有大小的限制, 備份集就只由一個(gè)備份片構(gòu)成。備份片的大小不能大于使用的文件系統(tǒng)所支持的文件長(zhǎng)度的最大值。2.3. image copies 鏡像備份鏡像備份是獨(dú)立文件(數(shù)據(jù)文件、歸檔日志、把握文件)的備份。它很類似操作系統(tǒng)級(jí)的文件備份。它不是備份集或 備份片,也沒有被壓縮。2.4. full backup sets 全備份集合全備份是一個(gè)或多個(gè)數(shù)據(jù)文件中使用過的數(shù)據(jù)塊的的備份。沒有使用過的數(shù)據(jù)塊是不被備份的,也就是說,oracle 進(jìn)行備份集合的壓縮。2.5. incremental backup sets 增量備份集合增量備份是指?jìng)浞菀粋€(gè)或多個(gè)數(shù)據(jù)文件的自從上一次同一級(jí)別
7、的或更低級(jí)別的備份以來被修改過的數(shù)據(jù)塊。 與完全備份相同,增量備份也進(jìn)行壓縮。2.6. file multiplexing不同的多個(gè)數(shù)據(jù)文件的數(shù)據(jù)塊可以混合備份在一個(gè)備份集中。2.7. recovery catalog resyncing 恢復(fù)名目同步使用恢復(fù)治理器執(zhí)行 backup、copy、restore 或者 switch 命令時(shí),恢復(fù)名目自動(dòng)進(jìn)行更新,但是有關(guān)日志與歸檔日志信息沒有自動(dòng)記入恢復(fù)名目。需要進(jìn)行名目同步。使用resync catalog 命令進(jìn)行同步。rman>resync catalog;rman-03022:正在編譯命令:resync rman-03023:正在執(zhí)
8、行命令:resyncrman-08002:正在啟動(dòng)全部恢復(fù)名目的 resync rman-08004:完成全部 resync3. the recovery catalog 恢復(fù)名目3.1. 恢復(fù)名目的概念恢復(fù)名目是由rman 使用、維護(hù)的用來放置備份信息的倉(cāng)庫。rman 利用恢復(fù)名目記載的信息去推斷如何執(zhí)行需要的備份恢復(fù)操作?;謴?fù)名目可以存在于oracle 數(shù)據(jù)庫的方案中。雖然恢復(fù)名目可以用來備份多個(gè)數(shù)據(jù)庫,建議為恢復(fù)名目數(shù)據(jù)庫創(chuàng)建一個(gè)單獨(dú)的數(shù)據(jù)庫。恢復(fù)名目數(shù)據(jù)庫不能使用恢復(fù)名目備份自身。3.2. 建立恢復(fù)名目第一步,在名目數(shù)據(jù)庫中創(chuàng)建恢復(fù)名目所用表空間:sql> create tabl
9、espace rman_ts datafile ”d:oracleoradatarmanrman_ts.dbf” size 20m;表空間已創(chuàng)建。其次步,在名目數(shù)據(jù)庫中創(chuàng)建rman 用戶并授權(quán):sql> create user rman identified by rman default tablespace rman_ts temporary tablespace temp quota unlimited on rman_ts;用戶已創(chuàng)建。sql> grant recovery_catalog_owner to rman ;授權(quán)成功。sql> grant connect,
10、 resource to rman ;授權(quán)成功。第三步,在名目數(shù)據(jù)庫中創(chuàng)建恢復(fù)名目c:>rman catalog rman/rman恢復(fù)治理器:版本 8.1.6.0.0 - production rman-06008:連接到恢復(fù)名目數(shù)據(jù)庫rman-06428:未安裝恢復(fù)名目rman>create catalog tablespace rman_ts;rman-06431:恢復(fù)名目已創(chuàng)建留意:雖然使用rman 不肯定必需恢復(fù)名目,但是推舉使用。由于恢復(fù)名目記載的信息大部分可以通過把握文件來記載,rman 在恢復(fù)數(shù)據(jù)庫時(shí)使用這些信息。不使用恢復(fù)名目將會(huì)對(duì)備份恢復(fù)操作有限制。3.3. 使
11、用恢復(fù)名目的優(yōu)勢(shì)Ø 可以存儲(chǔ)腳本;Ø 記載較長(zhǎng)時(shí)間的備份恢復(fù)操作;4. starting rman 啟動(dòng) rmanrman 為交互式命令行處理界面,也可以從企業(yè)治理器中運(yùn)行。為了使用下面的實(shí)例,先檢查環(huán)境符合:Ø the target database is called “his“ and has the same tns aliasØ user rman has been granted “recovery_catalog_owner “privilegesØ 目標(biāo)數(shù)據(jù)庫的連接用戶為internal 帳號(hào),或者以其他sysdba 類型帳號(hào)連
12、接Ø the recovery catalog database is called “rman“ and has the same tns aliasØ the schema containing the recovery catalog is “rman“ (same password)在使用rman 前,設(shè)置nls_date_format 和 nls_lang 環(huán)境變量,很多rman list 命令的輸出結(jié)果是與日期時(shí)間相關(guān)的,這點(diǎn)在用戶期望執(zhí)行以時(shí)間為基準(zhǔn)的恢復(fù)工作也很重要。下例是環(huán)境變量的示范:nls_lang= simplified chinese_china.
13、zhs16gbk nls_date_format=dd-mon-yyyy hh24:mi:ss為了保證 rman 使用時(shí)能連接恢復(fù)名目,恢復(fù)名目數(shù)據(jù)庫必需打開,目標(biāo)數(shù)據(jù)庫至少要 started(unmount),否則 rman 會(huì)返回一個(gè)錯(cuò)誤,目標(biāo)數(shù)據(jù)庫必需置于歸檔模式下。4.1. 使用不帶恢復(fù)名目的 rman設(shè)置目標(biāo)數(shù)據(jù)庫的 oracle_sid ,執(zhí)行:% rman nocatalog rman> connect targetrman> connect target internal/<password>his4.2. 使用帶恢復(fù)名目的 rman% rman rma
14、n_ts rman/rmanrman rman> connect target% rman rman_ts rman/rmanrman target internal/<password>his4.3. 使用 rman一旦連接到目標(biāo)數(shù)據(jù)庫,可以通過交互界面或者事先存儲(chǔ)的腳本執(zhí)行指定rman 命令, 下面是一個(gè)使用rman 交互界面的實(shí)例:rman> resync catalog;rman-03022:正在編譯命令:resync rman-03023:正在執(zhí)行命令:resyncrman-08002:正在啟動(dòng)全部恢復(fù)名目的 resync rman-08004:完成全部 re
15、sync使用腳本的實(shí)例:rman> execute script alloc_1_disk;創(chuàng)建或者替代存儲(chǔ)的腳本:rman> replace script alloc_1_disk 2> allocate channel d1 type disk; 3> 5. 注冊(cè)或者注銷目標(biāo)數(shù)據(jù)庫5.1. 注冊(cè)目標(biāo)數(shù)據(jù)庫數(shù)據(jù)庫狀態(tài):Ø 恢復(fù)名目狀態(tài):打開Ø 目標(biāo)數(shù)據(jù)庫:加載或者打開目標(biāo)數(shù)據(jù)庫在第一次使用rman 之前必需在恢復(fù)名目中注冊(cè):第一步,啟動(dòng)恢復(fù)治理器,并且連接目標(biāo)數(shù)據(jù)庫: c:>rman target internal/oraclehis cat
16、alog rman/rmanrman 恢復(fù)治理器:版本 8.1.6.0.0 - productionrman-06005:連接到目標(biāo)數(shù)據(jù)庫:his (dbid=3021445076)rman-06008:連接到恢復(fù)名目數(shù)據(jù)庫其次步,注冊(cè)數(shù)據(jù)庫:rman> register database;rman-03022:正在編譯命令:register rman-03023:正在執(zhí)行命令:register rman-08006:注冊(cè)在恢復(fù)名目中的數(shù)據(jù)庫rman-03023:正在執(zhí)行命令:full resyncrman-08002:正在啟動(dòng)全部恢復(fù)名目的resync rman-08004:完成全部r
17、esync5.2. 注銷目標(biāo)數(shù)據(jù)庫rman 供應(yīng)了一個(gè)注銷工具,叫 dbms_rcvcat 工具包,請(qǐng)留意一旦注銷了該目標(biāo)數(shù)據(jù)庫,就不行以使用恢復(fù)名目中含有的備份集來恢復(fù)數(shù)據(jù)庫了。為了能注銷數(shù)據(jù)庫,需要獲得數(shù)據(jù)庫的標(biāo)識(shí)碼(db_id)和數(shù)據(jù)庫鍵值(db_key)。其中連接目標(biāo)數(shù)據(jù)庫時(shí)將會(huì)獲得db_id。c:>rman target internal/oraclehis catalog rman/rmanrman恢復(fù)治理器:版本 8.1.6.0.0 - productionrman-06005:連接到目標(biāo)數(shù)據(jù)庫:his (dbid=3021445076)rman-06008:連接到恢復(fù)名目
18、數(shù)據(jù)庫其中dbid=3021445076,利用dbid=3021445076 查詢數(shù)據(jù)庫鍵值碼: 連接到目標(biāo)數(shù)據(jù)庫,查詢db 表:sql> select * from db;db_keydb_idcurr_dbinc_key130214450762獲得 db_key1,這樣,該目標(biāo)數(shù)據(jù)庫 db_key1,dbid=3021445076,利用兩個(gè)值使用dbms_rcvcat工具包就可以注銷數(shù)據(jù)庫:sql> execute dbms_rcvcat.unregisterdatabase(1,3021445076);pl/sql 過程已成功完成。至此,注銷數(shù)據(jù)庫操作完成。6. 將已有的備份
19、操作6.1. 加入名目數(shù)據(jù)庫數(shù)據(jù)庫狀態(tài):Ø 恢復(fù)名目:打開Ø 目標(biāo)數(shù)據(jù)庫:加載或者打開假如存在 8.x 版本以前創(chuàng)建的備份數(shù)據(jù)想注冊(cè)到目標(biāo)數(shù)據(jù)庫,可以接受如下手工方式加入到恢復(fù)名目中,rman> catalog datafilecopy ”/oracle/system01.dbf”;使用如下命令顯示恢復(fù)名目中包含的文件rman> list copy of database;6.2. 從名目數(shù)據(jù)庫中刪除第一步:查看備份信息:rman>list backup;rman-03022:正在編譯命令:list備份集列表關(guān)鍵字recid標(biāo)記lv集合標(biāo)記集合計(jì)數(shù)完成時(shí)間
20、110425013644550501364446206-8 月 -03備份段列表關(guān)鍵字 pc# cp# 狀態(tài)完成時(shí)間段名110611available06-8 月 -03d:oracleora81database02eu4dmu_1_1數(shù)據(jù)文件包括列表文件 名稱lv 類型 檢查點(diǎn) scn檢查點(diǎn)時(shí)間3d:oracleoradatahisusers01.dbf0full 16005206-8 月 -03備份集的關(guān)鍵字為 1104。其次步:定義delete 通道:rman>allocate channel for delete type disk;rman-03022:正在編譯命令:alloc
21、ate rman-03023:正在執(zhí)行命令:allocate rman-08030:安排的通道:deleterman-08500:通道 delete:sid=19 devtype=disk第三步:刪除backupset 備份集rman>change backupset 1104 delete;rman-03022:正在編譯命令:change rman-08073:已刪除備份段rman-08517 : 備 份 段handle=d:oracleora81database02eu4dmu_1_1recid=2 stamp=50 1364447rman-03023:正在執(zhí)行命令:partial
22、resyncrman-08003:?jiǎn)?dòng)部分恢復(fù)名目的 resync rman-08005:完成部分 resync留意:部分執(zhí)行刪除備份集、備份片或者維護(hù)恢復(fù)名目的命令,需要先指定通道,如:rman>allocate channel for delete type disk;或者rman>allocate channel for maintenance type disk;7. 在非歸檔模式下備份數(shù)據(jù)庫狀態(tài):Ø 恢復(fù)名目: 打開Ø 目標(biāo)數(shù)據(jù)庫:例程啟動(dòng)或者數(shù)據(jù)庫加載恢復(fù)名目數(shù)據(jù)庫需要打開,目標(biāo)數(shù)據(jù)庫必需啟動(dòng)(或者加載)。由于目標(biāo)數(shù)據(jù)庫不在歸檔模式下,所以當(dāng)進(jìn)行備份
23、恢復(fù)操作的時(shí)候數(shù)據(jù)庫無法打開。不行以將表空間置于熱備份模式上進(jìn)行等同于文件系統(tǒng)級(jí)的拷貝,假如在非歸檔模式,數(shù)據(jù)庫打開的狀態(tài)下不能進(jìn)行數(shù)據(jù)文件的備份。7.1. 數(shù)據(jù)庫完全備份rman> run 2> # backup the complete database to disk 3> allocate channel dev1 type disk;4> backup5>full6>tag full_db_backup7>format ”/oracle/backups/db_t%t_s%s_p%p”8>(database);9> release
24、channel dev1; 10> 行#2: 表明該行為注釋行(是注釋符)3&9: see section 15 channels 通道定義5: full backup (default if full or incremental not specified)完全備份模式(缺省模式) 6: meaningful string (<=30 chars)(備份集標(biāo)識(shí),<30 個(gè)字符)7: filename to use for backup pieces, including substitution variables.備份片使用的文件名,可以包含代替變量。8: in
25、dicates all files including controlfiles are to be backed up 表明備份全部數(shù)據(jù)文件包括把握文件通過下面的命令顯示恢復(fù)名目中記載的備份集信息:rman> list backupset of database;7.2. 備份表空間rman> run 2> allocate channel dev1 type disk; 3> backup4>tag tbs_users_read_only5>format ”/oracle/backups/tbs_users_t%t_s%s”6>(tablespac
26、e users)7> 使用下列命令來顯示恢復(fù)名目中該表的備份信息:rman> list backupset of tablespace users;假設(shè)users 表空間在備份后被置為read only 表空間,以后的全庫備份就可以不用備份該表空間,為了達(dá)到這個(gè)目的,可以在以后的備份中指定”skip readonly”。留意,目標(biāo)數(shù)據(jù)庫不需要肯定打開,只要加載就可以,由于表空間的信息存儲(chǔ)在把握文件中。7.3. 備份單獨(dú)數(shù)據(jù)文件rman> run 2> allocate channel dev1 type ”sbt_tape”; 3> backup4>form
27、at ”%d_%u”5>(datafile ”/oracle/dbs/sysbigdb.dbf”); 6> release channel dev1;7> 行#2: 使用mml(media manager layer)安排磁帶驅(qū)動(dòng)器,必需指定類型為sbt_tape;留意由于沒有指定標(biāo)識(shí),所以標(biāo)識(shí)為空;使用下面的命令顯示恢復(fù)名目中備份的表空間:rman> list backupset of datafile 1;7.4. 備份數(shù)據(jù)文件rman> run 2> allocate channel dev1 type ”sbt_tape”;3> copydat
28、afile”/oracle/dbs/temp.dbf”to ”/oracle/backups/temp.dbf”;4> release channel dev1; 5> 使用下面的命令顯示恢復(fù)名目中的文件拷貝:rman> list copy of datafile ”/oracle/dbs/temp.dbf”;拷貝數(shù)據(jù)文件和備份數(shù)據(jù)文件是不一樣的,數(shù)據(jù)文件拷貝是一個(gè)該文件的鏡像。文件的備份產(chǎn)生一個(gè)備份集。7.5. 備份把握文件rman> run 2> allocate channel dev1 type ”sbt_tape”; 3> backup4>f
29、ormat ”cf_t%t_s%s_p%p”5>tag cf_monday_night6>(current controlfile); 7> release channel dev1;8> 留意:數(shù)據(jù)庫完全備份將自動(dòng)備份把握文件。8. 歸檔模式下的備份數(shù)據(jù)庫狀態(tài):恢復(fù)名目:打開目標(biāo)數(shù)據(jù)庫:例程啟動(dòng),數(shù)據(jù)庫加載或者打開備份操作使用的命令與非歸檔模式下基本一樣。8.1. backing up archived logs 備份歸檔日志下面的腳本備份歸檔日志:rman> run 2> allocate channel dev1 type disk; 3> ba
30、ckup4>format ”/oracle/backups/log_t%t_s%s_p%p”5>(archivelog all); 6> release channel dev1; 7> 下面的腳本歸檔日志從# 90 to 100:rman> run 2> allocate channel dev1 type disk; 3> backup4>format ”/oracle/backups/log_t%t_s%s_p%p”5>(archivelog from logseq=90 until logseq=100 thread 1); 6&g
31、t; release channel dev1;7> 下面的腳本備份在 24 小時(shí)內(nèi)產(chǎn)生的歸檔日志,在備份完成后會(huì)自動(dòng)刪除歸檔日志。假如備份失敗,歸檔日志不會(huì)被刪除。rman> run 2> allocate channel dev1 type disk; 3> backup4>format ”/oracle/backups/log_t%t_s%s_p%p”5>(archivelog from time ”sysdate-1” all delete input); 6> release channel dev1;7> 使用下面的命令顯示恢復(fù)名目中
32、的歸檔日志:rman> list backupset of archivelog all;留意:rman 找到歸檔日志后會(huì)備份指定日志,假如無法找到日志,它也不會(huì)返回錯(cuò)誤信息。8.2. backing up the online logs 備份聯(lián)機(jī)日志聯(lián)機(jī)日志不能用rman 來備份,必需先將其歸檔。為了實(shí)現(xiàn)這點(diǎn),必需在rman 中執(zhí)行如下sql 語句:rman> run 2> allocate channel dev1 type disk;3> sql “alter system archive log current“; 4> backup5>format
33、 ”/oracle/backups/log_t%t_s%s_p%p”6>(archivelog from time ”sysdate-1” all delete input); 7> release channel dev1;8> 上面的腳本可以在執(zhí)行完一個(gè)完整的聯(lián)機(jī)數(shù)據(jù)庫備份后執(zhí)行,確保全部的重做日志可以將數(shù)據(jù)庫恢復(fù)到一個(gè)全都性的狀態(tài)。留意:不行以標(biāo)識(shí)歸檔日志備份集。9. incremental backups 增量備份n 級(jí)別增量備份備份從最近的n 級(jí)別或者更小級(jí)別以來的全部更改過的數(shù)據(jù)塊內(nèi)容。增量備份分為兩種,一種是累積增量備份,一種是非累積增量備份。Ø 累積
34、增量備份包括自最終一次在更低級(jí)別進(jìn)行備份以來全部改動(dòng)過的數(shù)據(jù)塊。Ø 非累積增量備份包括自前一次在同級(jí)或者更低級(jí)別進(jìn)行備份以來改動(dòng)過的數(shù)據(jù)塊。9.1. level 0增量備份策略的基礎(chǔ)level 0 是增量備份策略的基礎(chǔ)the basis of the incremental backup strategyrman> run 2> allocate channel dev1 type disk; 3> backup4>incremental level 05>filesperset 46>format ”/oracle/backups/sunday_
35、level0_%t”7>(database);8> release channel dev1; 9> line# 4: 0 級(jí)備份5: 定義每個(gè)backupset 的最大文件數(shù)使用 list 語句查看,數(shù)據(jù)庫備份集的列表顯示中, ”type” 將顯示 ”incremental”,”lv”列將顯示”0” 。9.2. 使用增量備份的案例一個(gè)典型的增量備份案例如下:Ø 星期天晚上 - level 0 backup performedØ 星期一晚上 - level 2 backup performedØ 星期二晚上 - level 2 backup pe
36、rformedØ 星期三晚上 - level 1 backup performedØ 星期四晚上 - level 2 backup performedØ 星期五晚上 - level 2 backup performedØ 星期六晚上 - level 2 backup performedØ 星期天晚上 - level 0 backup performed10. recovery 恢復(fù)恢復(fù)案例如下:10.1. database open,datafile deleted 數(shù)據(jù)庫打開時(shí),文件被刪除數(shù)據(jù)文件在數(shù)據(jù)庫打開時(shí)被刪除。有兩種方法可以對(duì)打開的數(shù)
37、據(jù)庫進(jìn)行恢復(fù):還原數(shù)據(jù)文件或者表空間。下面兩個(gè)實(shí)例顯示了該方法:(a) datafile recovery 數(shù)據(jù)文件恢復(fù)rman> run 2>allocate channel dev1type disk;3>sql “alter tablespaceusers offline immediate“;4>restore datafile 4;5>recover datafile 4;6>sql “alter tablespaceusers online“;7>release channel dev1;8>(b) tablespace recove
38、ry 表空間恢復(fù)rman> run 2> allocate channel dev1 type disk;3> sql “alter tablespace users offline immediate“; 4> restore tablespace users;5> recover tablespace users;6> sql “alter tablespace users online“; 7> release channel dev1;8> 留意:假如還原系統(tǒng)表空間文件,數(shù)據(jù)庫必需關(guān)閉,由于系統(tǒng)表空間不行以脫機(jī)。10.2. complet
39、e restore (lost online redo) and rollforward - database closed 完全還原(丟失聯(lián)機(jī)日志) 并且前滾 - 數(shù)據(jù)庫關(guān)閉rman> run 2> allocate channel dev1 type disk; 3> set until logseq=105 thread=1;4> restore controlfile to ”/oracle/dbs/ctrltargdb.ctl”;5> replicate controlfile from ”/oracle/dbs/ctrltargdb.ctl”; 6&g
40、t; restore database;7> sql “alter database mount“; 8> recover database;9> sql “alter database open resetlogs“; 10> release channel dev1;11> notes:”set until” 命令指明恢復(fù)到指定的日志文件。這一點(diǎn)在數(shù)據(jù)文件恢復(fù)時(shí)很重要,否則rman 將試圖恢復(fù)最近的數(shù)據(jù)文件,該數(shù)據(jù)文件可能在指定的日志以前。”replicate controlfile” 復(fù)制還原的把握文件到init.ora 指定的把握文件。假如數(shù)據(jù)庫使用wit
41、h resetlogs 打開,則需要使用reset database命令注冊(cè)轉(zhuǎn)變后的數(shù)據(jù)庫。在使用 resetlogs 命令打開數(shù)據(jù)庫后猛烈建議做一個(gè)完全的數(shù)據(jù)庫備份。10.3. restore of a subset of datafiles, complete recovery 還原數(shù)據(jù)文件的子集,完全恢復(fù)rman> run 2> allocate channel dev1 type disk; 3> sql “alter database mount“;4> restore datafile 2;5> restore datafile 3;6> res
42、tore archivelog all; 7> recover database;8> sql “alter database open“; 9> release channel dev1;10> 11. scripts腳本創(chuàng)建或者取代腳本:rman> create script alloc_disk 2># allocates one disk3>allocate channel dev1 type disk;4>setlimit channel dev1 kbytes 2097150maxopenfiles 32readrate200;5&g
43、t;rman> replace script rel_disk 2> # releases disk3> release channel dev1; 5> rman> replace script backup_db_full 2> # performs a complete backup3> execute script alloc_disk; 4> backup5> .<backup commands here> 6> execute script rel_disk; 7> 前兩個(gè)腳本分別用來安排和回收通道。al
44、loc_disk 腳本還額外指定了備份片的最大兆字節(jié)數(shù),備份時(shí)可以同時(shí)打開的輸入文件的最大數(shù)目,以及每秒鐘讀每個(gè)輸入文件的數(shù)據(jù)緩沖區(qū)的最大數(shù)目。第三個(gè)腳本調(diào)用從前存儲(chǔ)的兩個(gè)腳本進(jìn)行數(shù)據(jù)庫備份。運(yùn)行存儲(chǔ)腳本的示范:rman> run 2> execute script backup_db_full; 3> 留意:存儲(chǔ)的腳本必需在 . execute <script>命令中調(diào)用。12. corruption detectionrman 可以備份包含損壞數(shù)據(jù)塊的數(shù)據(jù)文件,查詢視圖v$back_corruption 和v$copy_corruption 可以獲得有關(guān)壞數(shù)據(jù)的信息。通過設(shè)置 set maxcorrupt 可以跳過指定個(gè)數(shù)的壞塊來避開備份失敗。rman> replace script backup_db_full 2> # performs a complete backup3> execute sc
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度健康醫(yī)療大數(shù)據(jù)預(yù)付款全新合作協(xié)議
- 二零二五年度幼兒園保育員聘用合同書-幼兒教育創(chuàng)新項(xiàng)目合作
- 二零二五年度環(huán)保咨詢服務(wù)營(yíng)業(yè)執(zhí)照轉(zhuǎn)讓合同
- 二零二五年度一手房購(gòu)房意向金預(yù)定合同
- 2025年度有限責(zé)任公司股東離任協(xié)議書
- 二零二五年度拆除房屋及土地回收合同范本
- 二零二五年度學(xué)校食堂承包經(jīng)營(yíng)與服務(wù)滿意度提升協(xié)議
- 二零二五年度離職后商業(yè)秘密保護(hù)及競(jìng)業(yè)限制合同
- 二零二五年度房屋維修安全責(zé)任保險(xiǎn)協(xié)議
- 二零二五年度美容院養(yǎng)生保健入股合同協(xié)議
- 家具公司合伙協(xié)議
- DL5000-火力發(fā)電廠設(shè)計(jì)技術(shù)規(guī)程
- 《醫(yī)德醫(yī)風(fēng)學(xué)習(xí)記錄》
- 羊水穿刺的委托書
- 爆破飛石控制措施
- 2024年新疆生產(chǎn)建設(shè)兵團(tuán)興新職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)適應(yīng)性測(cè)試題庫必考題
- (高清版)JTGT M72-01-2017 公路隧道養(yǎng)護(hù)工程預(yù)算定額
- DZ∕T 0130.6-2006 地質(zhì)礦產(chǎn)實(shí)驗(yàn)室測(cè)試質(zhì)量管理規(guī)范 第6部分:水樣分析(正式版)
- 2024年遼寧生態(tài)工程職業(yè)學(xué)院?jiǎn)握新殬I(yè)適應(yīng)性測(cè)試題庫一套
- 摩托車科目一題庫-共400題(附答案)
- 第一節(jié)-原核生物與真核生物DNA的復(fù)制課件
評(píng)論
0/150
提交評(píng)論