Oracle自动备份脚本的实现
问题描述:
Oracle自动备份脚本的实现。
错误提示1:
Message file RMAN.msb not found
Verify that Oracle_HOME is set properly
。。。。。。
错误原因:
自动执行的不能够识别相应的命令,需要在自动备份脚本中显式的声明Oracle的环境变量。
错误提示2:
standard in must be a tty
。。。。。。
错误原因:
不能在cron使用su或者管道等操作,必须将su命令移动到相关的shell脚本中。
错误提示3:
|
Argument Value Description ----------------------------------------------------------------------------- target quoted-string connect-string for target database catalog quoted-string connect-string for recovery catalog nocatalog none if specified, then no recovery catalog cmdfile quoted-string name of input command file log quoted-string name of output message log file trace quoted-string name of output debugging message log file append none if specified, log is opened in append mode debug optional-args activate debugging msgno none show RMAN-nnnn prefix for all messages send quoted-string send a command to the media manager pipe string building block for pipe names timeout integer number of seconds to wait for pipe input checksyntax none check the command file for syntax errors ----------------------------------------------------------------------------- Both single and double quotes (' or ") are accepted for a quoted-string. Quotes are not required unless the string contains embedded white-space. RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-00556: could not open CMDFILE "backup_ar.rcv" 。。。。。。 |
错误原因:
需要在cmdfile中指明绝对路径,不能因为shell脚本调用的cmdfile是在同一个目录下就可以直接使用文件名或者直接使用./
正确示例代码:
1、#cron文件
0 12,18 * * * /home/Oracle/bak_sh/backup_ar.sh
#表示每天12,18点对数据库归档日至进行全备份
2、入口shell文件,文件名:backup_ar.sh
|
export Oracle_HOME=/home/u01/app/Oracle/Oracle/product/10.2.0/db_1 export Oracle_SID=test export LANG=en_US.UTF-8 /home/u01/app/Oracle/Oracle/product/10.2.0/db_1/bin/rman cmdfile = backup_ar.rcv |
3、rman备份脚本
|
connect target / connect catalog rman/rman@rman run{ allocate channel d1 device type disk; sql 'alter system archive log current'; backup archivelog all delete input format '/opt/rmanback/full_%u_%p_%c.ac' filesperset = 3; release channel d1; } |
解决方法:
1、两种办法
一是用root的crontab,*/2 * * * * a.sh --》su - Oracle -c a.sh
一是在a.sh里加上Oracle的环境。
2、我们做的cron测试:
实例:
Vi /etc/cron.minly/new.sh
内容:
Su – Oracle –c “/home/Oracle/mginfo.sh”
Vi /home/Oracle/mginfo.sh
内容:
Exp mginfotech/mginfotech file=mginfotech.dmp log=mginfotech.log
Vi /etc/crontab
内容:
59 23 * * * root run-parts /etc/cron.minly
每晚23:59分钟执行
cron中无法读取环境变量
在shell中显示地export环境变量
export Oracle_HOME=/opt/ora9/product/9.2
export Oracle_SID=Oracle
export NLS_LANG=xxxxx
Oracle自动备份脚本的实现的更多相关文章
- Oracle自动备份脚本(网上找到的资料)
废话不多说了,直接给大家贴代码了,具体代码如下所示: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ...
- Oracle自动备份脚本
set mydate=%date:~0,4%%date:~5,2%%date:~8,2%exp 用户名/密码@实例名 file=D:\mydata_%mydate%.dmp owner=用户名 log ...
- Windows环境下Oracle数据库的自动备份脚本
批处理文件(.bat) @echo off echo ================================================ echo Windows环境下Oracle数据 ...
- oracle expdp自动备份脚本
windows: @echo off echo ================================================ echo Windows环境下Oracle数据库的自动 ...
- Oracle数据库的自动备份脚本
@echo off echo ================================================ echo Windows环境下Oracle数据库的自动备份脚本 echo ...
- Windows环境下Oracle数据库的自动备份脚本自动删除30天前的备份
@echo off echo ================================================ echo Windows环境下Oracle数据库的自动备份脚本 echo ...
- Windows:Oracle 11g 备份脚本
@echo off echo ================================================ echo Windows环境下Oracle数据库的自动备份脚本 echo ...
- Oracle自动备份bat
很多时候我们需要自动备份数据库这边推荐bat+Windows计划任务实现 方案1 创建以下bat 然后添加到TaskSchedule(路径最好不要包含中文) @echo off @echo ===== ...
- Mysql 自动备份脚本
转自: Mysql 自动备份脚本2 - - ITeye技术网站http://kangh.iteye.com/blog/2309091 备份方案: 备份主机:192.168.10.11 数据库服务器:1 ...
随机推荐
- QT 交叉编译工具选择
使用QT交叉编译,生成的都是x86的可执行文件.Zoro告诉我交叉工具配置错了. 参考链接: http://www.cnblogs.com/zengjfgit/p/4744507.html linux ...
- C# HttpClientHelper请求
public class HttpClientHelper { /// <summary> /// get请求 /// </summary> /// <param nam ...
- 转载:erlang程序优化点的总结
erlang程序优化点的总结(持续更新) 转自:http://wqtn22.iteye.com/blog/1820587 转载请注明出处 注意,这里只是给出一个总结,具体性能需要根据实际环境和需要来确 ...
- iOS7入门开发全系列教程新地址
包括了系列1所有.系列2所有,系列3部分(进行中) 由于大家都知道的原因,换了github保存: https://github.com/eseedo/kidscoding 假设下载有问题能够留言,请在 ...
- android大扫盲之SurfaceView,SurfaceHolder,SurfaceHolder.CallBack
最近接触到了SurfaceView,SurfaceHolder,SurfaceHolder.CallBack,一直不求其解,现在来粗浅认识一下它们. 先看一下官方的定义: 1.SurfaceView ...
- UGUI之Canvas和EventSystem
先介绍一下UGUI必不可缺的两个组件:Canvas和EventSystem 事实上在场景中第一次创建UGUI控件的时候,这两个物体都会自动添加到场景中,当然,必不可缺的不是这两个物体,而是他们身上挂载 ...
- unity如何停止不用字符串方式开启协程的方法
通常我们知道开启协程用StartCoroutine("Method"); 停止协程用StopCoroutine("Method"); 如果我们想要终止所有的协程 ...
- [转] Windows局域网通过NTP设置时间同步
NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议. 如果局域网计算机(Windows系统)可以连接Internet,可以通过“控制面板”— ...
- CSS使用经验总结
清除图片下方出现几像素的空白间隙 方法1: img{display:block;} 方法2: img{vertical-align:top;} 除了top值,还可以设置为text-top | midd ...
- MySQL性能优化(一)-- 存储引擎和三范式
一.MySQL存储引擎 存储引擎说白了就是如何存储数据.如何为存储的数据建立索引和如何更新.查询数据等技术的实现方法.因为在关系数据库中数据的存储是以表的形式存储的,所以存储引擎也可以称为表类型(即存 ...