足球游戏_中国足彩网¥体育资讯$

Oracle数据库自动备份的实现历程
来源:易贤网 阅读:1010 次 日期:2014-09-17 14:36:40
温馨提示:易贤网小编为您整理了“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

nocatalognone  if specified, then no recovery catalog

cmdfile quoted-string name of input command file

log quoted-string name of output message log file

tracequoted-string name of output debugging message log file

append  none  if specified, log is opened in append mode

debugoptional-args activate debugging

msgnonone  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 integernumber 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

然后再试

中国足彩网信息请查看IT技术专栏

中国足彩网信息请查看数据库
易贤网手机网站地址:Oracle数据库自动备份的实现历程
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标