[20170607]maximum size is 50 characters.txt
--//昨天有人问,使用链接http://blog.itpub.net/267265/viewspace-2140061/那样的方式连接,会出现问题.
--//我重复测试,做一个记录:
1.环境:
SCOTT@book> @ &r/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
SCOTT@book> conn scott/book@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))(CONNECT_DATA=(service_name=book)))
Connected.
string beginning "'SCOTT@(DE..." is too long. maximum size is 50 characters.
--//实际上上面的提示非常迷惑,而且跟我原来链接写的有点不同.我的大概如下是ok的.
SYS@book> conn scott/book@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = book)))
Connected.
--//我开始以为是里面的空格再作怪.试着删除空格看看.
SYS@book> conn scott/book@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=book)))
Connected.
--//OK,而且长度也超过50字节啊,不好理解,在对比上面的链接,我发现service_name是小写.改写如下:
SCOTT@book> conn scott/book@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(service_name=book)))
Connected.
string beginning "'SCOTT@(DE..." is too long. maximum size is 50 characters.
--//感到不好理解的是如果把SERVER写成小写server,一样ok.
SCOTT@book> conn scott/book@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(server=DEDICATED)(SERVICE_NAME=book)))
Connected.
--//上面第1个改写如下,把service_name改成大写:
SCOTT@book> conn scott/book@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=book)))
Connected.
2.试着修改tnsnames.ora文件(service_name小写):
book =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(service_name = book)
)
)
$ rlsql scott/book@book
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 7 16:33:12 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
--//最终我发现只要service_name里面是小写就报上面的错误.很奇怪做一个记录.