Oracle DatabaseOracle RMAN备份

Posted dbamonkey

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle DatabaseOracle RMAN备份相关的知识,希望对你有一定的参考价值。

[oracle@monkey01 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 26 13:48:45 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: MONKEY (DBID=1085070409)

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/home/oracle/backup/%F‘;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/home/oracle/backup/%F‘;
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO COMPRESSED BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO COMPRESSED BACKUPSET;
new RMAN configuration parameters are successfully stored

数据库完整备份
[oracle@monkey01 ~]$ mkdir backup
[oracle@monkey01 ~]$ vi full_backup.sql
RUN {
BACKUP INCREMENTAL LEVEL=0 TAG ‘soe_full_backup‘ DATABASE
FORMAT ‘/home/oracle/backup/soe_full_backup_%s_%p_%T‘
PLUS ARCHIVELOG
FORMAT ‘/home/oracle/backup/soe_arch_backup_%s_%p_%T‘ delete all input;
DELETE NOPROMPT OBSOLETE;
CROSSCHECK BACKUP;
DELETE EXPIRED BACKUP;
}

数据库增量备份
[oracle@monkey01 ~]$ vi incr_backup.sql
RUN {
BACKUP INCREMENTAL LEVEL=1 TAG ‘soe_incr_backup‘ DATABASE
FORMAT ‘/home/oracle/backup/soe_incr_backup_%s_%p_%T‘
PLUS ARCHIVELOG
FORMAT ‘/home/oracle/backup/soe_arch_backup_%s_%p_%T‘ delete all input;
DELETE NOPROMPT OBSOLETE;
CROSSCHECK BACKUP;
DELETE EXPIRED BACKUP;
}

[oracle@monkey01 ~]$ mkdir logs
[oracle@monkey01 ~]$ vi oracle_backup.sh
#!/bin/bash
if [ -f ~/.bash_profile ];
then
  . ~/.bash_profile
fi
export SH_HOME=/home/oracle
DATE=`date ‘+%Y%m%d%H‘`
WEEK=`date ‘+%A‘`
if [ "$WEEK" = "Sunday" ]
then
rman target / @$SH_HOME/full_backup.sql log=$SH_HOME/logs/full_backup_${DATE}.log
else
rman target / @$SH_HOME/incr_backup.sql log=$SH_HOME/logs/incr_backup_${DATE}.log
fi

[oracle@monkey01 ~]$ chmod a+x oracle_backup.sh

[oracle@monkey01 ~]$ crontab -e
0 3 * * * /home/oracle/oracle_backup.sh

[oracle@monkey01 ~]$ crontab -l
0 3 * * * /home/oracle/oracle_backup.sh

[oracle@monkey01 ~]$ cd backup
[oracle@monkey01 backup]$ ls -ltrh
total 645M
-rw-r----- 1 oracle oinstall  73M Mar 25 03:00 soe_full_backup_25_1_20180325
-rw-r----- 1 oracle oinstall 207M Mar 25 03:01 soe_full_backup_24_1_20180325
-rw-r----- 1 oracle oinstall 351M Mar 25 03:01 soe_full_backup_23_1_20180325
-rw-r----- 1 oracle oinstall 4.0K Mar 25 03:01 soe_arch_backup_26_1_20180325
-rw-r----- 1 oracle oinstall 596K Mar 26 03:00 soe_arch_backup_28_1_20180326
-rw-r----- 1 oracle oinstall 3.5K Mar 26 03:00 soe_arch_backup_32_1_20180326
-rw-r----- 1 oracle oinstall  48K Mar 26 03:00 soe_incr_backup_31_1_20180326
-rw-r----- 1 oracle oinstall  48K Mar 26 03:00 soe_incr_backup_35_1_20180326
-rw-r----- 1 oracle oinstall 392K Mar 26 03:00 soe_incr_backup_34_1_20180326
-rw-r----- 1 oracle oinstall 392K Mar 26 03:00 soe_incr_backup_30_1_20180326
-rw-r----- 1 oracle oinstall 1.9M Mar 26 03:01 soe_incr_backup_29_1_20180326
-rw-r----- 1 oracle oinstall 1.9M Mar 26 03:01 soe_incr_backup_33_1_20180326
-rw-r----- 1 oracle oinstall  10K Mar 26 03:01 soe_arch_backup_36_1_20180326
-rw-r----- 1 oracle oinstall  10K Mar 26 03:01 soe_arch_backup_37_1_20180326
-rw-r----- 1 oracle oinstall 9.4M Mar 26 03:01 c-1072562510-20180326-01

[oracle@monkey01 ~]$ cd logs
[oracle@monkey01 logs]$ ls -ltrh
total 20K
-rw-r--r-- 1 oracle oinstall 8.8K Mar 25 03:01 full_backup_2018032503.log
-rw-r--r-- 1 oracle oinstall 7.5K Mar 26 03:01 incr_backup_2018032603.log

 

以上是关于Oracle DatabaseOracle RMAN备份的主要内容,如果未能解决你的问题,请参考以下文章

Oracle EBS 创建 RMA

Oracle--基础

数据库oracle [重复]

来自多个线程的 MPI RMA

juniper RMA坏件返还流程

xml Miva - 使用mvt:do生成RMA