第一部分,环境描述
(也可以参考前面的部分)
linux:
[oracle@node1 ~]$ uname -a
Linux node1 2.6.18-92.el5xen #1 SMP Tue Apr 29 13:45:57 EDT 2008 i686 i686 i386 GNU/Linux
Oracle:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL>
采用的是虚拟机模拟的RAC环境
安装了ASM
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+RAC_DISK/racdb/datafile/system.259.733960845
+RAC_DISK/racdb/datafile/undotbs1.260.733960879
+RAC_DISK/racdb/datafile/sysaux.261.733960895
+RAC_DISK/racdb/datafile/undotbs2.263.733960921
+RAC_DISK/racdb/datafile/users.264.733960933
+RAC_DISK/racdb/datafile/test_d.271.734574993
+RAC_NEWDISK/racdb/datafile/test_e.256.736131295
+RAC_NEWDISK/racdb/datafile/test_e.257.736131637
8 rows selected.
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+RAC_DISK/racdb/controlfile/current.256.733960831
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+RAC_DISK/racdb/onlinelog/group_1.257.733960837
+RAC_DISK/racdb/onlinelog/group_2.258.733960839
+RAC_DISK/racdb/onlinelog/group_3.265.733963563
+RAC_DISK/racdb/onlinelog/group_4.266.733963567
+RAC_DISK/racdb/onlinelog/group_5.272.734633861
+RAC_DISK/racdb/onlinelog/group_6.273.734633913
6 rows selected.
SQL>
node1节点的归档日志的设置
归档日志的设置
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +RAC_DISK/demo/arch1
Oldest online log sequence 42
Next log sequence to archive 44
Current log sequence 44
SQL>
归档日志的设置
SQL> show parameter arch
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target integer 0
log_archive_config string
log_archive_dest string
log_archive_dest_1 string LOCATION=+RAC_DISK/demo/arch1
log_archive_dest_10 string
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_9 string enable
log_archive_duplex_dest string
log_archive_format string %t_%s_%r.arc
log_archive_local_first boolean TRUE
log_archive_max_processes integer 2
log_archive_min_succeed_dest integer 1
log_archive_start boolean FALSE
log_archive_trace integer 0
remote_archive_enable string true
standby_archive_dest string ?/dbs/arch
SQL>
node2节点的归档日志的设置
归档日志的设置
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +RAC_DISK/demo/arch2
Oldest online log sequence 17
Next log sequence to archive 19
Current log sequence 19
SQL>
SQL> show parameter arch
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target integer 0
log_archive_config string
log_archive_dest string
log_archive_dest_1 string LOCATION=+RAC_DISK/demo/arch2
log_archive_dest_10 string
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_9 string enable
log_archive_duplex_dest string
log_archive_format string %t_%s_%r.arc
log_archive_local_first boolean TRUE
log_archive_max_processes integer 2
log_archive_min_succeed_dest integer 1
log_archive_start boolean FALSE
log_archive_trace integer 0
remote_archive_enable string true
standby_archive_dest string ?/dbs/arch
SQL>
RAC备份注意事项
第一,备份的时候连接到某个实例,而不是连接整个集群
第二,备份归档日志的时候,必须保证在备份实例上面能够访问所有实例的归档日志,否则会报错
备份步骤
登录到node1节点
rman target / nocatalog
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
backup
tag mjs_racdb_full
format '/opt/ora10g/rman/racdb%t_s%s_p%p'
database include current controlfile ;
sql 'alter system archive log current';
backup archivelog all delete input
format '/opt/ora10g/rman/racdb_archlog_%d.%s';
release channel t1;
release channel t2;
release channel t3;
allocate channel node1 type disk format '/opt/ora10g/rman/racdb_control_%d_%s_%p_%c';
Backup current controlfile;
release channel node1;
}
过程如下
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; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
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 FORMAT '/opt/ora10g/arch/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/ora10g/product/10.2.0/db_1/dbs/snapcf_RACDB1.f'; # default
RMAN> run {
2> allocate channel t1 type disk;
3> allocate channel t2 type disk;
4> allocate channel t3 type disk;
5> backup
6> tag mjs_racdb_full
7> format '/opt/ora10g/rman/racdb%t_s%s_p%p'
8> database include current controlfile ;
9> sql 'alter system archive log current';
10> backup archivelog all delete input
11> format '/opt/ora10g/rman/racdb_archlog_%d.%s';
12> release channel t1;
13> release channel t2;
14> release channel t3;
15> allocate channel node1 type disk format '/opt/ora10g/rman/racdb_control_%d_%s_%p_%c';
16> Backup current controlfile;
17> release channel node1;
18> }
allocated channel: t1
channel t1: sid=129 instance=RACDB1 devtype=DISK
allocated channel: t2
channel t2: sid=130 instance=RACDB1 devtype=DISK
allocated channel: t3
channel t3: sid=128 instance=RACDB1 devtype=DISK
Starting backup at 12-FEB-11
channel t1: starting full datafile backupset
channel t1: specifying datafile(s) in backupset
input datafile fno=00001 name=+RAC_DISK/racdb/datafile/system.259.733960845
input datafile fno=00004 name=+RAC_DISK/racdb/datafile/undotbs2.263.733960921
channel t1: starting piece 1 at 12-FEB-11
channel t2: starting full datafile backupset
channel t2: specifying datafile(s) in backupset
input datafile fno=00003 name=+RAC_DISK/racdb/datafile/sysaux.261.733960895
input datafile fno=00006 name=+RAC_DISK/racdb/datafile/test_d.271.734574993
input datafile fno=00005 name=+RAC_DISK/racdb/datafile/users.264.733960933
channel t2: starting piece 1 at 12-FEB-11
channel t3: starting full datafile backupset
channel t3: specifying datafile(s) in backupset
input datafile fno=00002 name=+RAC_DISK/racdb/datafile/undotbs1.260.733960879
input datafile fno=00007 name=+RAC_NEWDISK/racdb/datafile/test_e.256.736131295
input datafile fno=00008 name=+RAC_NEWDISK/racdb/datafile/test_e.257.736131637
channel t3: starting piece 1 at 12-FEB-11
channel t1: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb742879443_s19_p1 tag=MJS_RACDB_FULL comment=NONE
channel t1: backup set complete, elapsed time: 00:02:29
channel t1: starting full datafile backupset
channel t1: specifying datafile(s) in backupset
including current control file in backupset
channel t1: starting piece 1 at 12-FEB-11
channel t2: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb742879444_s20_p1 tag=MJS_RACDB_FULL comment=NONE
channel t2: backup set complete, elapsed time: 00:02:32
channel t2: starting full datafile backupset
channel t2: specifying datafile(s) in backupset
channel t3: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb742879445_s21_p1 tag=MJS_RACDB_FULL comment=NONE
channel t3: backup set complete, elapsed time: 00:02:33
channel t1: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb742879594_s22_p1 tag=MJS_RACDB_FULL comment=NONE
channel t1: backup set complete, elapsed time: 00:00:04
including current SPFILE in backupset
channel t2: starting piece 1 at 12-FEB-11
channel t2: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb742879598_s23_p1 tag=MJS_RACDB_FULL comment=NONE
channel t2: backup set complete, elapsed time: 00:00:01
Finished backup at 12-FEB-11
sql statement: alter system archive log current
Starting backup at 12-FEB-11
current log archived
channel t1: starting archive log backupset
channel t1: specifying archive log(s) in backup set
input archive log thread=1 sequence=33 recid=21 stamp=734853661
input archive log thread=1 sequence=34 recid=22 stamp=735186059
input archive log thread=1 sequence=35 recid=24 stamp=736122405
input archive log thread=1 sequence=36 recid=26 stamp=736128062
channel t1: starting piece 1 at 12-FEB-11
channel t2: starting archive log backupset
channel t2: specifying archive log(s) in backup set
input archive log thread=1 sequence=37 recid=29 stamp=740443359
input archive log thread=1 sequence=38 recid=30 stamp=740698724
input archive log thread=1 sequence=39 recid=32 stamp=740700530
input archive log thread=1 sequence=40 recid=34 stamp=741936596
input archive log thread=1 sequence=41 recid=35 stamp=742704376
channel t2: starting piece 1 at 12-FEB-11
channel t3: starting archive log backupset
channel t3: specifying archive log(s) in backup set
input archive log thread=1 sequence=42 recid=37 stamp=742794563
input archive log thread=1 sequence=43 recid=39 stamp=742867506
input archive log thread=1 sequence=44 recid=41 stamp=742879620
input archive log thread=1 sequence=45 recid=42 stamp=742879627
input archive log thread=2 sequence=11 recid=23 stamp=735186071
input archive log thread=2 sequence=12 recid=25 stamp=736122459
input archive log thread=2 sequence=13 recid=27 stamp=740440406
input archive log thread=2 sequence=14 recid=28 stamp=740443249
channel t3: starting piece 1 at 12-FEB-11
channel t1: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb_archlog_RACDB.24 tag=TAG20110212T032711 comment=NONE
channel t1: backup set complete, elapsed time: 00:00:25
channel t1: deleting archive log(s)
archive log filename=+RAC_DISK/demo/arch1/1_33_733960822.arc recid=21 stamp=734853661
archive log filename=+RAC_DISK/demo/arch1/1_34_733960822.arc recid=22 stamp=735186059
archive log filename=+RAC_DISK/demo/arch1/1_35_733960822.arc recid=24 stamp=736122405
archive log filename=+RAC_DISK/demo/arch1/1_36_733960822.arc recid=26 stamp=736128062
channel t2: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb_archlog_RACDB.25 tag=TAG20110212T032711 comment=NONE
channel t2: backup set complete, elapsed time: 00:00:34
channel t2: deleting archive log(s)
archive log filename=+RAC_DISK/demo/arch1/1_37_733960822.arc recid=29 stamp=740443359
archive log filename=+RAC_DISK/demo/arch1/1_38_733960822.arc recid=30 stamp=740698724
archive log filename=+RAC_DISK/demo/arch1/1_39_733960822.arc recid=32 stamp=740700530
archive log filename=+RAC_DISK/demo/arch1/1_40_733960822.arc recid=34 stamp=741936596
archive log filename=+RAC_DISK/demo/arch1/1_41_733960822.arc recid=35 stamp=742704376
channel t1: starting archive log backupset
channel t1: specifying archive log(s) in backup set
input archive log thread=2 sequence=15 recid=31 stamp=740698669
input archive log thread=2 sequence=16 recid=33 stamp=741936592
input archive log thread=2 sequence=17 recid=36 stamp=742704313
input archive log thread=2 sequence=18 recid=38 stamp=742867196
input archive log thread=2 sequence=19 recid=40 stamp=742879619
input archive log thread=2 sequence=20 recid=43 stamp=742879551
channel t1: starting piece 1 at 12-FEB-11
channel t3: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb_archlog_RACDB.26 tag=TAG20110212T032711 comment=NONE
channel t3: backup set complete, elapsed time: 00:00:37
channel t3: deleting archive log(s)
archive log filename=+RAC_DISK/demo/arch1/1_42_733960822.arc recid=37 stamp=742794563
archive log filename=+RAC_DISK/demo/arch1/1_43_733960822.arc recid=39 stamp=742867506
archive log filename=+RAC_DISK/demo/arch1/1_44_733960822.arc recid=41 stamp=742879620
archive log filename=+RAC_DISK/demo/arch1/1_45_733960822.arc recid=42 stamp=742879627
archive log filename=+RAC_DISK/demo/arch1/2_11_733960822.arc recid=23 stamp=735186071
archive log filename=+RAC_DISK/demo/arch2/2_12_733960822.arc recid=25 stamp=736122459
archive log filename=+RAC_DISK/demo/arch2/2_13_733960822.arc recid=27 stamp=740440406
archive log filename=+RAC_DISK/demo/arch2/2_14_733960822.arc recid=28 stamp=740443249
channel t1: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb_archlog_RACDB.27 tag=TAG20110212T032711 comment=NONE
channel t1: backup set complete, elapsed time: 00:00:07
channel t1: deleting archive log(s)
archive log filename=+RAC_DISK/demo/arch2/2_15_733960822.arc recid=31 stamp=740698669
archive log filename=+RAC_DISK/demo/arch1/2_16_733960822.arc recid=33 stamp=741936592
archive log filename=+RAC_DISK/demo/arch2/2_17_733960822.arc recid=36 stamp=742704313
archive log filename=+RAC_DISK/demo/arch2/2_18_733960822.arc recid=38 stamp=742867196
archive log filename=+RAC_DISK/demo/arch1/2_19_733960822.arc recid=40 stamp=742879619
archive log filename=+RAC_DISK/demo/arch2/2_20_733960822.arc recid=43 stamp=742879551
Finished backup at 12-FEB-11
released channel: t1
released channel: t2
released channel: t3
allocated channel: node1
channel node1: sid=129 instance=RACDB1 devtype=DISK
Starting backup at 12-FEB-11
channel node1: starting full datafile backupset
channel node1: specifying datafile(s) in backupset
including current control file in backupset
channel node1: starting piece 1 at 12-FEB-11
channel node1: finished piece 1 at 12-FEB-11
piece handle=/opt/ora10g/rman/racdb_control_RACDB_28_1_1 tag=TAG20110212T032800 comment=NONE
channel node1: backup set complete, elapsed time: 00:00:04
Finished backup at 12-FEB-11
released channel: node1
RMAN>
至此备份完成
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10771/viewspace-1045843/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10771/viewspace-1045843/