Thanks for update Anchal, after this command runs (expdp system/manager1 schemas=PRODUCTION1 directory=dump_dir DUMPFILE=$DMP_FILE LOGFILE=$LOG_FILE) should check the logfile if it is success send success email if failed send backup failed.
Thanks for your update both of you.I tried with the given code it dozen work.
I also agree with Ananthp update.
My requirement is script should check export log($LOG_FILE)file should be checked if they found ("ORA-" "Linux-x86_64 Error" "stopped" "Failed" ) then sent backup failed email.
orelse sent backup successfull email. Hope you understand my needy.
I tried this code manually seems grep is not working ..
[oracle@prodb dump]$ egrep -q "ORA-|Linux-x86_64 Error|stopped|Failed" failelog07032012.log
[oracle@prodb dump]$ grep -i ORA- failelog07032012.log
ORA-31693: Table data object "PRODUCTION1"."TR33MTH2" failed to load/unload and is being skipped due to error:
ORA-19502: write error on file "/home/oracle/dump/07032012.dmp", blockno 162017 (blocksize=4096)
ORA-27072: File I/O error
ORA-31693: Table data object "PRODUCTION1"."CF89LOG" failed to load/unload and is being skipped due to error:
ORA-19502: write error on file "/home/oracle/dump/07032012.dmp", blockno 162273 (blocksize=4096)
ORA-27072: File I/O error
ORA-31693: Table data object "PRODUCTION1"."CF01OLAY" failed to load/unload and is being skipped due to error:
ORA-19502: write error on file "/home/oracle/dump/07032012.dmp", blockno 162529 (blocksize=4096)
ORA-27072: File I/O error
ORA-31693: Table data object "PRODUCTION1"."IV33DETAIL" failed to load/unload and is being skipped due to error:
ORA-19502: write error on file "/home/oracle/dump/07032012.dmp", blockno 162785 (blocksize=4096)
ORA-27072: File I/O error
ORA-31693: Table data object "PRODUCTION1"."GL13IMPORT" failed to load/unload and is being skipped due to error:
ORA-19502: write error
can you confirm me codes is correct?
egrep -q "ORA-|Linux-x86_64 Error|stopped|Failed" $LOG_FILE
if [ $? -eq 0 ]; then
uuencode $LOGFILE expdb_$CDATE | mail -s "$HOST_NAME:$SID Export backup success on `CDATE`" $ADMIN_EMAIL
#update logfile----? wat i have to mention.
else
#uuencode $LOGFILE expdb_$CDATE | mail -s "$HOST_NAME:$SID Export backup Failed on `CDATE`" $ADMIN_EMAIL
#update logfile----?wat i have to mention.
fi
-q is for [q]uiet mode. That doesn't output the matched records.
If you do want to check, re-run the command without -q option.
---------- Post updated at 16:06 ---------- Previous update was at 16:02 ----------
The command will return 0 if it finds the matches (eg.errors in your case)
I guess you should revert the if/else cases. (as I mentioned in my previous post)
Great Help!!! I'm finally i made this possible with the help of you,Thank you Anchal Khare!! I Apprecatied if you allow me in your Add list of this Group.