【原】Oracle學習系列—資料庫備份—RMAN備份
RMAN(Recovery Manager,恢復管理器)是資料的備份工具,是一個與作業系統無關的資料庫備份工具,可以跨越不同作業系統進行資料庫備份。
以前從來不敢使用這玩意,也不太清楚到底有何用途,只知道很難使用;經過3天的實踐總算硬著頭皮把例子一個個做了一遍,對RMAN的基本命令和用途有了基本的瞭解。。。
唉,其實我還是沒太搞明白,也許等冷靜一段時間研究一下恢復的時候,才知道RMAN的真正用途。。。
--Create RMAN enviroment --Create RMAN default tablespace --Create RMAN User --Grant RMAN privilege SQL*Plus: Release 9.2.0.1.0 - Production on Sun Apr 8 21:23:31 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect sys/change_on_install as sysdba; Connected. SQL> create tablespace cattbs 2 datafile 'c:/userdefine/oracle/oradata/wbq/cattbsdb01.dbf' size 10M 3 autoextend on next 10M maxsize 100M 4 extent management local uniform. size 128k;
Tablespace created.
SQL> create user rman identified by rman 2 default tablespace cattbs 3 temporary tablespace temp;
User created.
SQL> grant connect,resource to rman;
Grant succeeded.
SQL> grant recovery_catalog_owner to rman;
Grant succeeded.
SQL> |
--Rman login --create recovery catalog Recovery Manager: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
RMAN> connect catalog rman/rman
connected to recovery catalog database recovery catalog is not installed
RMAN> create catalog;
recovery catalog created |
--Connect Destination Database, local database can be connected directly --Register Database Recovery Manager: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
RMAN> connect target sys/change_on_install
connected to target database: WBQ (DBID=2252890748)
RMAN> register database;
database registered in recovery catalog starting full resync of recovery catalog full resync complete
RMAN> resync catalog;
starting full resync of recovery catalog full resync complete |
--remote startup and shutdown database RMAN> shutdown immediate
database closed database dismounted Oracle instance shut down
RMAN> startup
connected to target database(not started) Oracle instance started database mounted database opened
Total System Global Area XXX bytes
Fixed Size XXX bytes Variable Size XXX bytes Database Buffers XXX bytes Redo Buffers XXX bytes |
--Auto Channel configuration --Show default device type --Change parallelism number to 3 --Show device type again --Set default device type --Set data volume per backup RMAN> show device type;
RMAN configuration parameters are: CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default
RMAN> configure device type disk parallelism 3;
new RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK PARALLELISM 3; new RMAN configuration parameters are successfully stored released channel: ORA_DISK_1
RMAN> show device type;
RMAN configuration parameters are: CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
RMAN> configure default device type to disk;
new RMAN configuration parameters: CONFIGURE DEFAULT DEVICE TYPE TO DISK; new RMAN configuration parameters are successfully stored
RMAN> configure channel device type disk maxpiecesize=1M;
new RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 1 M; new RMAN configuration parameters are successfully stored |
--backup Database by auto channel RMAN> backup tablespace wbq;
Starting backup at 09-APR-07 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=18 devtype=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: sid=19 devtype=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: sid=20 devtype=DISK channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00011 name=C:/USERDEFINE/ORACLE/ORADATA/WBQ/WBQ.ORA channel ORA_DISK_1: starting piece 1 at 09-APR-07 channel ORA_DISK_1: finished piece 1 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/3IEOTTB_1_1 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 09-APR-07
--define Manual Channel by RUN command. --define 3 channel, and parallel backup 3 datafile. a channel operate a databfile RMAN> run 2> { 3> allocate channel c1 device type disk; 4> allocate channel c2 device type disk; 5> allocate channel c3 device type disk; 6> backup datafile 1,2,3; 7> }
released channel: ORA_DISK_1 released channel: ORA_DISK_2 released channel: ORA_DISK_3 allocated channel: c1 channel c1: sid=18 devtype=DISK
allocated channel: c2 channel c2: sid=19 devtype=DISK
allocated channel: c3 channel c3: sid=20 devtype=DISK
Starting backup at 09-APR-07 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset input datafile fno=00002 name=C:/USERDEFINE/ORACLE/ORADATA/WBQ/UNDOTBS01.DBF channel c1: starting piece 1 at 09-APR-07 channel c2: starting full datafile backupset channel c2: specifying datafile(s) in backupset input datafile fno=00003 name=C:/USERDEFINE/ORACLE/ORADATA/WBQ/CWMLITE01.DBF channel c2: starting piece 1 at 09-APR-07 channel c3: starting full datafile backupset channel c3: specifying datafile(s) in backupset including current SPFILE in backupset including current controlfile in backupset input datafile fno=00001 name=C:/USERDEFINE/ORACLE/ORADATA/WBQ/SYSTEM01.DBF channel c3: starting piece 1 at 09-APR-07 channel c1: finished piece 1 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/4IEOU0O_1_1 comment=NONE channel c1: backup set complete, elapsed time: 00:00:11 channel c2: finished piece 1 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/5IEOU0O_1_1 comment=NONE channel c2: backup set complete, elapsed time: 00:00:11 channel c3: finished piece 1 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/6IEOU0O_1_1 comment=NONE channel c3: backup set complete, elapsed time: 00:00:56 Finished backup at 09-APR-07 released channel: c2 released channel: c3 released channel: c1 |
--Define 3 channel, but only a channel backup datafile ,so only utilize one channel RMAN> run 2> { 3> allocate channel c1 device type disk; 4> allocate channel c2 device type disk; 5> allocate channel c3 device type disk; 6> backup datafile 1; 7> backup datafile 2; 8> backup datafile 3; 9> }
allocated channel: c1 channel c1: sid=18 devtype=DISK
allocated channel: c2 channel c2: sid=19 devtype=DISK
allocated channel: c3 channel c3: sid=20 devtype=DISK
Starting backup at 09-APR-07 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset including current SPFILE in backupset including current controlfile in backupset input datafile fno=00001 name=C:/USERDEFINE/ORACLE/ORADATA/WBQ/SYSTEM01.DBF channel c1: starting piece 1 at 09-APR-07 channel c1: finished piece 1 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/7IEOU4E_1_1 comment=NONE channel c1: backup set complete, elapsed time: 00:00:46 Finished backup at 09-APR-07
Starting backup at 09-APR-07 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset input datafile fno=00002 name=C:/USERDEFINE/ORACLE/ORADATA/WBQ/UNDOTBS01.DBF channel c1: starting piece 1 at 09-APR-07 channel c1: finished piece 1 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/8IEOU5T_1_1 comment=NONE channel c1: backup set complete, elapsed time: 00:00:15 Finished backup at 09-APR-07
Starting backup at 09-APR-07 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset input datafile fno=00003 name=C:/USERDEFINE/ORACLE/ORADATA/WBQ/CWMLITE01.DBF channel c1: starting piece 1 at 09-APR-07 channel c1: finished piece 1 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/9IEOU6C_1_1 comment=NONE channel c1: backup set complete, elapsed time: 00:00:03 Finished backup at 09-APR-07 released channel: c1 released channel: c2 released channel: c3
--show all channel configuration parameter. RMAN> show all;
RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 3; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 1 M; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'C:/USERDEFINE/ORACLE/ORA92/DATABASE/SNCF WBQ.ORA'; # default |
--Copy by Manual Channel RMAN> run 2> { 3> allocate channel c1 device type disk; 4> allocate channel c2 device type disk; 5> allocate channel c3 device type disk; 6> copy 7> datafile 11 to 'c:/userdefine/oracle/oradata/wbq/backup/wbq1008.dbf', 8> current controlfile to 'c:/userdefine/oracle/oradata/wbq/backup/controlbk.ctl'; 9> }
using target database controlfile instead of recovery catalog allocated channel: c1 channel c1: sid=19 devtype=DISK
allocated channel: c2 channel c2: sid=18 devtype=DISK
allocated channel: c3 channel c3: sid=12 devtype=DISK
Starting copy at 09-APR-07 channel c2: copied current controlfile output filename=C:/USERDEFINE/ORACLE/ORADATA/WBQ/BACKUP/CONTROLBK.CTL channel c1: copied datafile 11 output filename=C:/USERDEFINE/ORACLE/ORADATA/WBQ/BACKUP/WBQ1008.DBF recid=3 stam p=619481357 Finished copy at 09-APR-07 released channel: c1 released channel: c2 released channel: c3
--copy by Auto Channel RMAN> copy 2> datafile 11 to 'c:/userdefine/oracle/oradata/wbq/backup/wbq1010.dbf', 3> current controlfile to 'c:/userdefine/oracle/oradata/wbq/backup/control1010bk.ctl';
Starting copy at 09-APR-07 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 channel ORA_DISK_2: copied current controlfile output filename=C:/USERDEFINE/ORACLE/ORADATA/WBQ/BACKUP/CONTROL1010BK.CTL channel ORA_DISK_1: copied datafile 11 output filename=C:/USERDEFINE/ORACLE/ORADATA/WBQ/BACKUP/WBQ1010.DBF recid=5 stam p=619481551 Finished copy at 09-APR-07 |
--backup method,need dispatch auto or manual channel,define file format,define backup level,backup object --backup full database RMAN> backup database .........
--backup tablesapce RMAN> backup tablespace users;
Starting backup at 09-APR-07 using target database controlfile instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=19 devtype=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: sid=16 devtype=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: sid=20 devtype=DISK channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00009 name=C:/USERDEFINE/ORACLE/ORADATA/WBQ/USERS01.DBF channel ORA_DISK_1: starting piece 1 at 09-APR-07 channel ORA_DISK_1: finished piece 1 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/DIEP4KJ_1_1 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 09-APR-07
--backup controlfile RMAN> backup current controlfile;
Starting backup at 09-APR-07 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current controlfile in backupset channel ORA_DISK_1: starting piece 1 at 09-APR-07 channel ORA_DISK_1: finished piece 1 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/EIEP4ME_1_1 comment=NONE channel ORA_DISK_1: starting piece 2 at 09-APR-07 channel ORA_DISK_1: finished piece 2 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/EIEP4ME_2_1 comment=NONE channel ORA_DISK_1: starting piece 3 at 09-APR-07 channel ORA_DISK_1: finished piece 3 at 09-APR-07 piece handle=C:/USERDEFINE/ORACLE/ORA92/DATABASE/EIEP4ME_3_1 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 09-APR-07
RMAN> |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/6517/viewspace-145518/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【原】Oracle學習系列—資料庫備份—離線備份Oracle資料庫
- Oracle學習系列—資料庫備份—熱備份Oracle資料庫
- 【RMAN】利用備份片還原資料庫資料庫
- rman備份學習
- 「Oracle」Oracle 資料庫備份還原Oracle資料庫
- 【RMAN】使用增量備份更新資料庫備份映象資料庫
- 使用RMAN備份資料庫資料庫
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- 【RMAN】利用備份片還原資料庫(上)資料庫
- 【RMAN】利用備份片還原資料庫(中)資料庫
- 【RMAN】利用備份片還原資料庫(下)資料庫
- ORACLE RMAN備份及還原Oracle
- oracle資料庫備份之exp增量備份Oracle資料庫
- 利用RMAN備份重建資料庫資料庫
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-RMAN備份的目的GUIIDE資料庫
- linux下自動備份oracle資料庫-rmanLinuxOracle資料庫
- Oracle資料庫備份與恢復之RMANOracle資料庫
- Oracle資料庫RMAN小結之備份部分Oracle資料庫
- 【RMAN】利用備份片還原資料庫(中)-附加資料庫
- Rman-ORACLE資料庫RMAN實現自動備份Oracle資料庫
- rman資料備份恢復學習筆記筆記
- Oracle資料庫的備份方法-冷備份(轉)Oracle資料庫
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-為RMAN備份指定TAGGUIIDE資料庫
- RMAN備份恢復——RAC環境資料庫的備份(zt)資料庫
- RMAN備份恢復--RAC環境資料庫的備份(十)資料庫
- RMAN備份恢復——RAC環境資料庫的備份(一)資料庫
- RMAN備份 建立catalog資料庫資料庫
- 非歸檔資料庫RMAN備份資料庫
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-為RMAN備份指定格式GUIIDE資料庫
- 如何利用Rman對Oracle資料庫進行備份Oracle資料庫
- Aix下使用rman備份Oracle RAC資料庫(轉)AIOracle資料庫
- Oracle 11g RMAN備份-增量備份Oracle
- Oracle備份與恢復系列(四)續 RMAN Duplicate複製資料庫Oracle資料庫
- Oracle資料庫冷備份與熱備份操作梳理Oracle資料庫
- MSSQL 備份資料庫還原SQL資料庫
- oracle資料還原與備份Oracle
- Oracle資料庫備份還原詳解XKUSOracle資料庫
- exp/imp備份與還原oracle資料庫Oracle資料庫