带参数的rman脚本

use*_*858 4 oracle shell rman

我试图动态地将备份位置传递给rman脚本,如下所示.但它失败了语法错误.有没有办法将"/ backup/folder/folder /"传递给rman脚本?如果我只是传递没有"/"的字符串它可以工作,但是"/"它会失败.

rman @${rmanbasepath}rman_replication_from_backups.rcv USING ${dbname} ${backupdir}
Run Code Online (Sandbox Code Playgroud)

backup.rcv

CONNECT AUXILIARY /
run {
allocate auxiliary channel a1 device type disk;
allocate auxiliary channel a2 device type disk;
allocate auxiliary channel a3 device type disk;
allocate auxiliary channel a4 device type disk;
DUPLICATE TARGET DATABASE TO &1
BACKUP LOCATION '&2'
NOFILENAMECHECK;
}
EXIT;
Run Code Online (Sandbox Code Playgroud)

use*_*858 5

https://community.oracle.com/thread/3514298找到解决方案.解决方案是在替换参数的双引号周围使用单引号

像这样:

$ rman @'config.cmd' using "'/rman_backup'"
Run Code Online (Sandbox Code Playgroud)