Option 1
vi rmanbackup.sh
#!/bin/bash
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
BACKUP_LOG_PATH=/home/oracle/myproject
export ORACLE_BASE
export ORACLE_HOME
export ORACLE_SID=ORCL
export BACKUP_LOG_PATH
LOG_FILE=${BACKUP_LOG_PATH}/backup_db.log
$ORACLE_HOME/bin/rman msglog=${LOG_FILE} << EOF
connect target /
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
backup database format '/u02/oracle/backup/ORCL/database_%d_%u_%s';
release channel t1;
release channel t2;
release channel t3;
sql 'alter system archive log current';
allocate channel a1 type disk;
allocate channel a2 type disk;
allocate channel a3 type disk;
backup archivelog all format '/u02/oracle/backup/ORCL/arch_%d_%u_%s';
release channel a1;
release channel a2;
release channel a3;
allocate channel c1 type disk;
backup current controlfile for standby format '/u02/oracle/backup/ORCL/Control_%d_%u_%s';
release channel c1;
}
exit;
EOF
vi rmanbackup.sh
#!/bin/bash
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
BACKUP_LOG_PATH=/home/oracle/myproject
export ORACLE_BASE
export ORACLE_HOME
export ORACLE_SID=ORCL
export BACKUP_LOG_PATH
LOG_FILE=${BACKUP_LOG_PATH}/backup_db.log
$ORACLE_HOME/bin/rman msglog=${LOG_FILE} << EOF
connect target /
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
backup database format '/u02/oracle/backup/ORCL/database_%d_%u_%s';
release channel t1;
release channel t2;
release channel t3;
sql 'alter system archive log current';
allocate channel a1 type disk;
allocate channel a2 type disk;
allocate channel a3 type disk;
backup archivelog all format '/u02/oracle/backup/ORCL/arch_%d_%u_%s';
release channel a1;
release channel a2;
release channel a3;
allocate channel c1 type disk;
backup current controlfile for standby format '/u02/oracle/backup/ORCL/Control_%d_%u_%s';
release channel c1;
}
exit;
EOF
No comments:
Post a Comment