An example of an Rman backup script for Oracle databases

Source: Internet
Author: User
Tags log oracle database backup

In an Oracle database, Rman backs up a lot of scripts, and here's a case of how a shell script can be backed up by Rman, and FTP uploads the Rman backup file and the archive log file script.

fullback.sh inside call rman command do database backup, it uses Cmdfile for/HOME/ORACLE/BACKUP/BIN/FULLBACK.RCV, while in/home/oracle/backup/ Log files are generated in the logs directory.

1: [Oracle@db-server bin]$ more fullback.sh
 2:  
 3:#!/bin/bash
 4:  
 5:export oracle_base=/u01/app/ Oracle
 6:  
 7:export Oracle_sid=gps
 8:  
 9:oracle_home= $ORACLE _base/product/10.2.0/db_1; export Oracle_home
:  
11:tmp=/tmp export TMP
:  
13:tmpdir= $TMP; export tmpdir
:  
15:path =/usr/sbin: $PATH; Export path
:  
17:path= $ORACLE _home/bin: $PATH; export path
:  
19:ld_library_path= $ORACLE _ Home/lib:/lib:/usr/lib; Export Ld_library_path
:  
21:classpath= $ORACLE _home/jre: $ORACLE _home/jlib: $ORACLE _home/rdbms/jlib;  
23:export CLASSPATH:  
25:today= ' Date +%y_%m_%d '
:  
27:rman nocatalog Target/ CMDFILE/HOME/ORACLE/BACKUP/BIN/FULLBACK.RCV Log/home/oracle/backup/logs/fullbackup_$today.log
:  
29: /home/oracle/backup/bin/ftpbackup.sh
30:  

The Fullback.rcv file is very simple, as follows:

1: [Oracle@db-server bin]$ MORE/HOME/ORACLE/BACKUP/BIN/FULLBACK.RCV
 2:  
 3:run{
 4:  
 5:allocate Channel C4 type disk;
 6:  
 7:backup as compressed backupset
 8:  
 9:skip inaccessible
:  
11:tag Fullbackupwitharchivelog :  
(database);
:  
15:backup current controlfile;
:  
17:backup SPFile;  
19:sql "alter system archive log current";
£  
21:delete noprompt obsolete;
:  
23:release channel C4;
:
26:  
Related Article

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.