[20170712]建立dblink的问题.txt
SYS@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> CREATE PUBLIC DATABASE LINK 33 CONNECT TO SCOTT IDENTIFIED BY btbtms USING '192.168.100.33:1521/test';
CREATE PUBLIC DATABASE LINK 33 CONNECT TO SCOTT IDENTIFIED BY btbtms USING '192.168.100.33:1521/test'
*
ERROR at line 1:
ORA-01729: database link name expected
--//不能使用数字作为dblink name.加入引号看看:
SCOTT@book> CREATE PUBLIC DATABASE LINK "33" CONNECT TO SCOTT IDENTIFIED BY btbtms USING '192.168.100.33:1521/test';
Database link created.
SCOTT@book> select sysdate from dual@33;
select sysdate from dual@33
*
ERROR at line 1:
ORA-01729: database link name expected
SCOTT@book> select sysdate from dual@'33';
select sysdate from dual@'33'
*
ERROR at line 1:
ORA-01729: database link name expected
SCOTT@book> select sysdate from dual@"33";
SYSDATE
-------------------
2017-07-12 16:40:08
--//必须加入双引号才可以执行.建议建立db link最好不要全部使用数字作为名字.
SCOTT@book> select * from DBA_DB_LINKS;
OWNER DB_LINK USERNAME HOST CREATED
------ --------- --------- ------------------------ -------------------
PUBLIC LOOPBACK localhost:1521/book 2016-12-14 15:17:00
PUBLIC TEST040 SCOTT test40 2017-01-09 09:14:26
PUBLIC L33 SCOTT 192.168.100.33:1521/test 2017-07-12 09:18:53
PUBLIC 33 SCOTT 192.168.100.33:1521/test 2017-07-12 16:39:22