Oracle Rman-备份脚本

来源:互联网 发布:发送短信的软件 编辑:程序博客网 时间:2024/05/22 14:42
 oracle@dbservera ~]$ crontab -l
0 0 * * * /u01/rmanbak/rmanbak.sh > /u01/rmanbak/rmanbak.log 2>&1
[oracle@dbservera ~]$ cat /u01/rmanbak/rmanbak.sh
#!/bin/bash


. ~/.bash_profile


echo -------------------------start-----------------------;date
rman target/<<EOF
backup as compressed backupset database include current controlfile format '/u01/rman/rmanbak/full_%U.bak';
delete noprompt obsolete;
delete noprompt force archivelog all completed before 'sysdate-7';
exit;
EOF
echo -------------------------end-----------------------;date






注意:EOF后面不要有空格,不然会有警告


总之一共三步,首先创建备份脚本,之后创建备份的目标目录(要注意目录权限),最后通过crontab -e -u oracle来编辑oracle的执行计划。

原创粉丝点击