Using exp in Oracle to backup Oracle remotely

From , 2 Years ago, written in PowerShell, viewed 230 times.
URL https://pastebin.vip/view/d6539d3b
  1. #!/bin/bash
  2. #function: to execute the oracle built-in  cmd
  3. #version 1
  4. PATH=$PATH:$HOME/bin
  5.  
  6. export PATH
  7. export ORACLE_UNQNAME=DB4QIGOU
  8. export ORACLE_SID=db4qigou
  9. export ORACLE_OWNER=oracle
  10. export ORACLE_BASE=/u01/app/oracle
  11. export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
  12. export ORACLE_SID ORACLE_BASE ORACLE_HOME
  13. export ORA_NLS10=$ORACLE_HOME/nls/data
  14. PATH=$PATH:/$ORACLE_HOME/bin:$HOME/bin
  15. export PATH
  16. LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
  17. export LD_LIBRARY_PATH
  18. CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
  19. CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
  20. export CLASSPATH
  21. echo "please run this script on cautiously!!!If you forget sth ,or want to abort the script,now ctrl+c will be abort,if you run it bg,you must now how to abort it."
  22. sleep 10;
  23. echo "now begining"
  24. backupdate=`date +%Y%m%d`
  25. mkdir -p $backupdate
  26. if [[ -d $backupdate ]]&& [[ -f /home/oracle/db_list ]]
  27. then
  28. cd $backupdate
  29. cp /home/oracle/db_list .
  30. else
  31. exit
  32. fi
  33. echo "begining exporting....."
  34. #for db_name in db_list
  35. for db_name in `cat db_list`
  36. do
  37. exp $db_name/123 OWNER=$db_name FILE=$backupdate$db_name.emp
  38.  
  39. if [ $? -eq 0 ]
  40.         then
  41.         echo "you succeed backup the database"
  42. else
  43. #or >
  44.         echo "you failed backup,you must rerun the script. backup failed"|tee -a error.message
  45.                 mail -s 16_oracle_bak jinwei.bian@qeegoo.com<error.message
  46.         exit 12
  47. fi
  48. done
  49. #use scp with no password,you must use ssh-key to generate the key
  50. scp -pv /home/oracle/$backupdate/*.emp root@192.168.11.21:/data/16_ora_backup/
  51. echo -e "backup finished in $backupdate ." >finished.message
  52. mail -s 16_oracle_bak jinwei.bian@qeegoo.com<finished.message
  53.  
  54. exit 0
  55. //shell/1287

Reply to "Using exp in Oracle to backup Oracle remotely"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website