Sunday, October 10, 2010

RMAN Beginners Guide


RMAN Beginners Guide
RMAN (Recovery Manager) is a DBA is an important tool for backup, restore and recovery oracle database, to find some time ago that someone I have to, unfortunately do not have time, take this two-day business trip is no issue, and wrote a bit for Beginner's friends reference. This article describes the basic operation of RMAN more information, see "Oracle8i Backup & Recovery Guide" and the RMAN manual, or OCP Student Guide M09096 "Backup and Recovery Workshop" Volume 2, can also gototop@vip.sina. com and contact me. Examples of Oracle's own reference to $ ORACLE_HOME / rdbms / demo directory of the *. rcv scripts.

1, RMAN Introduction

RMAN can be used to backup and restore database files, archive logs and control files can also be used to perform complete or incomplete database recovery. RMAN has three different user interfaces: COMMAND LINE mode, GUI mode (integrated in the OEM in the Backup Manager), API methods (for integration into third-party backup software). Has the following characteristics:

1) The function similar to the physical backup, but N-fold stronger than the physical backup, you can see from the following features;
2) can be compressed air block;
3) can be realized at the block level incremental;
4) the output can be packaged into a backup backup set, you can also partition a fixed size of the backup set;
5) backup and recovery process can be automated management;
6) You can use the script (there Recovery catalog in)
7) can be done to monitor bad blocks

Second, explanation of related terms

1) Backup sets the backup set

Backup set is a backup set name implies, it contains all the backup of this backup piece to oracle proprietary format. According to a backup set backup types, may constitute a full backup or incremental backup.

2) Backup pieces backup discs

A backup set consists of a number of backup slices. Each backup piece is a separate output file. A backup piece size is limited; If there is no size limit, the backup set will constitute only one backup piece. Backup pieces can not be larger than the size of your file system supports file size maximum.

3) Image copies image backup

Image backup is not compressed, not packaged, direct COPY independent files (data files, archive logs, control file), similar to the operating system level file backup. And only COPY to disk, not to the tape.

Incremental backups as Grade 0, normal to the backup control file.

4) Full backup Full backup

Full backup is the data file used to back up data blocks, data blocks not used and do not do a backup, that is, RMAN backup is compressed.

5) Incremental backup incremental backups

Incremental backup is the backup data file since the last time the same level or lower-level backup of the data has been modified block. The same with the full backup, incremental backups are compressed.

Although the concept of good incremental backup, the backup is also very simple, but to restore them is another matter, not only cumbersome and error-prone, so less and less practical use to the Oracle 9i has recommended not to use, future versions will gradually Cancellation of the incremental backup.

6) Recovery catalog recovery List

RMAN recovery catalog to record the control information using the process to restore directory should always be synchronized (this will be mentioned later). Although we can use nocatalog way to use RMAN, then the control information recorded in the target database control file, but after all this insecurity, because once the target database control file corruption means that all of the RMAN backup failure. The same recovery catalog should be created in another database, in the example below, we call the "catalog database."

Third, create a recovery catalog

1, in the catalog database recovery catalog is used to create the table space

SQL> create tablespace rmants datafile ''c:oracleoradataccrmants.ora'' size 20M ;

琛ㄧ┖闂村凡鍒涘缓銆?br />
2銆佸湪鐩綍鏁版嵁搴撲腑鍒涘缓RMAN鐢ㄦ埛骞舵巿鏉?br />
SQL> create user rman identified by rman default tablespace rmants temporary tablespace temp quota unlimited on rmants;

鐢ㄦ埛宸插垱寤?br />
SQL> grant recovery_catalog_owner to rman ;

鎺堟潈鎴愬姛銆?br />
3銆佸湪鐩綍鏁版嵁搴撲腑鍒涘缓鎭㈠鐩綍

C:>rman catalog rman/rman

鎭㈠绠$悊鍣細鐗堟湰8.1.7.0.0 - Production

RMAN-06008锛氳繛鎺ュ埌鎭㈠鐩綍鏁版嵁搴?br />RMAN-06428锛氭湭瀹夎鎭㈠鐩綍

RMAN>create catalog tablespace rmants;

RMAN-06431锛氭仮澶嶇洰褰曞凡鍒涘缓


