一、RMAN管理RAC归档方法如下:
1)归档在本地
run {
ALLOCATE CHANNEL D1 TYPE DISK CONNECT 'SYS/oracle@doudou1';
ALLOCATE CHANNEL D2 TYPE DISK CONNECT 'SYS/oracle@doudou2';
crosscheck archivelog all;
...}
2)归档在共享目录
run {
crosscheck archivelog all;
...}
二、实验
1.RMAN默认配置如下
RMAN> show all;
RMAN configuration parameters for database with db_unique_name DOUDOU 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 MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/Oracle/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_doudou1.f'; # default
2.归档不同位置备份脚本有所不同
2-1.归档在本地
思路如下:
修改PARALLELISM 1 =》PARALLELISM 2 (我的RAC是2个节点所以是2)
添加CONFIGURE CHANNEL
详细步骤如下:
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK connect 'SYS/oracle@doudou1';
new RMAN configuration parameters:
CONFIGURE CHANNEL 1 DEVICE TYPE DISK CONNECT '*';
new RMAN configuration parameters are successfully stored
RMAN> CONFIGURE CHANNEL 2 DEVICE TYPE DISK connect 'SYS/oracle@doudou2';
new RMAN configuration parameters:
CONFIGURE CHANNEL 2 DEVICE TYPE DISK CONNECT '*';
new RMAN configuration parameters are successfully stored
修改后配置如下:
RMAN> show all;
RMAN configuration parameters for database with db_unique_name DOUDOU 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 2 BACKUP TYPE TO BACKUPSET; 《=已修改
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK CONNECT '*'; 《=新添加
CONFIGURE CHANNEL 2 DEVICE TYPE DISK CONNECT '*'; 《=新添加
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_doudou1.f'; # default
这个时候就可以使用RMAN管理归档了。
List of Archived Log Copies for database with db_unique_name DOUDOU
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - --------------------
773 1 441 A 16-SEP-2014 10:40:13
Name: /home/oracle/arch_rac1/1_441_852991268.dbf
774 2 343 A 16-SEP-2014 10:40:10
Name: /home/oracle/arch_rac2/2_343_852991268.dbf
Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=/home/oracle/arch_rac1/1_441_852991268.dbf RECID=773 STAMP=858426701
Deleted 1 objects
deleted archived log
archived log file name=/home/oracle/arch_rac2/2_343_852991268.dbf RECID=774 STAMP=858426703
Deleted 1 objects
released channel: D1
released channel: D2
List of Archived Log Copies for database with db_unique_name DOUDOU
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - --------------------
776 1 442 A 16-SEP-2014 11:51:40
Name: +DATA/doudou/archivelog/2014_09_16/thread_1_seq_442.342.858436879
775 2 344 A 16-SEP-2014 11:51:43
Name: +DATA/doudou/archivelog/2014_09_16/thread_2_seq_344.312.858436877
Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=+DATA/doudou/archivelog/2014_09_16/thread_1_seq_442.342.858436879 RECID=776 STAMP=858436882
deleted archived log
archived log file name=+DATA/doudou/archivelog/2014_09_16/thread_2_seq_344.312.858436877 RECID=775 STAMP=858436877
Deleted 2 objects