You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

含$符号的Oracle数据库密码在RMAN中无法使用的问题求助

解决RMAN连接时ORA-01017无效用户名/密码错误

问题根源

你的密码包含$符号,而$在shell中是特殊字符,会被解析为环境变量引用。原命令里smith123$@中的$@被shell自动解析,导致实际传递给RMAN的密码缺失了$,最终引发登录失败。

解决方案

提供三种可行的修改方式:

  • 转义特殊字符:在密码里的$前加反斜杠\,让shell将其视为普通字符处理:

    su - root -c "rman target SYSTEM/smith123\$@ORCL cmdfile /home/oracle/dbDump/rman.ls"
    
  • 用单引号包裹命令:单引号在shell中不会解析内部的特殊字符,能完整保留原始密码:

    su - root -c 'rman target SYSTEM/smith123$@ORCL cmdfile /home/oracle/dbDump/rman.ls'
    
  • 推荐:直接用oracle用户执行:通常不建议用root用户操作Oracle相关命令,切换到oracle用户后执行更安全,命令可简化为:

    rman target SYSTEM/smith123\$@ORCL cmdfile /home/oracle/dbDump/rman.ls
    

    或者用单引号包裹连接字符串:

    rman target 'SYSTEM/smith123$@ORCL' cmdfile /home/oracle/dbDump/rman.ls
    

验证方法

可以先用sqlplus测试连接是否正常,确认密码转义是否有效:

sqlplus SYSTEM/smith123\$@ORCL

内容的提问来源于stack exchange,提问作者SabeekAhamed Sagabdheen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 08:30:52