手机版
你好,游客 登录 注册
背景:
阅读新闻

Linux下使用crontab进行RMAN备份实验

[日期:2013-09-12] 来源:Linux社区  作者:Linux [字体:大 中 小]

四、有的文档上说需要设置完crontab再进入 root用户,重启CROND服务。我的实验中未重启因为CROND就在运行着。
我这里CROND就在打开着,不需要重启就行,也可以去重启下 。
重启的示例如下 :
[Oracle@oel-01 ~]$ su - root
Password:
[root@oel-01 ~]# service crond status
crond (pid 27777) is running...
[root@oel-01 ~]# service crond restart
Stopping crond: [ OK ]
Starting crond: [ OK ]

查看cron的日志:
[root@oel-01 ~]# cd /var/log
[root@oel-01 log]# tail cron
Jul 4 17:01:01 oel-01 crond[28305]: (root) CMD (run-parts /etc/cron.hourly)
Jul 4 17:02:50 oel-01 crontab[28313]: (oracle) BEGIN EDIT (oracle)
Jul 4 17:02:54 oel-01 crontab[28315]: (oracle) BEGIN EDIT (oracle)
Jul 4 17:02:58 oel-01 crontab[28317]: (oracle) BEGIN EDIT (oracle)
Jul 4 17:03:11 oel-01 crontab[28317]: (oracle) REPLACE (oracle)
Jul 4 17:03:11 oel-01 crontab[28317]: (oracle) END EDIT (oracle)
Jul 4 17:03:27 oel-01 crontab[28321]: (oracle) LIST (oracle)
Jul 4 17:04:01 oel-01 crond[27777]: (oracle) RELOAD (cron/oracle)
Jul 4 17:05:21 oel-01 crond[28396]: (CRON) STARTUP (V5.0)

Jul 4 17:05:21 oel-01 crond[28396]: (CRON) @reboot jobs will be run at computer's startup. ()

 


五、关于cron定时命令
cron
/etc/cron.allow /etc/cron.deny 使用与at相同
-u 只有ROOT才能进行这个任务
-e 编辑crontab的工作内容,主要针对使用者的cron设计
-l 查阅crontab的工作内容
-r 移除所有crontab工作内容,

代表意义 分钟 小时 日期 月仹 周 指令
数字范围 0-59 0-23 1-31 1-12 0-7 指令
*代表任何时刻 0 12 * * * ls /root 每一天的12点整开始执行
,代表分隔时段0 3,6 * * * ls 不写是3点还是6点都执行
-代表一段时间范围内 20 8-12 * * * ls 8 9 10 12 12点的20分都执行
/n 代表数字,是第N个间隔 */5 * * * * ls 每五分钟执行一次,也可以写成0-59/5

每个crontab都只有一个档案存在,在/var/spool/cron里,指令下达最好用绝对路径

注意事项
资源分配不均的问题 比如同时进行多个耗费系统资源的命令时,注意将其分开,
取消不需要的输出 /dev/null
周与日不可同时并存
出现非自己设定的cron 注意系统安全了。。。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

linux
相关资讯       rman备份 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款