Oracle Database数据库完整备份与日志备份

Posted dbamonkey

tags:

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

[oracle@wallet01 ~]$ cat /home/oracle/script/full_backup.sh
#!/bin/bash
if [ -f ~/.bash_profile ];
then
  . ~/.bash_profile
fi
export SH_HOME=/home/oracle/script
rman target / @$SH_HOME/full_backup.sql

[oracle@wallet01 ~]$ cat /home/oracle/script/full_backup.sql
RUN {
BACKUP INCREMENTAL LEVEL=0 DATABASE
FORMAT ‘/home/oracle/backup/gstadb_full_backup_%s_%p_%T‘
PLUS ARCHIVELOG
FORMAT ‘/home/oracle/backup/gstadb_arch_backup_%s_%p_%T‘ delete all input;
DELETE NOPROMPT OBSOLETE;
CROSSCHECK BACKUP;
DELETE EXPIRED BACKUP;
}

[oracle@wallet01 ~]$ cat /home/oracle/script/arch_backup.sh
#!/bin/bash
if [ -f ~/.bash_profile ];
then
  . ~/.bash_profile
fi
export SH_HOME=/home/oracle/script
rman target / @$SH_HOME/arch_backup.sql

[oracle@wallet01 ~]$ cat /home/oracle/script/arch_backup.sql
RUN {
sql ‘alter system archive log current‘;
BACKUP ARCHIVELOG ALL FORMAT ‘/home/oracle/backup/gstadb_arch_backup_%s_%p_%T‘;
DELETE NOPROMPT OBSOLETE;
CROSSCHECK BACKUP;
DELETE EXPIRED BACKUP;
}

[oracle@wallet01 ~]$ cat /home/oracle/script/day_backup.sh
#!/bin/bash
mkdir -p /home/oracle/day_backup/`date ‘+%Y%m%d‘`
cp -p /home/oracle/backup/* /home/oracle/day_backup/`date ‘+%Y%m%d‘`
find /home/oracle/day_backup/ -type d -mtime +6 -exec rm -rf {} ;

[oracle@wallet01 ~]$ crontab -l
0 0 * * * /home/oracle/script/oracle_backup.sh
*/10 1-23 * * * /home/oracle/script/log_backup.sh
55 23 * * * /home/oracle/script/day_backup.sh

 

以上是关于Oracle Database数据库完整备份与日志备份的主要内容,如果未能解决你的问题,请参考以下文章

Oracle Database 11g RMAN备份与恢复50MB完整版下载

oracle 归档日志

sqlserver数据库的备份与还原——完整备份与还原

Oracle数据库用户数据完整备份与恢复

SQL 数据库的备份与恢复

Oracle - 备份与恢复