Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖
1#
发表于 2013-11-11 23:47:13
具体运行了报什么错 总要说一下吧?

回复 显示全部楼层 道具 举报

2#
发表于 2013-11-11 23:48:19
给一个例子

Example 2-128 Specifying Substitution Variables

Suppose that you want to create a Linux shell script that backs up the database. You want to use shell variables so that you can pass arguments to the RMAN backup script at run time. Substitution variables solve this problem. First, you create a command file named whole_db.cmd with the following contents:

cat > /tmp/whole_db.cmd <<EOF
# name: whole_db.cmd
CONNECT TARGET /
BACKUP TAG &1 COPIES &2 DATABASE FORMAT '/disk2/db_%U';
EXIT;
EOF
Next, you write the following Linux shell script, which sets csh shell variables tagname and copies. The shell script starts RMAN, connects to target database prod1, and runs whole_db.cmd. The USING clause passes the values in the variables tagname and copies to the RMAN command file at execution time.

#!/bin/csh
# name: runbackup.sh
# usage: use the tag name and number of copies as arguments
set tagname = $argv[1]
set copies = $argv[2]
rman @'/tmp/whole_db.cmd' USING $tagname $copies LOG /tmp/runbackup.out
# note that the preceding line is equivalent to:
# rman @'/tmp/whole_db.cmd' $tagname $copies LOG /tmp/runbackup.out
Finally, you execute the shell script runbackup.sh from a Linux shell as follows to create two backups of the database with the tag Q106:

回复 显示全部楼层 道具 举报

3#
发表于 2013-11-11 23:58:03
去掉双引号试试 "cf_c-2883472017-20131111-05", 或者这个并非有效的 控制文件备份

回复 显示全部楼层 道具 举报

4#
发表于 2013-11-12 00:08:35
1、cat ctl.sh

2、 对于autobackup 如果没特殊要求 , 其实可以不指定文件名,当然有前提

3、 毫无疑问是低级错误, 目前没有 时间帮你测

回复 显示全部楼层 道具 举报

5#
发表于 2013-11-12 21:57:47
11.2
[oracle@mlab2 ~]$ cat ctl.sh
#!/bin/bash
export ORACLE_SID=G11R204
export ORACLE_HOME=/s01/oracle/app/oracle/product/11.2.0.4/dbhome_1
$ORACLE_HOME/bin/rman  cmdfile='/home/oracle/ctlbak.cmd' 'maclean'

[oracle@mlab2 ~]$ cat ctlbak.cmd

connect target /
run{
restore controlfile from  '/s01/fast_recovery_area/G11R204/backupset/2013_11_12/&1.bkp';
}


[oracle@mlab2 ~]$ ./ctl.sh

Recovery Manager: Release 11.2.0.4.0 - Production on Tue Nov 12 08:50:30 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

RMAN>
RMAN> connect target *
2> run{
3> restore controlfile from  '/s01/fast_recovery_area/G11R204/backupset/2013_11_12/macleanbkp';
4> }
5>
6>
connected to target database: G11R204 (DBID=2438469611)

Starting restore at 12-NOV-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=11 device type=DISK

回复 显示全部楼层 道具 举报

6#
发表于 2013-11-12 21:59:12
结论 : 10.2 当路径中存在SHELL输入变量时可能存在问题

workaround:使用 restore controlfile from autobackup;

回复 显示全部楼层 道具 举报

7#
发表于 2013-11-12 22:12:41
为什么不能用restore controlfile from autobackup;?

回复 显示全部楼层 道具 举报

8#
发表于 2013-11-12 22:19:53
当然可以

回复 显示全部楼层 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-6-1 18:57 , Processed in 0.075745 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569