Oracle 11g new feature: replace variables in the RMAN script

Source: Internet
Author: User

Oracle 11g has a new feature. Replace the variable in the RMAN script. Today, I did a small experiment on the server and tried this feature. Although some errors have been made, all of them have been solved! I feel that this feature is still good. Let's start with the question below.
 
1. Create a directory for storing scripts and backup files
 
$ Cd/u01
 
$ Mkdir-p oraclescripts/backup/dynamic
 
$ Mkdir/u01/backupfiles
 
2. Create related scripts
 
$ Cd/u01/oraclescripts/backup/dynamic
 
$ Vi backup. cmd
 
Add the following command:

# Backup. cmd
Connect target/
Run {
Backup datafile 5
Tag = & 1
Format '& 2 ';
}
Exit;

This is an RMAN command, which will be called using a shell script later. The following is a shell script:

$ Vi nightly_backup.sh
 
Add the following command:

#! /Bin/bash

Tag = $1
Format = $2
Rman @ backup. cmd using $ tag $ format

OK, let's execute this shell script,

$ Sh nightly_backup.sh testtag \ '/u01/backupfiles/file5.bk \'
 
I use two parameters. The first is the Tag, and the second is the path to be backed up. After obtaining two parameters, the shell script executes @ backup. when cmd is used, the two parameters are passed in to & 1 and & 2. In this experiment, we back up the data file no. 5. You can customize the backup policy.
 
Although this experiment is small, it is also difficult for me to do it. google has done it several times. For example, when passing parameters, we need to use \ escape and add the = sign after the tag. In short, although the experiment is small, but I have learned a lot. Here I will share with you, hoping to help new users. My references are chapter 4, section 10th, in RMAN Recipes for Oracle Database 11g.

RMAN Recipes for Oracle Database 11g pdf download see

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.