3 Replies Latest reply on Oct 9, 2013 6:46 AM by Anar Godjaev

    UNix shelll scrip for expdp

    SENSEIYODA

      how can write shell script code (starting expdp ) form SunSolarius system ?


      1. expdp start send me result (e-mail)
      2. expdp finish send me result (e - mail)


      plese give me for example


      I'm sorry for my bad Englis

        • 1. Re: UNix shelll scrip for expdp
          Anar Godjaev

          HI,

           

          I use the same script for my OS.  I wrote this information in my blog: Please check :  http://anargodjaev.wordpress.com/2013/09/30/unixde-expimp-ekran-yazma-ve-mail-atma-scripti/

           

          For example:

           

          echo “—————————————————————————-”

           

           

          echo  Report by Anar Godjaev

           

           

          echo “—————————————————————————-”

           

           

          while true

           

           

          do

           

           

          echo

           

           

          echo “########################### BACKUP #############################”

           

           

          echo

           

           

          echo “——————————————————————————–”

           

           

          echo “3.    Starting expdp before End of Day  plese click to button 3  =====>  ENTER”

           

           

          echo “——————————————————————————–”

           

           

          echo “4.    Starting expdp after End of Day  plese click to button 4  =====>  ENTER”

           

           

          echo “——————————————————————————–”

           

           

          echo “5.    Exit plese click to button 4  =====>  ENTER “

           

           

          echo “——————————————————————————–”

           

           

          echo “6.    Retray plese click to button 6  =====>  ENTER “

           

           

          read i

           

           

          DATE=`date “+%d%m%Y%H%M%S”`

           

           

          case $i in

           

           

          3)      echo “———————————–”

           

           

          echo “Starting before expdp”

           

           

          ###################### mail 1 ####################

           

           

          echo “” > /ks/maillog.txt

           

           

          echo “Starting before expdp” >> /ks/maillog.txt

           

           

          echo “” >> /ks/maillog.txt

           

           

          date >> /ks/maillog.txt

           

           

          cat /ks/maillog.txt | mailx -s “BackUp Information by Anar_Godjaev” -r BackUpStatus@iletisim.yapikredi.com.az

          echo “” > /ks/maillog.txt

           

           

           

           

           

          expdp anar/****** directory=EXPORT_DIR dumpfile=$DATE”-before.dmp” logfile=$DATE”-before.log” full=y

           

           

           

           

           

          ###################### mail 2 ####################

           

           

          echo “*********************” /ks/maillog.txt

           

           

          echo “” >> /ks/maillog.txt

           

           

          tail -3 /backup/$DATE”-before.log” >> /ks/maillog.txt

           

           

          cat /ks/maillog.txt |mailx -s “BackUp Information by Anar_Godjaev” -r BackUpStatus@iletisim.yapikredi.com.az

           

           

          echo “” > /ks/maillog.txt

           

           

           

           

           

          echo “Finish expdp”

           

           

          echo “———————————–”

           

           

          ;;

           

           

          4)      echo “———————————–”

           

           

          echo “starting after expdp”

           

           

          ###################### mail 1 ####################

           

           

          echo “” > /ks/maillog.txt

           

           

          echo “start after expdpr” >> /ks/maillog.txt

           

           

          date >> /ks/maillog.txt

           

           

          cat /ks/maillog.txt | mailx -s “BackUp Information by Anar_Godjaev” -r BackUpStatus@iletisim.yapikredi.com.az

           

           

          echo “” > /ks/maillog.txt

           

           

           

           

           

          expdp anar/**** directory=EXPORT_DIR dumpfile=$DATE”-after.dmp” logfile=$DATE”-after.log” full=y

           

           

           

           

           

          ###################### mail 2 ####################

           

           

          echo “” >> /ks/maillog.txt

           

           

          tail -3 /backup/$DATE”-after.log” >> /ks/maillog.txt

           

           

          cat /ks/maillog.txt |mailx -s “BackUp Information by Anar_Godjaev” -r BackUpStatus@iletisim.yapikredi.com.az eod@yapikredi.com.az

           

           

          echo “” > /ks/maillog.txt

           

           

           

           

           

          echo “expdp finish.”

           

           

          echo “———————————–”

           

           

          ;;

           

           

          5)      echo “———————————–”

           

           

          echo “expdp finish… exit.”

           

           

          break

           

           

          ;;

           

           

          6)      echo “———————————–”

           

           

          echo “Live menyu”

           

           

          ;;

           

           

          *)      echo “———————————–”

           

           

          echo “incorrect”

           

           

          ;;

           

           

           

           

           

          esac

           

           

          done

           

           

          ####################

          • 2. Re: UNix shelll scrip for expdp
            L-MachineGun

            Somewhat more simple:

            #!/usr/bin/ksh
            # expdp_schemas.sh
            # Export 1 schema
            #
            SCHEMA=$1 #<= Parameter 1 is the schema name
            #
            ORAENV_ASK=NO
            . /usr/local/bin/oraenv ORCL
            #
            EMAIL='myemail@mycompany.com'
            #
            DMPFILE=expdp_$SCHEMA_`date +%Y%M%D\-%h%m`
            #
            cat - <<! >${DMPFILE}.par
            PARALLEL=4
            DIRECTORY=EXPORTS
            DUMPFILE=${DMPFILE}_%U.dmp
            REUSE_DUMPFILES=Y
            SCHEMAS=$SCHEMA
            LOGFILE=${DMPFILE}.log
            !
            #
            echo "$0 Started `date`\nParameters:\n${DMPFILE}.par"|\
            mailx -s"$0 Started on $ORACLE_SID" $EMAIL
            #
            expdp / parfile=${DMPFILE}.par
            #
            echo "$0 Ended `date`\nLogfile=${DMPFILE}.log"|\
            mailx -s"$0 Ended on $ORACLE_SID" $EMAIL
            #
            exit
            
            
            
            

             

            1 person found this helpful
            • 3. Re: UNix shelll scrip for expdp
              Anar Godjaev

              very good

              1 person found this helpful