VERSION="1.0"
SCRIPT_NAME_FULL=$0
SCRIPT_NAME=${SCRIPT_NAME_FULL##*/}
START_DATE=`date`
DATE_LOG=`date +%y%m%d:%H%M`
HOSTNAME=`hostname`
HOSTNAME_UPPER=`hostname | tr -s '[:lower:]' '[:upper:]'`
# +----------------------------------------------------------------------------+
# | ************************************************************************** |
# | * DEFINE ALL GLOBAL FUNCTIONS * |
# | ************************************************************************** |
# +----------------------------------------------------------------------------+
showUsage() {
echo "USAGE:"
echo "rman_backup_hot_full.ksh "RMAN_USER" "RMAN_PASSWORD" "TARGET_DB""
echo " "
}
showSignonBanner() {
echo " "
echo "$SCRIPT_NAME - Version $VERSION"
echo "Copyright (c) 1998-2004 Jeffrey M. Hunter. All rights reserved."
echo " "
}
switchOracleEnv() {
DB_ENTRY_HOME="$1"
# +---------------------------------------------------------+
# | Ensure that "OLDHOME" is non-null. The following is a |
# | portable way of saying, if oracle_home is not set, then |
# | return a zero. this will then set OLDHOME to the $PATH |
# | variable. If ORACLE_HOME is set, then set OLDHOME to |
# | that of the old $ORACLE_HOME. Another way to perform |
# | this check is using a less portable statement: |
# | if [ ${ORACLE_HOME:-0} = 0 ]; then |
# +---------------------------------------------------------+
if [ ${ORACLE_HOME=0} = 0 ]; then
OLDHOME=$PATH
else
OLDHOME=$ORACLE_HOME
fi
# +--------------------------------------------------------+
# | Now that we backed up the old $ORACLE_HOME, lets set |
# | the environment with the new $ORACLE_HOME. |
# +--------------------------------------------------------+
ORACLE_HOME=$DB_ENTRY_HOME
export ORACLE_HOME
# +------------------------------------------+
# | Set $PATH |
# +------------------------------------------+
case "$PATH" in
*$OLDHOME/bin*) PATH=`echo $PATH | sed "s;$OLDHOME/bin;$DB_ENTRY_HOME/bin;g"` ;;
*$DB_ENTRY_HOME/bin*) ;;
*:) PATH=${PATH}$DB_ENTRY_HOME/bin: ;;
"") PATH=$DB_ENTRY_HOME/bin ;;
*) PATH=$PATH:$DB_ENTRY_HOME/bin ;;
esac
export PATH
# +------------------------------------------+
# | Set $LD_LIBRARY_PATH |
# +------------------------------------------+
case "$LD_LIBRARY_PATH" in
*$OLDHOME/lib*) LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed "s;$OLDHOME/lib;$DB_ENTRY_HOME/lib;g"` ;;
*$DB_ENTRY_HOME/lib*) ;;
*:) LD_LIBRARY_PATH=${LD_LIBRARY_PATH}$DB_ENTRY_HOME/lib: ;;
"") LD_LIBRARY_PATH=$DB_ENTRY_HOME/lib ;;
*) LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DB_ENTRY_HOME/lib ;;
esac
export LD_LIBRARY_PATH
ORACLE_DOC=$DB_ENTRY_HOME/doc
export ORACLE_DOC
ORACLE_PATH=$DB_ENTRY_HOME/rdbms/admin:$DB_ENTRY_HOME/sqlplus/admin:$HOME/common/bin
export ORACLE_PATH
ORA_NLS33=$DB_ENTRY_HOME/ocommon/nls/admin/data
export ORA_NLS33
TNS_ADMIN=$DB_ENTRY_HOME/network/admin
export TNS_ADMIN
}
getOSName() {
case `uname -s` in
*BSD)
UNIX_TYPE="bsd" ;;
SunOS)
case `uname -r` in
5.*) UNIX_TYPE="solaris" ;;
*) UNIX_TYPE"sunos" ;;
esac
;;
Linux)
UNIX_TYPE="linux" ;;
HP-UX)
UNIX_TYPE="hpux" ;;
AIX)
UNIX_TYPE="aix" ;;
*) UNIX_TYPE="unknown" ;;
esac
}
# +----------------------------------------------------------------------------+
# | ************************************************************************** |
# | * SCRIPT STARTS HERE * |
# | ************************************************************************** |
# +----------------------------------------------------------------------------+
showSignonBanner
if [[ $# -eq 3 ]]; then
export RMAN_USER=$1
export RMAN_PASSWORD=$2
export TARGET_DB=$3
else
showUsage
exit 2
fi
getOSName
if [[ $UNIX_TYPE = "linux" ]]; then
ORATAB_FILE="/etc/oratab"
elif [[ $UNIX_TYPE = "solaris" ]];then
ORATAB_FILE="/var/opt/oracle/oratab"
else
ORATAB_FILE="/etc/oratab"
fi
echo "======================================================"
echo "SCRIPT : $SCRIPT_NAME"
echo "VERSION : $VERSION"
echo "START TIME : $START_DATE"
echo "HOST : $HOSTNAME"
echo "UNIX TYPE : $UNIX_TYPE"
echo "TARGET DB : $TARGET_DB"
echo "RMAN USER : $RMAN_USER"
echo "======================================================"
echo " "
for DB_ENTRY in `cat ${ORATAB_FILE} | grep -v '^\#' | grep -v '^\*' | cut -d":" -f1,2`
do
ORACLE_SID=`echo $DB_ENTRY | cut -d":" -f1`
export ORACLE_SID
if [[ $ORACLE_SID = $TARGET_DB ]]; then
NEW_ORACLE_HOME=`echo $DB_ENTRY | cut -d":" -f2`
export NEW_ORACLE_HOME
switchOracleEnv $NEW_ORACLE_HOME
echo "======================================================"
echo " - Working on : ${ORACLE_SID} (${NEW_ORACLE_HOME})"
echo "======================================================"
echo " "
rman target "$RMAN_USER/$RMAN_PASSWORD" nocatalog <<EOF
backup database plus archivelog delete input;
delete noprompt force obsolete;
exit;
EOF
fi
done
END_DATE=`date`
echo "======================================================"
echo "FINISH TIME : $END_DATE"
echo "======================================================"
exit
SCRIPT_NAME_FULL=$0
SCRIPT_NAME=${SCRIPT_NAME_FULL##*/}
START_DATE=`date`
DATE_LOG=`date +%y%m%d:%H%M`
HOSTNAME=`hostname`
HOSTNAME_UPPER=`hostname | tr -s '[:lower:]' '[:upper:]'`
# +----------------------------------------------------------------------------+
# | ************************************************************************** |
# | * DEFINE ALL GLOBAL FUNCTIONS * |
# | ************************************************************************** |
# +----------------------------------------------------------------------------+
showUsage() {
echo "USAGE:"
echo "rman_backup_hot_full.ksh "RMAN_USER" "RMAN_PASSWORD" "TARGET_DB""
echo " "
}
showSignonBanner() {
echo " "
echo "$SCRIPT_NAME - Version $VERSION"
echo "Copyright (c) 1998-2004 Jeffrey M. Hunter. All rights reserved."
echo " "
}
switchOracleEnv() {
DB_ENTRY_HOME="$1"
# +---------------------------------------------------------+
# | Ensure that "OLDHOME" is non-null. The following is a |
# | portable way of saying, if oracle_home is not set, then |
# | return a zero. this will then set OLDHOME to the $PATH |
# | variable. If ORACLE_HOME is set, then set OLDHOME to |
# | that of the old $ORACLE_HOME. Another way to perform |
# | this check is using a less portable statement: |
# | if [ ${ORACLE_HOME:-0} = 0 ]; then |
# +---------------------------------------------------------+
if [ ${ORACLE_HOME=0} = 0 ]; then
OLDHOME=$PATH
else
OLDHOME=$ORACLE_HOME
fi
# +--------------------------------------------------------+
# | Now that we backed up the old $ORACLE_HOME, lets set |
# | the environment with the new $ORACLE_HOME. |
# +--------------------------------------------------------+
ORACLE_HOME=$DB_ENTRY_HOME
export ORACLE_HOME
# +------------------------------------------+
# | Set $PATH |
# +------------------------------------------+
case "$PATH" in
*$OLDHOME/bin*) PATH=`echo $PATH | sed "s;$OLDHOME/bin;$DB_ENTRY_HOME/bin;g"` ;;
*$DB_ENTRY_HOME/bin*) ;;
*:) PATH=${PATH}$DB_ENTRY_HOME/bin: ;;
"") PATH=$DB_ENTRY_HOME/bin ;;
*) PATH=$PATH:$DB_ENTRY_HOME/bin ;;
esac
export PATH
# +------------------------------------------+
# | Set $LD_LIBRARY_PATH |
# +------------------------------------------+
case "$LD_LIBRARY_PATH" in
*$OLDHOME/lib*) LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed "s;$OLDHOME/lib;$DB_ENTRY_HOME/lib;g"` ;;
*$DB_ENTRY_HOME/lib*) ;;
*:) LD_LIBRARY_PATH=${LD_LIBRARY_PATH}$DB_ENTRY_HOME/lib: ;;
"") LD_LIBRARY_PATH=$DB_ENTRY_HOME/lib ;;
*) LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DB_ENTRY_HOME/lib ;;
esac
export LD_LIBRARY_PATH
ORACLE_DOC=$DB_ENTRY_HOME/doc
export ORACLE_DOC
ORACLE_PATH=$DB_ENTRY_HOME/rdbms/admin:$DB_ENTRY_HOME/sqlplus/admin:$HOME/common/bin
export ORACLE_PATH
ORA_NLS33=$DB_ENTRY_HOME/ocommon/nls/admin/data
export ORA_NLS33
TNS_ADMIN=$DB_ENTRY_HOME/network/admin
export TNS_ADMIN
}
getOSName() {
case `uname -s` in
*BSD)
UNIX_TYPE="bsd" ;;
SunOS)
case `uname -r` in
5.*) UNIX_TYPE="solaris" ;;
*) UNIX_TYPE"sunos" ;;
esac
;;
Linux)
UNIX_TYPE="linux" ;;
HP-UX)
UNIX_TYPE="hpux" ;;
AIX)
UNIX_TYPE="aix" ;;
*) UNIX_TYPE="unknown" ;;
esac
}
# +----------------------------------------------------------------------------+
# | ************************************************************************** |
# | * SCRIPT STARTS HERE * |
# | ************************************************************************** |
# +----------------------------------------------------------------------------+
showSignonBanner
if [[ $# -eq 3 ]]; then
export RMAN_USER=$1
export RMAN_PASSWORD=$2
export TARGET_DB=$3
else
showUsage
exit 2
fi
getOSName
if [[ $UNIX_TYPE = "linux" ]]; then
ORATAB_FILE="/etc/oratab"
elif [[ $UNIX_TYPE = "solaris" ]];then
ORATAB_FILE="/var/opt/oracle/oratab"
else
ORATAB_FILE="/etc/oratab"
fi
echo "======================================================"
echo "SCRIPT : $SCRIPT_NAME"
echo "VERSION : $VERSION"
echo "START TIME : $START_DATE"
echo "HOST : $HOSTNAME"
echo "UNIX TYPE : $UNIX_TYPE"
echo "TARGET DB : $TARGET_DB"
echo "RMAN USER : $RMAN_USER"
echo "======================================================"
echo " "
for DB_ENTRY in `cat ${ORATAB_FILE} | grep -v '^\#' | grep -v '^\*' | cut -d":" -f1,2`
do
ORACLE_SID=`echo $DB_ENTRY | cut -d":" -f1`
export ORACLE_SID
if [[ $ORACLE_SID = $TARGET_DB ]]; then
NEW_ORACLE_HOME=`echo $DB_ENTRY | cut -d":" -f2`
export NEW_ORACLE_HOME
switchOracleEnv $NEW_ORACLE_HOME
echo "======================================================"
echo " - Working on : ${ORACLE_SID} (${NEW_ORACLE_HOME})"
echo "======================================================"
echo " "
rman target "$RMAN_USER/$RMAN_PASSWORD" nocatalog <<EOF
backup database plus archivelog delete input;
delete noprompt force obsolete;
exit;
EOF
fi
done
END_DATE=`date`
echo "======================================================"
echo "FINISH TIME : $END_DATE"
echo "======================================================"
exit
[진짜실무교육&환급100%]SQL/자바/스프링/안드로이드/닷넷C#/웹… | 12-27 | 2313 | ||
[채용예정교육]오라클자바개발잘하는신입뽑기2개월과정,교육전취… | 12-11 | 1670 | ||
53 | [평일전액환급실무교육]Spring,자바&JSP,안드로이드,웹퍼블리싱,… | 03-15 | 1482 | |
52 | [주말]C#,ASP.NET마스터 | 01-31 | 1589 | |
51 | [기업100%환급,평일주간]SQL기초에서스키마오브젝트,PLSQL,힌트… | 01-31 | 1974 | |
50 | [기업100%환급]개발자를위한스프링,마이바티스,하이버네이트(스… | 01-31 | 1255 | |
49 | [평일주간,평일야간,주말]Spring,MyBatis,Hibernate개발자과정 | 01-19 | 1560 | |
48 | [평일야간,주말]안드로이드개발자과정(Android기초실무) | 01-11 | 1382 | |
47 | [평일야간,주말주간,주말야간]JAVA,Network&JSP&Spring,MyBatis,… | 01-03 | 1930 | |
46 | [진짜실무교육&환급100%]SQL/자바/스프링/안드로이드/닷넷C#/웹… | 12-27 | 2313 | |
45 | [기업100%환급]자바웹개발기초과정(JAVA,JDBC,JSP,Servlet,Aajx,… | 12-19 | 1654 | |
44 | [평일주간야간, 주말]웹퍼블리싱 마스터(HTML5,CSS3,jQUERY,AJAX… | 12-14 | 1632 | |
43 | [채용예정교육]오라클자바개발잘하는신입뽑기2개월과정,교육전취… | 12-11 | 1670 | |
42 | [기업100%환급]웹퍼블리싱마스터(HTML5,CSS3,JavaScript,jQUERY) | 12-09 | 1332 | |
41 | [평일야간]닷넷(C#,Network,ADO.NET,ASP.NET)마스터 | 12-01 | 1560 | |
40 | [기업100%환급]자바기초&안드로이드개발자과정(Android전액환급… | 12-01 | 1737 | |
39 | [평일야간,주말]SQL기초에서실무까지(SQL기초,PLSQL,힌트,튜닝) | 12-01 | 1201 |
댓글 없음:
댓글 쓰기