4銆佹敞鍐岀洰鏍囨暟鎹簱鍒版仮澶嶇洰褰?br />
娉ㄦ剰鍝︼紝杩欓噷鎴戠殑鐩爣鏁版嵁搴撲娇鐢ㄧ殑鏈嶅姟鍚嶇О鏄痳man锛屾剰鎬濅负瑕佷娇鐢≧MAN杩涜澶囦唤鐨勬暟鎹簱锛岃?鐩綍鏁版嵁搴撲娇鐢ㄧ殑鏈嶅姟鍚嶇О鏄疌C銆?br />
C:>rman target sys/sys@rman

鎭㈠绠$悊鍣細鐗堟湰8.1.7.0.0 - Production

RMAN-06005锛氳繛鎺ュ埌鐩爣鏁版嵁搴擄細RMAN (DBID=1303772234)

RMAN>connect catalog rman/rman@cc

RMAN-06008锛氳繛鎺ュ埌鎭㈠鐩綍鏁版嵁搴?br />
RMAN>register database;

RMAN-03022锛氭鍦ㄧ紪璇戝懡浠わ細register
RMAN-03023锛氭鍦ㄦ墽琛屽懡浠わ細register
RMAN-08006锛氭敞鍐屽湪鎭㈠鐩綍涓殑鏁版嵁搴?br />RMAN-03023锛氭鍦ㄦ墽琛屽懡浠わ細full resync
RMAN-08002锛氭鍦ㄥ惎鍔ㄥ叏閮ㄦ仮澶嶇洰褰曠殑 resync
RMAN-08004锛氬畬鎴愬叏閮?resync

濂戒簡锛屽埌姝や负姝㈠墠闈㈢殑鍑嗗宸ヤ綔閮藉仛濂戒簡锛屼笅闈㈠氨鍙互浣跨敤RMAN鏉ヨ繘琛屽浠藉拰鎭㈠浜嗐?

鍥涖?浣跨敤RMAN

涓嬮潰閫氳繃鍏蜂綋鐨勪緥瀛愭潵璇存槑RMAN鐨勪娇鐢紝杩欓噷浼氭秹鍙婂埌闄や簡鎭㈠浠ュ鐨勬墍鏈塕MAN鎿嶄綔锛屽叧浜庝娇鐢≧MAN杩涜鎭㈠鐨勫唴瀹硅鍙傝?鎴戜互鍓嶅啓鐨勫彟澶栦竴绡囨枃绔狅細RMAN鎭㈠瀹炶返銆?br />
1銆佸浠芥暣涓暟鎹簱

RMAN>run {
2> allocate channel c1 type disk;
3> backup database format ''e:dbbackup2db.dmp'';
4> }

2銆佸鍒舵暟鎹枃浠?br />
RMAN>run {
2> allocate channel c1 type disk;
3> copy datafile ''c:oracleoradatarmanusers01.dbf'' to ''e:dbbackupu.dbf'' tag
=u1215;
4> }

3銆佹煡鐪嬪浠藉強澶嶅埗鐨勪俊鎭?br />
RMAN>list backup;

RMAN-03022锛氭鍦ㄧ紪璇戝懡浠わ細list

澶囦唤闆嗗垪琛?br />鍏抽敭瀛椔犅犅犅?Recid聽聽聽聽聽 鏍囪聽聽聽 LV聽 闆嗗悎鏍囪聽聽 闆嗗悎璁℃暟聽聽聽 瀹屾垚鏃堕棿
------- ---------- ---------- -- ---------- ---------- ----------------------
216聽聽聽聽 1聽聽聽聽聽聽聽聽聽 417347013聽 0聽 417346992聽 1聽聽聽聽聽聽聽聽聽 26-12鏈?00

聽聽 澶囦唤娈靛垪琛?br />聽聽 鍏抽敭瀛椔?Pc# Cp# 鐘舵?聽聽聽聽聽聽聽 瀹屾垚鏃堕棿聽聽聽聽聽聽聽聽聽聽聽聽聽聽 娈靛悕
聽聽 ------- --- --- ----------- ---------------------- ------------------------
聽聽 217聽聽聽聽 1聽聽 1聽聽 AVAILABLE聽聽 26-12鏈?00聽聽聽聽聽聽聽聽聽聽聽聽 E:DBBACKUP2DB.DMP

