2014년 12월 8일 월요일

[백업/복구]Tape에 직접 Backup하는 Script[구로디지털단지/오라클초보기초교육/SQL초보평일주말교육학원/오라클12c/개발자SQL을 위하여]

#!/bin/ksh 

# ------------------------------------------------------------------------- 
# This is a shell script for making exports directly to tape with a label. 
# This label contains the db name and timestamp. 

# This script also verifies the tape's protection. If the tape is 
# protected it will display an error message and ask for a new tape. 

# Another function lists the tape's label and its contents (option show=y 
# of export). 

# This script also writes a history log with dbname and timestamp. 

#                              Sergio Klimberg <sklimberg@hotmail.com
# ------------------------------------------------------------------------- 

clear 
echo '          ORACLE TAPE EXPORTS    ' 
echo '          -------------------    ' 
b=' ' 
while  [ "$b" != "end" ] 
do 
  echo 
  echo "* Enter DB for backup or list / Type 'end' to finish" 
  echo ' ' 
  read b 
  if  [ "$b" = "end" ] 
    then 
      exit 
  fi 
  echo ' ' 
  echo "* Mount the tape and hit Enter or type 'list' / Type 'end' to finish" 
  echo ' ' 
  echo '  - Warning , Verify tape is not protected for backup ' 
  echo '  - If are you going to list the result will appear on screeen and into /tmp/list.txt' 
  echo '  ' 
  read a 
  echo '  ' 
  read a 
  if  [ "$a" = "end" ] 
    then 
      exit 
  fi 

  mt -t /dev/rmt/0m rew 

  if  [ "$a" = "list" ] 
    then 
      echo 
      echo "<= Export's Header =>" 
      tar tf /dev/rmt/0mn 
      echo " " 
      echo "* Hit Enter for show the export's remainder / Type 'end' to finish" 
      echo ' ' 
      read c 
      if  [ "$c" = "end" ] 
      then 
          exit 
      fi 
      echo 'file=/dev/rmt/0m ' >list.imp 
      echo 'log=/tmp/list.txt' >>list.imp 
      echo 'show=y' >>list.imp 
      echo 'volsize=4000M' >>list.imp 
      echo 'full=y ' >>list.imp 
      echo 'back/xxxxxx@'$b >>list.imp 
      imp parfile=list.imp 2>&1 
      echo 
      echo "Type 'end' to finish " 
      read d 
      exit 
  fi 

  HORA="`date '+%d-%m-%y %H:%M:%S'`" 
  DESC_EXPORT="EXPORT $b $HORA" 
  touch "$DESC_EXPORT" 
  tar cvf /dev/rmt/0mn "$DESC_EXPORT" 2>/dev/null 
  RTA=$? 
  while [ $RTA != 0 ] 
  do 
      echo "Tape protected , Hit ENTER when it's ready  / Type 'end' to finish" 
      read RTA1 
      if  [ "$RTA1" = "end" ] 
        then 
        exit 
      fi 
      tar cvf /dev/rmt/0mn "$DESC_EXPORT" 2>/dev/null 
      RTA=$? 
  done 

  TIME_START="`date '+%d/%m/%y %H:%M:%S'`" 

  echo 'back/xxxxxx@'$b >PARAMETERS.EXP 
  echo 'file=/dev/rmt/0m ' >>PARAMETERS.EXP 
  echo 'log=export.log' >>PARAMETERS.EXP 
  echo 'volsize=4000M' >>PARAMETERS.EXP 
  echo 'full=y  ' >>PARAMETERS.EXP 
  echo '  '  >>all_export.log 
  echo 'EXPORT OF : '$b >>all_export.log 
  echo 'START : ' $TIME_START >>all_export.log 
  echo '  '  >>all_export.log 
  exp parfile=PARAMETERS.EXP 2>&1 | tee -a all_export.log 
  echo '  '  >>all_export.log 
  TIME_END="`date '+%d/%m/%y %H:%M:%S'`" 
  echo 'END : ' $TIME_END >>all_export.log 
  echo "$TIME_START | $TIME_END | $b ">>export_resumen.log 
  echo ' ' 

  echo "$TIME_START | $TIME_END | $b ">>export_resumen.log 
  echo ' ' 
  echo Export $b end OK 
done 


* 이종철님에 의해서 게시물 이동되었습니다 (2006-06-04 12:24)




 [100%환급외,실무전문]빅데이터/SQL/자바/스프링/안드로이드/닷…오라클자바…12-272769
 [채용확정무료교육]오라클자바개발잘하는신입뽑기2개월과정,교육…오라클자바…12-112010
53 [평일100%환급7건]웹퍼블리싱,자바&JSP,안드로이드,C#닷넷,SQL기… 오라클자바…03-151824
52 [주말]C#,ASP.NET마스터 오라클자바…01-311982
51 [기업100%환급,평일주간]SQL기초에서스키마오브젝트,PLSQL,힌트… 오라클자바…01-312934
50 [주말주간]자바&웹,jQUERY,스프링프레임워크,마이바티스 오라클자바…01-311527
49 [평일주간,평일야간,주말]Spring,MyBatis,Hibernate개발자과정-… 오라클자바…01-191851
48 [평일야간,주말]안드로이드개발자과정(Android기초실무) 오라클자바…01-111729
47 [평일야간,주말주간야간]JAVA,Network&JSP&Spring,MyBatis,Hiber… 오라클자바…01-032289
46 [100%환급외,실무전문]빅데이터/SQL/자바/스프링/안드로이드/닷… 오라클자바…12-272769
45 [평일주간]NoSQL,MongoDB,빅데이터기초과정 오라클자바…12-191942
44 [평일주간야간, 주말]웹퍼블리싱 마스터(HTML5,CSS3,jQUERY,AJAX… 오라클자바…12-141922
43 [채용확정무료교육]오라클자바개발잘하는신입뽑기2개월과정,교육… 오라클자바…12-112010
42 [평일주간]빅데이터하둡기초과정(BigData Hadoop) 오라클자바…12-091568
41 [평일야간]닷넷(C#,Network,ADO.NET,ASP.NET)마스터 오라클자바…12-011795
40 [기업100%환급]오라클&자바웹스프링신입과정3주(SQL,JAVA,JSP,Se… 오라클자바…12-012007
39 [평일야간,주말]SQL기초에서실무까지(SQL기초,PLSQL,힌트,튜닝) 오라클자바…12-011445

댓글 없음:

댓글 쓰기