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: