博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux rman shell
阅读量:5042 次
发布时间:2019-06-12

本文共 2509 字,大约阅读时间需要 8 分钟。

# make direcory for backset file and scripts file,in my case /backup/db_bak

cd   /backup/db_bak

mkdir  scripts logs rman

#  the following is contents of  rman_backup_sh

vi  /backup/db_bak/scripts/rman_backup_sh

#!/bin/bash# author: anbob.com# desc: rman backup database level 0 # contact: weejar@gmail.comexport ORACLE_HOME=/oracle/product/11.2.0/db_1export ORACLE_SID=pora40RMAN_LOG_FILE=/backup/db_bak/logs/rman_database_backup.`date +%y%m%d%H%M`.out# -----------------------------------------------------------------# Initialize the log file.# -----------------------------------------------------------------echo>> $RMAN_LOG_FILEchmod 666 $RMAN_LOG_FILEecho Script $0>> $RMAN_LOG_FILEecho ==== started on `date` ====>> $RMAN_LOG_FILEecho>> $RMAN_LOG_FILEORACLE_USER=oracleRMAN=$ORACLE_HOME/bin/rmanBACKUP_TYPE="INCREMENTAL LEVEL 0"# ---------------------------------------------------------------------------# Print out the value of the variables set by this script.# ---------------------------------------------------------------------------echo>> $RMAN_LOG_FILEecho "RMAN: $RMAN">> $RMAN_LOG_FILEecho "ORACLE_SID: $ORACLE_SID">> $RMAN_LOG_FILEecho "ORACLE_USER: $ORACLE_USER">> $RMAN_LOG_FILEecho "ORACLE_HOME: $ORACLE_HOME">> $RMAN_LOG_FILEecho "BACKUP_TYPE: $BACKUP_TYPE">> $RMAN_LOG_FILE# ---------------------------------------------------------------------------echo >> $RMAN_LOG_FILEexec 1>> $RMAN_LOG_FILE 2>&1$RMAN target / nocatalog  <<-EOFRUN { ALLOCATE CHANNEL ch00 TYPE disk; ALLOCATE CHANNEL ch01 TYPE disk; BACKUP $BACKUP_TYPE SKIP INACCESSIBLE TAG hot_db_bk_level0 FORMAT '/backup/db_bak/rman/pora40_db_lv0_%T_%s_bak' DATABASE; RELEASE CHANNEL ch00; RELEASE CHANNEL ch01; ALLOCATE CHANNEL ch00 TYPE disk; ALLOCATE CHANNEL ch01 TYPE disk; BACKUP SKIP INACCESSIBLE FORMAT '/backup/db_bak/rman/pora40_arh_lv0_%T_%s_bak' ARCHIVELOG ALL DELETE INPUT; RELEASE CHANNEL ch00; RELEASE CHANNEL ch01; BACKUP  CURRENT CONTROLFILE FORMAT '/backup/db_bak/rman/pora40_ctrl_%T_%s_bak'; crosscheck backup; report obsolete; delete noprompt force obsolete; } EOFecho "****ATTN: Database backup is finished.  The time is `date`.****"

[oracle@dbserver40 scripts]$ ./rman_backup_sh

# add crontab job

[root@dbserver40 rman]# ll -rth

-rw-r----- 1 oracle oinstall 626M Jun 26 13:19 pora40_db_lv0_20130626_13_bak

-rw-r----- 1 oracle oinstall 166K Jun 26 13:19 pora40_arh_lv0_20130626_16_bak
-rw-r----- 1 oracle oinstall 9.4M Jun 26 13:19 pora40_ctrl_20130626_18_bak

转载于:https://www.cnblogs.com/travel6868/p/5015521.html

你可能感兴趣的文章