Oracle RAC 利用RMAN自動排程備份
1. 環境
[root@rhel1 bin]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
2. 伺服器
rhel1:172.168.6.111
rhel2:172.168.6.112
3. 配置NFS
3.1. rhel1,rhel2執行
[root@rhel1 bin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
172.168.6.111 rhel1
172.168.6.112 rhel2
10.0.0.111 rhel1-priv
10.0.0.112 rhel2-priv
172.168.6.121 rhel1-vip
172.168.6.122 rhel2-vip
10.0.0.111 nas1
10.0.0.112 nas2
3.2. rhel1,rhel2執行
[root@rhel1 bin]# cat /etc/exports
/u02 *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
3.3. rhel1,rhel2執行
[root@rhel1 bin]# cat /etc/fstab
nas1:/u02 /u01/backup01 nfs rw 0 0
nas2:/u02 /u01/backup02 nfs rw 0 0
3.4. rhel1,rhel2執行
[root@rhel1 bin]# mount
nas1:/u02 on /u01/backup01 type nfs (rw,addr=10.0.0.111)
nas2:/u02 on /u01/backup02 type nfs (rw,addr=10.0.0.112)
4. RMAN配置
[root@rhel1 bin]# su - oracle
[oracle@rhel1 ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Wed Apr 7 04:04:59 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RACTEST (DBID=3230313564)
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/backup01/rman/RACTEST_%s_%p_%T.RMAN', '/u01/backup02/rman/RACTEST_%s_%p_%T.RMAN';
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 '/u01/app/oracle/db_1/dbs/snapcf_ractest1.f'; # default
5. 自動備份指令碼
5.1. level 0級別備份:
5.1.1.
[oracle@rhel1 u01]$ cat rmanBackupL0
run{
crosscheck archivelog all;
sql 'alter system archive log thread 1 current';
sql 'alter system archive log thread 2 current';
backup as compressed backupset incremental level 0 database;
delete noprompt archivelog all;
sql 'alter system archive log thread 1 current';
sql 'alter system archive log thread 2 current';
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
delete noprompt backup of archivelog all;
backup current controlfile;
sql 'alter database backup controlfile to trace';
}
5.1.2.
[oracle@rhel1 u01]$ cat rmanBackupL0.sh
#!/bin/sh
export ORACLE_HOME=/u01/app/oracle/db_1
export ORACLE_SID=ractest1
/u01/app/oracle/db_1/bin/rman target / nocatalog cmdfile=/u01/rmanBackupL0 log=/u01/rmanBackupL0.log append
5.1.3.
[oracle@rhel1 u01]$ crontab -l
*/30 * * * * sh /u01/rmanBackupL0.sh
5.2. level 1級備份:
5.2.1.
[oracle@rhel1 u01]$ cat rmanBackupL1
run{
crosscheck archivelog all;
sql 'alter system archive log thread 1 current';
sql 'alter system archive log thread 2 current';
backup as compressed backupset incremental level 1 database;
delete noprompt archivelog all;
sql 'alter system archive log thread 1 current';
sql 'alter system archive log thread 2 current';
crosscheck backup;
delete noprompt backup of archivelog all;
backup current controlfile;
sql 'alter database backup controlfile to trace';
}
5.2.2.
[oracle@rhel1 u01]$ cat rmanBackupL1.sh
#!/bin/sh
export ORACLE_HOME=/u01/app/oracle/db_1
export ORACLE_SID=ractest1
/u01/app/oracle/db_1/bin/rman target / nocatalog cmdfile=/u01/rmanBackupL1 log=/u01/rmanBackupL1.log append
5.2.3.
[oracle@rhel1 u01]$ crontab -l
*/30 * * * * sh /u01/rmanBackupL0.sh
*/10 * * * * sh /u01/rmanBackupL1.sh
[root@rhel1 bin]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
2. 伺服器
rhel1:172.168.6.111
rhel2:172.168.6.112
3. 配置NFS
3.1. rhel1,rhel2執行
[root@rhel1 bin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
172.168.6.111 rhel1
172.168.6.112 rhel2
10.0.0.111 rhel1-priv
10.0.0.112 rhel2-priv
172.168.6.121 rhel1-vip
172.168.6.122 rhel2-vip
10.0.0.111 nas1
10.0.0.112 nas2
3.2. rhel1,rhel2執行
[root@rhel1 bin]# cat /etc/exports
/u02 *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
3.3. rhel1,rhel2執行
[root@rhel1 bin]# cat /etc/fstab
nas1:/u02 /u01/backup01 nfs rw 0 0
nas2:/u02 /u01/backup02 nfs rw 0 0
3.4. rhel1,rhel2執行
[root@rhel1 bin]# mount
nas1:/u02 on /u01/backup01 type nfs (rw,addr=10.0.0.111)
nas2:/u02 on /u01/backup02 type nfs (rw,addr=10.0.0.112)
4. RMAN配置
[root@rhel1 bin]# su - oracle
[oracle@rhel1 ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Wed Apr 7 04:04:59 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RACTEST (DBID=3230313564)
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/backup01/rman/RACTEST_%s_%p_%T.RMAN', '/u01/backup02/rman/RACTEST_%s_%p_%T.RMAN';
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 '/u01/app/oracle/db_1/dbs/snapcf_ractest1.f'; # default
5. 自動備份指令碼
5.1. level 0級別備份:
5.1.1.
[oracle@rhel1 u01]$ cat rmanBackupL0
run{
crosscheck archivelog all;
sql 'alter system archive log thread 1 current';
sql 'alter system archive log thread 2 current';
backup as compressed backupset incremental level 0 database;
delete noprompt archivelog all;
sql 'alter system archive log thread 1 current';
sql 'alter system archive log thread 2 current';
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
delete noprompt backup of archivelog all;
backup current controlfile;
sql 'alter database backup controlfile to trace';
}
5.1.2.
[oracle@rhel1 u01]$ cat rmanBackupL0.sh
#!/bin/sh
export ORACLE_HOME=/u01/app/oracle/db_1
export ORACLE_SID=ractest1
/u01/app/oracle/db_1/bin/rman target / nocatalog cmdfile=/u01/rmanBackupL0 log=/u01/rmanBackupL0.log append
5.1.3.
[oracle@rhel1 u01]$ crontab -l
*/30 * * * * sh /u01/rmanBackupL0.sh
5.2. level 1級備份:
5.2.1.
[oracle@rhel1 u01]$ cat rmanBackupL1
run{
crosscheck archivelog all;
sql 'alter system archive log thread 1 current';
sql 'alter system archive log thread 2 current';
backup as compressed backupset incremental level 1 database;
delete noprompt archivelog all;
sql 'alter system archive log thread 1 current';
sql 'alter system archive log thread 2 current';
crosscheck backup;
delete noprompt backup of archivelog all;
backup current controlfile;
sql 'alter database backup controlfile to trace';
}
5.2.2.
[oracle@rhel1 u01]$ cat rmanBackupL1.sh
#!/bin/sh
export ORACLE_HOME=/u01/app/oracle/db_1
export ORACLE_SID=ractest1
/u01/app/oracle/db_1/bin/rman target / nocatalog cmdfile=/u01/rmanBackupL1 log=/u01/rmanBackupL1.log append
5.2.3.
[oracle@rhel1 u01]$ crontab -l
*/30 * * * * sh /u01/rmanBackupL0.sh
*/10 * * * * sh /u01/rmanBackupL1.sh
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23135684/viewspace-631346/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle Windows平臺自動排程備份指令碼OracleWindows指令碼
- TSM ORACLE 備份排程Oracle
- AIX/Linux生產環境下crontab自動排程RMAN物理備份例子AILinux
- Rman-ORACLE資料庫RMAN實現自動備份Oracle資料庫
- RMAN自動備份任務新增
- rman 自動備份指令碼-windows指令碼Windows
- Oracle 11g EXPDP、RMAN自動備份SHELL指令碼Oracle指令碼
- windows下rman自動備份指令碼Windows指令碼
- rman備份rac的總結
- oracle rac 備份Oracle
- [Rman]Oracle 11g控制檔案延遲自動備份Oracle
- Aix下使用rman備份Oracle RAC資料庫(轉)AIOracle資料庫
- oracle之rman備份Oracle
- Oracle RMAN 增量備份Oracle
- oracle rman備份命令Oracle
- 【轉】Oracle rman備份Oracle
- redhat下通過rman自動備份db!Redhat
- TSM+RMAN 自動備份指令碼 on aix指令碼AI
- 如何利用Rman對Oracle資料庫進行備份Oracle資料庫
- ORACLE RAC叢集 RMAN自動備份controlfile失敗之ORA-00245&ORA-27037Oracle
- oracle rman不能自動刪除歸檔日誌備份解決Oracle
- 利用RMAN備份重建資料庫資料庫
- RAC模式下的備份策略以及RMAN備份指令碼模式指令碼
- Oracle 11g RMAN備份-增量備份Oracle
- ORACLE利用STANDBY端RMAN備份進行資料恢復Oracle資料恢復
- Oracle RMAN備份實戰Oracle
- Oracle OCP(60):RMAN 備份Oracle
- oracle RMAN備份指令碼Oracle指令碼
- oracle11g 新特性 - rman自動備份控制檔案延遲Oracle
- RAC模式下的備份策略以及RMAN備份指令碼(轉)模式指令碼
- RAC模式下的備份策略以及RMAN備份指令碼(ZF)模式指令碼
- oracle自動冷備份指令碼Oracle指令碼
- ORACLE自動備份shell指令碼Oracle指令碼
- 自動備份Oracle資料庫Oracle資料庫
- Oracle自動備份資料(轉)Oracle
- Oracle 11g RMAN備份-備份標籤Oracle
- Networker備份oracle racOracle
- linux下自動備份oracle資料庫-rmanLinuxOracle資料庫