Shell Script Example Oracle Export dumpfile(exp or expdp)

**Myself
 
#!/usr/bin/sh
#########   ENV ##############
backup_dir=/backup/expdump  #Dumpfile directory
blog=/backup/expdump/backup_expdump.log
orasid[0]=orcl1    #oracle sid1
orasid[1]=orcl2    #oracle sid2
orasid[2]=orcl3    #oracle sid3
orauser[0]=oraorcl1
orauser[1]=oraorcl2
orauser[2]=oraorcl1
orahome[0]=/app/oracle/orcl1/10g
orahome[1]=/app/oracle/orcl2/10g
orahome[2]=/app/oracle/orcl3/10g
############### Main ##################
export i=0
while (( i < ${#orasid[*]} ))
do
    su - ${orauser[${i}]}  << BOF >> ${blog}
        export ORACLE_SID=${orasid[${i}]}
        echo ${orasid[${i}]} >> ${blog}
        ${orahome[${i}]}/bin/exp system/system file='${backup_dir}/${orasid[${i}]}.dmp' full=y
    BOF
(( i = i + 1 ))
done

0 comments:

Loading