!/bin/sh
export ORACLE_BASE=/opt/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0.4/dbhome_1
export ORACLE_SID=ora11g
export NLS_LANG='AMERICAN_AMERICA.AL32UTF8'
export PATH=.:$PATH:$ORACLE_HOME/bin oracle变量在 /etc/profile 中可以看到。
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib 注:oracle变量,不添加脚本无法在crontab 定时任务中自动执行。
FILEPATH=/home/oracle/bachup 存储目录
PW=hello1234! 密码
expdp xny_absorptive/$PW DUMPFILE=xny_absorptive.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_absorptive 备份数据
sleep 5
expdp xny_common/$PW DUMPFILE=xny_common.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_common
sleep 5
expdp xny_environment/$PW DUMPFILE=xny_environment.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_environment
sleep 5
expdp xny_intracompany/$PW DUMPFILE=xny_intracompany.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_intracompany
sleep 5
expdp xny_load/$PW DUMPFILE=xny_load.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_load
sleep 5
expdp xny_manufacturer/$PW DUMPFILE=xny_manufacturer.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_manufacturer
sleep 5
expdp xny_newtechnology/$PW DUMPFILE=xny_newtechnology.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_newtechnology
sleep 5
expdp xny_planningplan/$PW DUMPFILE=xny_planningplan.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_planningplan
sleep 5
expdp xny_policyresearch/$PW DUMPFILE=xny_policyresearch.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_policyresearch
sleep 5
leep 5
expdp xny_resources/$PW DUMPFILE=xny_resources.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_resources
sleep 5
expdp xny_gis/$PW DUMPFILE=xny_gis.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_gis
sleep 5
expdp xny_splydemand/$PW DUMPFILE=xny_splydemand.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_splydemand
sleep 5
expdp xny_tariffsubsidy/$PW DUMPFILE=xny_tariffsubsidy.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_tariffsubsidy
sleep 5
expdp xny_assistmakepolicy/$PW DUMPFILE=xny_assistmakepolicy.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_assistmakepolicy
sleep 5
expdp xny_bigdata/$PW DUMPFILE=xny_bigdata.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_bigdata
sleep 5
expdp xny_statistics/$PW DUMPFILE=xny_statistics.DMP DIRECTORY=DATA_PUMP_DIR schemas=xny_statistics
cd /opt/app/admin/ora11g/dpdump/
mv *.DMP $FILEPATH