聽聽 鏁版嵁鏂囦欢鍖呮嫭鍒楄〃
聽聽 鏂囦欢 鍚嶇О聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 LV 绫诲瀷 妫?煡鐐筍CN聽 妫?煡鐐规椂闂?br />聽聽 ---- ------------------------------------- -- ---- ---------- -------------
聽聽 1聽聽聽 C:ORACLEORADATARMANSYSTEM01.DBF聽聽 0聽 Full 33224聽聽聽聽聽 26-12鏈?00
聽聽 2聽聽聽 C:ORACLEORADATARMANRBS01.DBF聽聽聽聽聽 0聽 Full 33224聽聽聽聽聽 26-12鏈?00
聽聽 3聽聽聽 C:ORACLEORADATARMANUSERS01.DBF聽聽聽 0聽 Full 33224聽聽聽聽聽 26-12鏈?00
聽聽 4聽聽聽 C:ORACLEORADATARMANTEMP01.DBF聽聽聽聽 0聽 Full 33224聽聽聽聽聽 26-12鏈?00
聽聽 5聽聽聽 C:ORACLEORADATARMANTOOLS01.DBF聽聽聽 0聽 Full 33224聽聽聽聽聽 26-12鏈?00
聽聽 6聽聽聽 C:ORACLEORADATARMANINDX01.DBF聽聽聽聽 0聽 Full 33224聽聽聽聽聽 26-12鏈?00

RMAN>list copy of datafile ''c:oracleoradatarmanusers01.dbf'';

RMAN-03022锛氭鍦ㄧ紪璇戝懡浠わ細list

鏁版嵁鏂囦欢澶囦唤鍒楄〃
鍏抽敭瀛椔?鏂囦欢鐘舵? 瀹屾垚鏃堕棿聽聽聽 妫?煡鐐?SCN聽 妫?煡鐐规椂闂绰?鍚嶇О
------- ---- - --------------- ---------- --------------- ------
226聽聽聽聽 3聽聽聽 A 26-12鏈?00聽聽聽聽聽 33226聽聽聽聽聽 26-12鏈?00聽聽聽聽 E:DBBACKUPU.DBF

4銆佸湪澶囦唤鏄缃浉鍏冲弬鏁?br />
format --鏂囦欢杈撳嚭鏍煎紡锛?br />%d--database name,
%s--backup sets sequence number,
%p--backup pieces sequence number
filesperset --姣忎釜澶囦唤闆嗕腑鎵?寘鎷殑鏂囦欢鏁?br />
鏇村鍙傛暟璇峰弬鑰冩湰鏂囧紑濮嬫椂鍒楀嚭鐨勪功銆?br />
RMAN>run {
2> allocate channel c1 type disk;
3> set limit channel c1 kbytes 8000;
4> backup
5> format ''e:dbbackupdb_%d_%s_%p.bck''
6> (database filesperset=2 );
7> }

RMAN-03022锛氭鍦ㄧ紪璇戝懡浠わ細allocate
RMAN-03023锛氭鍦ㄦ墽琛屽懡浠わ細allocate
RMAN-08030锛氬垎閰嶇殑閫氶亾锛歝1
RMAN-08500锛氶?閬?c1锛歴id=9 devtype=DISK

RMAN-03022锛氭鍦ㄧ紪璇戝懡浠わ細set limit
RMAN-03023锛氭鍦ㄦ墽琛屽懡浠わ細set limit

