当前位置: 首页 > 图文教程 > 数据库 > Oracle > Oracle数据库自动备份的具体实现步骤

Oracle
解决Oracle 9i和Tomcat端口冲突
Oracle JOB的建立,定时执行任务
ORA-01562 和 ORA-01628 问题解决
oracle startup时 ORA-00600错误解决
解决Oracle处理中文乱码的一种方法
用Oracle10g列值掩码技术隐藏敏感数据
如何解决JOB的Interval输入参数过长
理解物化视图刷新过程中出现的约束冲突
Oracle数据库如何查询记录时给记录加锁
两种方法分析每月工作日计算程序
如何避免Oracle数据库密码出现@符号
在Oracle中使用登录触发器初始化用户会话
Oracle数据库中的数据出错的解决办法
Oracle11.2 命令行手工最简创建数据库的过程
Oracle 语句优化分析说明
ORACLE 常用函数总结(80个)
从Oracle 表格行列转置说起
EXECUTE IMMEDIATE用法小结
Oracle 创建用户及数据表的方法
oracle 在一个存储过程中调用另一个返回游标的存储过程

Oracle数据库自动备份的具体实现步骤


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-30   浏览: 38 ::
收藏到网摘: n/a

本文主要描述了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
databasecatalog quoted-string connect-string
for recovery catalognocatalog none if specified,
then no recovery catalogcmdfile quoted-string
name of input command filelog quoted-string
name of output message log filetrace
quoted-string name of output debugging
message log fileappend none if specified,
log is opened in append modedebug optional-args
activate debuggingmsgno none show rman-nnnn prefix
for all messagessend quoted-string send a command
to the media managerpipe string building block for
pipe namestimeout integer number of seconds to wait
for pipe inputchecksyntax 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_1export oracle_sid=testexport
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
@rmanrun{allocate channel d1 device type
disk;sql "alter system archive log current";
backup archivelog all delete input forma