Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6523523
  • 博文数量: 1005
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13071
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1005)

文章存档

2020年(2)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: Oracle

2011-11-30 17:38:15

非归档模式下数据库的备份,系统自动备份到当天日期目录,日期目录的创建脚本可以参考<创建日期目录>
 
  1. #!/bin/bash
  2. export ORACLE_BASE=/u01/app/oracle
  3. export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
  4. export PATH=$PATH:$ORACLE_HOME/bin
  5. export ORACLE_SID=oracl

  6. #start or stop script
  7. user=sys
  8. user_pwd=sys
  9. l_rman_path='/u01/rman_backup'

  10. l_date=`date +%Y%m%d`
  11. l_year=`echo ${l_date}|cut -c1-4`
  12. l_month=`echo ${l_date}|cut -c1-6`

  13. rman<<EOF
  14. connect target ${user}/${user_pwd}
  15. run
  16. {
  17. shutdown immediate;
  18. startup mount; #noarchive mode,must be mount
  19. allocate channel c1 type disk;
  20. allocate channel c2 type disk;
  21. backup database format "${l_rman_path}/${l_year}/${l_month}/${l_date}/df_%t_%s_%p.bak";
  22. release channel c1;
  23. release channel c2;
  24. alter database open;
  25. }
  26. EOF
阅读(2928) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~