带参数的 rman 脚本

rman script with parameters

我正在尝试将备份位置动态传递给 rman 脚本,如下所示。但它因语法错误而失败。有没有办法将“/backup/folder/folder/”传递给 rman 脚本?如果我只是传递不带“/”的字符串,它可以工作,但带“/”则失败。

rman @${rmanbasepath}rman_replication_from_backups.rcv USING ${dbname} ${backupdir}

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;

https://community.oracle.com/thread/3514298 找到解决方案。解决方案是在替换参数

的双引号周围使用单引号

像这样:

$ rman @'config.cmd' using "'/rman_backup'"