作者:IT邦德 中国DBA联盟(ACDU)成员,目前从事DBA及程序编程 (Web\java\Python)工作,主要服务于生产制造 现拥有 Oracle 11g OCP/OCM、 Mysql、Oceanbase(OBCA)认证 分布式TBase\TDSQL数据库、国产达梦数据库以及红帽子认证 从业8年DBA工作,在数据库领域有丰富的经验 B站主播Oracle、Mysql、PG实战课程,请搜索:jeames007 擅长Oracle数据库运维开发,备份恢复,安装迁移,性能优化、故障应急处理等。
[root@rac1 ~]# mkdir -p /u01/dbbak/script [root@rac1 ~]# cd /u01/dbbak [root@rac1 dbbak]# chown -R oracle:oinstall script
[root@rac1 ~]# mkdir -p /u01/dbbak/db [root@rac1 ~]# mkdir -p /u01/dbbak/arch [root@rac1 ~]# cd /u01/dbbak [root@rac1 dbbak]# chown -R oracle:oinstall db [root@rac1 dbbak]# chown -R oracle:oinstall arch
[oracle@rac1 ~]$ vi /u01/dbbak/script/backup.sh run{ allocate channel c1 type disk; allocate channel c2 type disk; allocate channel c3 type disk; allocate channel c4 type disk; backup as compressed backupset database format '/u01/dbbak/db/DB%U.bkp' plus archivelog format '/u01/dbbak/arch/ARCH%U.bkp' delete all input; release channel c1; release channel c2; release channel c3; release channel c4; report obsolete; crosscheck copy; crosscheck archivelog all; delete noprompt obsolete; crosscheck backup; delete noprompt expired backup; } quit;
[oracle@rac1 ~]$ vi /u01/dbbak/script/rman.sh export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 export ORACLE_SID=JEAMES1 dt=`date '+%Y%m%d_%H%M'` /u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target / cmdfile=/u01/dbbak/script/backup.sh log=/u01/dbbak/log/log_$dt.log append
[oracle@rac1 script]$ chmod 777 backup.sh [oracle@rac1 script]$ chmod 777 rman.sh
[root@rac1 dbbak]# cd /u01/dbbak [root@rac1 dbbak]# ll total 12 drwxr-xr-x 2 oracle oinstall 4096 Jul 29 23:59 arch drwxr-xr-x 2 oracle oinstall 4096 Jul 29 23:58 db drwxr-xr-x 2 oracle oinstall 4096 Jul 30 00:05 script [root@rac1 dbbak]# cd script [root@rac1 script]# ll total 8 -rw-r--r-- 1 oracle oinstall 632 Jul 30 00:05 backup.sh -rw-r--r-- 1 oracle oinstall 242 Jul 29 23:52 rman.sh
crontab -e 为编辑窗口 [oracle@rac1 ~]$ crontab -l 0 2 * * * /u01/dbbak/script/rman.sh 注意:oracle用户执行即可
如果觉得文章对你有帮助,点赞、收藏、关注、评论,一键四连支持
您的批评指正是我写作的最大动力!
❤️ 技术交流可以 关注公众号:IT邦德 ❤️