[20211214]ezconnect输入口令的问题.txt
--//前几天看别人解决问题,我发现对方采用ezconnect连接,看上去语法怪怪的,我以前的习惯经常看别人操作学习新的技能.我仔细看对
--//方在命令行没有输入口令.也许出于安全原因还是对方的工作习惯,不过我们生产系统由于等保的原因,口令也忒长,根本记不住,我基
--//本采用copy and paste方式,上班有一点点空闲测试看看对方的写法:
$ sqlplus -s -l scott/book@127.0.0.1:1521/book <<< @ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
--//如果不输入口令:
$ sqlplus -s -l scott@127.0.0.1:1521/book <<< @ver1
ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
--//如果不输入口令上面输入命令无效。
--//这里"/"符号后面跟着密码,因此如果采用如上方式解析就出了问题,认为没有service_name。
--//引入字符解决这个问题:
$ sqlplus scott@\"127.0.0.1:1521/book\"
--//但是我这样遇到另外的问题。如果写成
sqlplus scott@\"127.0.0.1:1521/book\" <<<@ver1
$ sqlplus -s -l scott@\"127.0.0.1:1521/book\" <<<@ver1
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
--//仔细一想就很简单,oracle把后面的输入当作口令了。修改如下:
$ sqlplus -s -l scott@\"127.0.0.1:1521/book\" @ ver1 <<<"book"
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2847551/ ,如需转载,请注明出处,否则将追究法律责任。