** Myself
Environment of example script
1) backup by export method to a directory /backup/DEV
2) On a machine have 3 oracle user for and difference oracle home(sw path) and db instance
## ORACLE_SID=dev1 ,oracle user=oradev1 and ORACLE_HOME=/app/oracle/D1/9.2.0
3) Method for backup use export tools ,if you want to change datapump tool from exp to expdp and use DIRECTORY replace backup_dir environment
#!/usr/bin/sh
######### DYNAMIC ENV ##############
backup_dir=/backup/DEV
blog=/backup/DEV/backup_DEV.log
orasid[0]=dev1 #oracle sid
orasid[1]=dev2 #oracle sid
orasid[2]=dev3 #oracle sid
orauser[0]=oradev1
orauser[1]=oradev2
orauser[2]=oradev1
orahome[0]=/app/oracle/D1/product
orahome[1]=/app/oracle/D2/product
orahome[2]=/app/oracle/D3/product
############### 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/password file='${backup_dir}/${orasid[${i}]}.dmp' full=y
BOF
(( i = i + 1 ))
done
0 comments:
Post a Comment