Linux Rman Shell

Source: Internet
Author: User

# 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: [Email protected]export oracle_home=/or Acle/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 timeIs ' Date '. * * * * *  

[Email protected] scripts]$./rman_backup_sh

# Add Crontab Job

[Email protected] rman]# Ll-rth

-RW-R-----1 Oracle oinstall 626M June 13:19 Pora40_db_lv0_20130626_13_bak
-RW-R-----1 Oracle oinstall 166K June 13:19 Pora40_arh_lv0_20130626_16_bak
-RW-R-----1 Oracle oinstall 9.4M June 13:19 Pora40_ctrl_20130626_18_bak

Linux Rman Shell

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.