oracle 10g RMAN管理
本例子的目的:
1:熟悉RMAN進行備份和恢復
2:對於10g和9i在增量備份上的操作和功能的不同
(9i每次備份都會產生一個備份檔案,
例如:在星期天做level為0的備份生成檔案1,星期一做level為1的備份又為產生檔案2,檔案1和檔案2是獨立的
在做恢復的時候要同時利用檔案1和檔案2,恢復的時候時間花費較大。
而10g可以一直利用檔案1進得累加,在做level為1的備份後不要再產生檔案2了
所以10g在做恢復的時候只要利用檔案1就可以完成了,恢復的時候時間花費較小
一:環境
1:
IP:192.168.1.14
作業系統:linux
資料庫:10.2.0.1.0
rman屬性:使用者名稱/密碼/專用表空間 rman/rman/ts_rman
使用者rman擁有RECOVERY_CATALOG_OWNER,connect
命令執行機器192.168.1.14
CREATE TABLESPACE TS_RMAN
LOGGING
DATAFILE '/oracle/oradata/boss/TS_RMAN_001.dbf' SIZE 512M
REUSE DEFAULT STORAGE ( INITIAL 64K NEXT 64K MINEXTENTS 1 MAXEXTENTS 505
PCTINCREASE 0 );
create user RMAN identified by RMAN;
grant resource,connect,RECOVERY_CATALOG_OWNER to RMAN ;
grant create table to RMAN ;
alter user RMAN quota unlimited ON TS_RMAN;
alter user RMAN default tablespace TS_RMAN;
alter user RMAN temporary tablespace temp;
2:
目標資料庫
IP:192.168.1.115
作業系統:linux
資料庫:10.2.0.1.0
資料庫的儲存資料的一個使用者:test
二: rman的操作流程(說明:以下所有rman 的相關命令都在192.168.1.14上執行,其它的操作都在192.168.1.115上執行)
1:註冊目標資料庫
2:進行一次level為0的備份
3:登入192.168.1.115的資料庫使用者test,建立表test_inc_levl_1
4:在192.168.1.14機子上對192.168.1.115做一個level為1的增量備份
5:在192.168.1.115的上刪除資料檔案ts_boss_001.dbf
6:登入192.168.1.115的使用者test查表test_inc_levl_1
7:發現已經無法找到這個表了,因為是資料檔案file 6已經找不到了,所以只好利用還原
8:驗證恢復,登入192.168.1.115的使用者test查表test_inc_levl_1
#########1:註冊目標資料庫(把192.168.1.115的資料庫相關資訊儲存在192.168.1.14的rman使用者的相應的表裡)##################
[root@localhost 10g_script]# rman
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jan 9 16:07:38 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target sys/boss@boss_115;
connected to target database: BOSS (DBID=1127560625)
RMAN> connect catalog rman/rman
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
########################################2:進行一次level為0的備份####################################
RMAN> run
2> {
3> backup
4> incremental level 0
5> format '/oracle/rman_back/db_%d_%s_%p_%t'
6> database
7> tag='backup_inc0';
8> }
Starting backup at 09-JAN-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00015 name=/oracle/oradata/boss/TS_RMAN_001.dbf
input datafile fno=00001 name=/oracle/oradata/boss/system01.dbf
input datafile fno=00003 name=/oracle/oradata/boss/sysaux01.dbf
input datafile fno=00002 name=/oracle/oradata/boss/undotbs01.dbf
input datafile fno=00005 name=/oracle/oradata/boss/example01.dbf
input datafile fno=00006 name=/oracle/oradata/boss/ts_boss_001.dbf
input datafile fno=00016 name=/oracle/oradata/boss/TS_update_001.dbf
input datafile fno=00017 name=/oracle/oradata/boss/TS_update1_001.dbf
input datafile fno=00004 name=/oracle/oradata/boss/users01.dbf
channel ORA_DISK_1: starting piece 1 at 09-JAN-07
channel ORA_DISK_1: finished piece 1 at 09-JAN-07
piece handle=/oracle/rman_back/db_BOSS_220_1_611424836 tag=BACKUP_INC0 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:36
Finished backup at 09-JAN-07
Starting Control File and SPFILE Autobackup at 09-JAN-07
piece handle=/oracle/flash_recovery_area/BOSS/autobackup/2007_01_09/o1_mf_s_611425055_2t6mx0q9_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 09-JAN-07
###3:登入192.168.1.115的一個使用者boss,建立表test_inc_levl_1,等下做完備份後,刪除,然後資料庫做還原和恢復後看看這個表的相應記錄##
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as boss
SQL> create table test_inc_levl_1 as select * from cust_user where rownum<=1000;
Table created
###############4:在192.168.1.14機子上對192.168.1.115做一個level為1的增量備份###########################################
RMAN> run
2> {
3> backup incremental level 1 for recover of copy with tag 'backup_inc0' database;
4> }
Starting backup at 09-JAN-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00015 name=/oracle/oradata/boss/TS_RMAN_001.dbf
input datafile fno=00001 name=/oracle/oradata/boss/system01.dbf
input datafile fno=00003 name=/oracle/oradata/boss/sysaux01.dbf
input datafile fno=00002 name=/oracle/oradata/boss/undotbs01.dbf
input datafile fno=00005 name=/oracle/oradata/boss/example01.dbf
input datafile fno=00006 name=/oracle/oradata/boss/ts_boss_001.dbf
input datafile fno=00016 name=/oracle/oradata/boss/TS_update_001.dbf
input datafile fno=00017 name=/oracle/oradata/boss/TS_update1_001.dbf
input datafile fno=00004 name=/oracle/oradata/boss/users01.dbf
channel ORA_DISK_1: starting piece 1 at 09-JAN-07
channel ORA_DISK_1: finished piece 1 at 09-JAN-07
piece handle=/oracle/flash_recovery_area/BOSS/backupset/2007_01_09/o1_mf_nnnd1_TAG20070109T163221_2t6nrq7t_.bkp tag=TAG20070109T163221 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Finished backup at 09-JAN-07
Starting Control File and SPFILE Autobackup at 09-JAN-07
piece handle=/oracle/flash_recovery_area/BOSS/autobackup/2007_01_09/o1_mf_s_611426018_2t6nv3rj_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 09-JAN-07
###########5:在192.168.1.115的上刪除資料檔案ts_boss_001.dbf##########
[root@localhost boss]# cd /oracle/oradata/boss
[root@localhost boss]# rm ts_boss_001.dbf#########################表test_inc_levl_1 在表空間ts_boss_001.dbf上面
rm: remove regular file `ts_boss_001.dbf'? y
###6:登入192.168.1.115的使用者test查表test_inc_levl_1
SQL> select * from test_inc_levl_1 ;
select * from test_inc_levl_1
ORA-01116: error in opening database file 6
ORA-01110: data file 6: '/oracle/oradata/boss/ts_boss_001.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
SQL>
######################7:發現已經無法找到這個表了,因為是資料檔案file 6已經找不到了,所以只好利用還原來恢復來找回這個表了######
RMAN> run
2> {
3> sql 'alter tablespace ts_boss offline immediate';
4> restore datafile 6;
5> recover tablespace ts_boss;
6> sql 'alter tablespace ts_boss online';
7> }
sql statement: alter tablespace ts_boss offline immediate
Starting restore at 09-JAN-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00006 to /oracle/oradata/boss/ts_boss_001.dbf
channel ORA_DISK_1: reading from backup piece /oracle/rman_back/db_BOSS_220_1_611424836
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/rman_back/db_BOSS_220_1_611424836 tag=BACKUP_INC0
channel ORA_DISK_1: restore complete, elapsed time: 00:00:26
Finished restore at 09-JAN-07
Starting recover at 09-JAN-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00006: /oracle/oradata/boss/ts_boss_001.dbf
channel ORA_DISK_1: reading from backup piece /oracle/flash_recovery_area/BOSS/backupset/2007_01_09/o1_mf_nnnd1_TAG20070109T163221_2t6nrq7t_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/flash_recovery_area/BOSS/backupset/2007_01_09/o1_mf_nnnd1_TAG20070109T163221_2t6nrq7t_.bkp tag=TAG20070109T163221
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 09-JAN-07
sql statement: alter tablespace ts_boss online
RMAN>
#########################8:驗證恢復,登入192.168.1.115的使用者test查表test_inc_levl_1
SQL> select count(*) from test_inc_levl_1 ;
COUNT(*)
----------
1000
SQL>
##########################說明已經成功的恢復了剛才刪除的檔案了,退出##################
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/235507/viewspace-548674/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 10g rman 指令碼Oracle 10g指令碼
- Oracle RMAN管理(小計)Oracle
- oracle實驗記錄 (oracle 10G rman transport database)OracleDatabase
- oracle 10g RMAN備份及恢復Oracle 10g
- ORACLE 10G RMAN 部分配置設定Oracle 10g
- Oracle 10g AS基本管理Oracle 10g
- RMAN 增量備份最佳化 for ORACLE 10GOracle 10g
- oracle實驗記錄 (oracle 10G dataguard(8)rman 建立dg)Oracle
- Oracle 10g使用RMAN恢復目錄筆記Oracle 10g筆記
- oracle 10g RAC簡單管理Oracle 10g
- 教你如何成為Oracle 10g OCP - 第十三章 RMAN管理的備份與恢復Oracle 10g
- oracle實驗記錄 (oracle 10G dataguard(9)rman恢復與dg)Oracle
- Linux 下Oracle 10G RAC 管理LinuxOracle 10g
- oracle 10g rac 單例項恢復至ORACLE10G RAC RMANOracle 10g單例
- 利用RMAN把ORACLE 10G 64位降級為32位Oracle 10g
- 關於oracle 10G for suse 9 的rman: can't open targetOracle 10g
- 10g RAC rman tips
- Oracle 10G R2 RAC 日常管理Oracle 10g
- Oracle 10G R2 RAC日常管理Oracle 10g
- Oracle 10g SGA 的自動化管理Oracle 10g
- rman總結(包含10g rman中的新特性)
- Oracle RAC中使用RMAN管理歸檔日誌Oracle
- 10G RMAN恢復新特性
- 第9 章、Oracle 10g 中的效能管理Oracle 10g
- oracle 10g 自動共享記憶體管理Oracle 10g記憶體
- oracle實驗記錄 (oracle 10G dataguard(3)檔案管理)Oracle
- oracle9i的rman全備在10g上的恢復Oracle
- oracle rmanOracle
- oracle資料庫rman歸檔設定和管理Oracle資料庫
- 10g RMAN的REDUNDANCY策略改變
- ORACLE 10G ASM非歸檔模式下使用RMAN遷移一例Oracle 10gASM模式
- oracle 10g rman duplicate target database for standby會自動新增臨時檔案Oracle 10gDatabase
- 開啟oracle 10g的sga自動管理-ammOracle 10g
- oracle 10g sga自動管理amm(補充二)Oracle 10g
- assm:Oracle 10g的自動段空間管理SSMOracle 10g
- Oracle 10g的自動段空間管理(ASSM)Oracle 10gSSM
- 說說10g rman的catalog命令
- Oracle 10g RAC下Voting disk和OCR的管理Oracle 10g