aix 设置crontab自动备份oracle数据库

看看看灰机 2014-12-20 10:37:17
新手一枚,自己创建了一个sh文件,里面是oracle导出数据泵备份的脚本‘expdp 啥的’,脚本单独运行、或者直接运行sh文件都能正常备份库,但是放到crontab中就一直报错‘expdp not found’ 跪求大神讲解。。希望详细点,非常感谢
...全文
1032 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
看看看灰机 2014-12-23
  • 打赏
  • 举报
回复
引用 8 楼 ljc007 的回复:
需要设置好环境变量,比如:ORACLE_HOME 和 ORACLE_SID
非常感谢,就这出问题了 哎一毛钱难死门外汉,再次感谢
ljc007 2014-12-22
  • 打赏
  • 举报
回复
需要设置好环境变量,比如:ORACLE_HOME 和 ORACLE_SID
  • 打赏
  • 举报
回复
引用 4 楼 yph_huiji 的回复:
[quote=引用 1 楼 micropentium6 的回复:] you will need to put the PATH on top of your cronjob file and make sure appending the path for expdp in there. i.e. PATH=/usr/bin:/bin:/usr/local/bin
您好: expdp的路径也需要添加到cronjob里?还是expdp的路径必须指定到 path下? 非常感谢[/quote] in your cronjob file, define PATH variable before any cron job. Say expdp is under /opt/oracle/bin, then this path must be included in the PATH #my cronjob file PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/oracle/bin # m h dom mon dow usercommand .......
看看看灰机 2014-12-21
  • 打赏
  • 举报
回复
引用 1 楼 micropentium6 的回复:
you will need to put the PATH on top of your cronjob file and make sure appending the path for expdp in there. i.e. PATH=/usr/bin:/bin:/usr/local/bin
您好: expdp的路径也需要添加到cronjob里?还是expdp的路径必须指定到 path下? 非常感谢
看看看灰机 2014-12-21
  • 打赏
  • 举报
回复
引用 1 楼 micropentium6 的回复:
you will need to put the PATH on top of your cronjob file and make sure appending the path for expdp in there. i.e. PATH=/usr/bin:/bin:/usr/local/bin
谢谢! 只需要在 cronjob 里加入path=/usr/bin:/usr/local/bin 么,还需不需要其他的? 不知您那里有没有实例,可否给一个完整的cronjob和expdp sh文件的格式写法,非常感谢
看看看灰机 2014-12-21
  • 打赏
  • 举报
回复
谢谢! 只需要在 cronjob 里加入path=/usr/bin:/usr/local/bin 么,还需不需要其他的? 不知您那里有没有实例,可否给一个完整的cronjob和expdp sh文件的格式写法,非常感谢
  • 打赏
  • 举报
回复
PATH is for corn job to look for executable. The default work directory is always user home dir unless aix specifies otherwise. I would try replacing the parameters in ur script that specify path from relative to absolute
  • 打赏
  • 举报
回复
you will need to put the PATH on top of your cronjob file and make sure appending the path for expdp in there. i.e. PATH=/usr/bin:/bin:/usr/local/bin
看看看灰机 2014-12-21
  • 打赏
  • 举报
回复
引用 5 楼 micropentium6 的回复:
[quote=引用 4 楼 yph_huiji 的回复:] [quote=引用 1 楼 micropentium6 的回复:] you will need to put the PATH on top of your cronjob file and make sure appending the path for expdp in there. i.e. PATH=/usr/bin:/bin:/usr/local/bin
您好: expdp的路径也需要添加到cronjob里?还是expdp的路径必须指定到 path下? 非常感谢[/quote] in your cronjob file, define PATH variable before any cron job. Say expdp is under /opt/oracle/bin, then this path must be included in the PATH #my cronjob file PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/oracle/bin # m h dom mon dow usercommand .......[/quote] I make my cronjob file like this,the directory limsdir is create myself and it's path is in the same path of the back.sh file, but it's also can't work,are there any error in my file ? thanks a lot #cronjob file PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/oracle/product/10g/db_1/bin; (oracle/product/10g/db_1/bin is my oracle path) 10 * * * * /limsdb/exp/frepdatabase/back.sh; # end file # sh file expdp system/lims directory=limsdir dumpfile=frep_dict`date +%Y%m%d`.dmp schemas=frep_dict version=10.2.0; # end sh file

1,194

社区成员

发帖
与我相关
我的任务
社区描述
该论坛主要探讨IBM AIX平台的安装、部署、应用开发等话题,并为网友们提供自由交流的平台。
社区管理员
  • IBM AIX社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