用户名和密码都没问题,其它的也没问题,不知道为啥连不上,最后总算找到原因了,是因为shell将用户名里面的$service解析成变量了
$ sqlplus "c##cloud$service/WelCome-123#@atpd-exa-8qhsc1:1521/SRCPDB1_high.atp.oraclecloud.com"
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 16 09:46:56 2020
Version 19.8.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:
但是我在sqlplus里用connect却可以连上,百思不得其解,最后终于发现是shell将用户名的一部分解析成变量了
$ sqlplus "/as sysdba"
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 16 09:49:26 2020
Version 19.8.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Connected to:
Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production
Version 19.8.0.0.0
SQL> connect c##cloud$service/WelCome-123#@atpd-exa-8qhsc1:1521/SRCPDB1_high.atp.oraclecloud.com
Connected.
解决方法。
1.不要使用双引号,使用单引号
sqlplus “c##cloud$service/WelCome-123#@atpd-exa-8qhsc1:1521/SRCPDB1_high.atp.oraclecloud.com”
sqlplus ’c##cloud$service/WelCome-123#@atpd-exa-8qhsc1:1521/SRCPDB1_high.atp.oraclecloud.com‘
2.在$ 前加\
sqlplus "c##cloud\$service/WelCome-123#@atpd-exa-8qhsc1:1521/SRCPDB1_high.atp.oraclecloud.com"