RMAN-03022锛氭鍦ㄧ紪璇戝懡浠わ細backup
RMAN-03023锛氭鍦ㄦ墽琛屽懡浠わ細backup
RMAN-08008锛氶?閬?c1锛氭鍦ㄥ惎鍔?full 鏁版嵁鏂囦欢澶囦唤闆?br />RMAN-08502锛歴et_count=6 set_stamp=417351064 creation_time=26-12鏈?00
RMAN-08010锛氶?閬?c1锛氭鍦ㄦ寚瀹氬浠介泦涓殑鏁版嵁鏂囦欢
RMAN-08522锛氳緭鍏ユ暟鎹枃浠?fno=00003 name=C:ORACLEORADATARMANUSERS01.DBF
RMAN-08522锛氳緭鍏ユ暟鎹枃浠?fno=00005 name=C:ORACLEORADATARMANTOOLS01.DBF
RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 1 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_6_1.BCK comment=NONE
RMAN-08525锛氬浠介泦瀹屾垚锛岀粡杩囨椂闂达細00:00:03
RMAN-08008锛氶?閬?c1锛氭鍦ㄥ惎鍔?full 鏁版嵁鏂囦欢澶囦唤闆?br />RMAN-08502锛歴et_count=7 set_stamp=417351067 creation_time=26-12鏈?00
RMAN-08010锛氶?閬?c1锛氭鍦ㄦ寚瀹氬浠介泦涓殑鏁版嵁鏂囦欢
RMAN-08522锛氳緭鍏ユ暟鎹枃浠?fno=00002 name=C:ORACLEORADATARMANRBS01.DBF
RMAN-08522锛氳緭鍏ユ暟鎹枃浠?fno=00006 name=C:ORACLEORADATARMANINDX01.DBF
RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 1 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_7_1.BCK comment=NONE
RMAN-08525锛氬浠介泦瀹屾垚锛岀粡杩囨椂闂达細00:00:04
RMAN-08008锛氶?閬?c1锛氭鍦ㄥ惎鍔?full 鏁版嵁鏂囦欢澶囦唤闆?br />RMAN-08502锛歴et_count=8 set_stamp=417351071 creation_time=26-12鏈?00
RMAN-08010锛氶?閬?c1锛氭鍦ㄦ寚瀹氬浠介泦涓殑鏁版嵁鏂囦欢
RMAN-08522锛氳緭鍏ユ暟鎹枃浠?fno=00001 name=C:ORACLEORADATARMANSYSTEM01.DBF
RMAN-08011锛氬浠介泦涓寘鎷綋鍓嶆帶鍒舵枃浠?br />RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 1 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_8_1.BCK comment=NONE
RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 2 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_8_2.BCK comment=NONE
RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 3 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_8_3.BCK comment=NONE
RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 4 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_8_4.BCK comment=NONE
RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 5 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_8_5.BCK comment=NONE
RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 6 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_8_6.BCK comment=NONE
RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 7 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_8_7.BCK comment=NONE
RMAN-08525锛氬浠介泦瀹屾垚锛岀粡杩囨椂闂达細00:00:19
RMAN-08008锛氶?閬?c1锛氭鍦ㄥ惎鍔?full 鏁版嵁鏂囦欢澶囦唤闆?br />RMAN-08502锛歴et_count=9 set_stamp=417351090 creation_time=26-12鏈?00
RMAN-08010锛氶?閬?c1锛氭鍦ㄦ寚瀹氬浠介泦涓殑鏁版嵁鏂囦欢
RMAN-08522锛氳緭鍏ユ暟鎹枃浠?fno=00004 name=C:ORACLEORADATARMANTEMP01.DBF
RMAN-08013锛氶?閬?c1锛氬凡鍒涘缓 1 娈?br />RMAN-08503锛氭 handle=E:DBBACKUPDB_RMAN_9_1.BCK comment=NONE
RMAN-08525锛氬浠介泦瀹屾垚锛岀粡杩囨椂闂达細00:00:07
RMAN-03023锛氭鍦ㄦ墽琛屽懡浠わ細partial resync
RMAN-08003锛氬惎鍔ㄩ儴鍒嗘仮澶嶇洰褰曠殑 resync
RMAN-08005锛氬畬鎴愰儴鍒?resync
RMAN-08031锛氶噴鏀剧殑閫氶亾锛歝1

5銆佷娇鐢ㄨ剼鏈姛鑳?br />
浣跨敤鑴氭湰鐨勭洰鐨勫湪浜庢柟渚挎垜浠搷浣滀腑鐨勬柟渚匡紝鎿嶄綔涓婂拰瀛樺偍杩囩▼鐩镐技銆?br />
RMAN>create script l0dbbackup {
2> allocate channel c1 type disk;
3> backup
4> format ''e:dbbackupdb_%d_%s_%p.bck''
5> (database filesperset=2 );
6> }

RMAN-03022锛氭鍦ㄧ紪璇戝懡浠わ細create script
RMAN-03023锛氭鍦ㄦ墽琛屽懡浠わ細create script

RMAN-08085锛氬凡鍒涘缓鑴氭湰 l0dbbackup

RMAN>run {execute script l0dbbackup; }








相关链接:



Taobao is free of Charge commitment charges due to question



comments News Servers



TD Union angrily Qualcomm to mislead the public in the patent fees



MKV to WMV



Find out the psychological Make promotions



New Personal Interest



hpqtra08 exe shut down problems quick FIXING tip



Detailed analysis: Teach you to master the table character set and proofreading



SYBASE Services



ASF To MPG



Easy Games Arcade



Compare Reference Tools



Neusoft interpretation of "child swallow mother" listed as a whole INTEGRATION scheme



The official Chinese version of Firefox Mozilla FireFox 2.0.0.7



Close To the KM role



MP4 to WMP



Direct Marketing Manager: your direct sales beyond



No comments:

Post a Comment