krati bhargava asked 1 year ago
Title : Please provide Oracle database sample backup and restoration scripts

Question :

Please provide Oracle database sample backup and restoration scripts.

1 Answers
anubhavanubhav Staff answered 1 year ago

Hi, 
Please find a sample script below.

#!/bin/sh
 
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
 
ORACLE_HOSTNAME=cubnsbl1; export ORACLE_HOSTNAME
ORACLE_UNQNAME=SBLDB; export ORACLE_UNQNAME
ORACLE_BASE=/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=SBLDB; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
 
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH export PATH                                                                                                                                                              
 
 
export ORACLE_SID=SBLDB
mkdir -p /app/db_backup/`date ‘+%Y-%m-%d’`
rman target=/ << EOF
run{
shutdown immediate;
startup mount;
backup as compressed backupset filesperset 8 database tag=’Daily’
format ‘/app/db_backup/`date ‘+%Y-%m-%d’`/%d_%u_%s_%p’;
backup current controlfile format ‘/app/db_backup/`date ‘+%Y-%m-%d’`/%U’;
alter database open;
}
EXIT;
EOF

Cubastion is among a very small number of specialized Siebel CRM Oracle Gold Partners in SME.