An example of automatic RMAN backup script

Source: Internet
Author: User
1. Oracle scheduled task: crontab-e ***** homeoracleworkspacescriptsbk_main.shgt; gt; homeoracleworkspacelogbk

1. Oracle scheduled task: crontab-e *****/home/oracle/workspace/scripts/bk_main.shgt; gt;/home/oracle/workspace/log/bk

Homepage → Database Technology

Background:

Read News

An example of automatic RMAN backup script

[Date:] Source: Linux Author: renfengjun [Font:]

1. Oracle scheduled task:

Crontab-e

* ***/Home/oracle/workspace/scripts/bk_main.sh>/home/oracle/workspace/log/bk_err.log 2> & 1

2. Main Control Program

/Home/oracle/workspace/scripts/bk_main.sh

#! /Bin/bash

Dat = 'date + '% m''

If ($ dat = 0 ))

Then

/Home/oracle/workspace/scripts/bk _. sh 0

Elif ($ dat % 50 = 0 ))

Then

/Home/oracle/workspace/scripts/bk _. sh 2

Elif ($ dat % 40 = 0 ))

Then

/Home/oracle/workspace/scripts/bk _. sh 2

Elif ($ dat % 30 = 0 ))

Then

/Home/oracle/workspace/scripts/bk _. sh 1

Elif ($ dat % 20 = 0 ))

Then

/Home/oracle/workspace/scripts/bk _. sh 2

Elif ($ dat % 10 = 0 ))

Then

/Home/oracle/workspace/scripts/bk _. sh 2

Fi

3. Detailed backup script

Note: 'date + '% Y % m % d % k % m' | awk' {print $1 $2} ''indicates the yyyymmddhh24mi format of the current time.

/Home/oracle/workspace/scripts/bk _. sh

#! /Bin/bash

# This is a import statement.

PATH = $ PATH: $ HOME/bin

Export PATH

Export ORACLE_SID = dex

Export ORACLE_BASE =/u01/apps/oracle

Export ORACLE_HOME = $ ORACLE_BASE/product/11gr2/db_1

Export PATH = $ ORACLE_HOME/bin: $ PATH

# Use awk to cut the space char

Timst = 'date + '% Y % m % d % k % m' | awk' {print $1 $2 }''

# Use for debug

# Echo $ timst

# Create a directory like 201112140112

Mkdir/u01/backup/DEX/backups/$ timst

# Rman backup scripts

Rman target sys/xiaojun @ dex log =/home/oracle/workspace/log/rmanlog/rman _ $ timst <

Run {

Allocate channel dev1 type disk;

Allocate channel dev2 type disk;

Backup incremental level 1 database format'/u01/backup/DEX/backups/$ timst/bk _ % t _ % s' plus archivelog format'/u01/backup/DEX/backups/ $ timst/arc _ % t _ % s' delete all input;

Crosscheck backup;

Delete noprompt obsolete;

Delete noprompt expired backup;

}

EOF


Do not forget to create a directory.

  • 0
  • In the RAC environment, the creation of spfile causes inconsistent database parameters between nodes.

    Remote database recovery using RMAN backup piece Information

    Related information RMAN

    Image Information

    View All comments in this article (0)

    Comments

    Latest Information

    Popular this week

    Introduction to Linux community-advertisement service-website map-help Info-contact us
    The articles published on this site (LinuxIDC) do not mean that they agree with the statement or description. They only provide more information and do not constitute any suggestions.


    Copyright©2006-2014 Linux community All rights reserved Zhejiang ICP backup No. 06018118

    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.