Database link 链接报错
错误 ORA-12154: TNS: 无法解析指定的连接标识符。
引入知识:客户端是通过tnsnames.ora来识别连接服务器的如果你没有添加tnsnames.ora,那么你就连接不上服务器的。
database link 访问数据库需要访问本地数据库的tnsname.ora文件。所以在本地tnsname.ora 文件添加如下内容:
# tnsnames.ora Network Configuration File: c:/Oracle/product/10.1.0/NETWORK/ADMIN/tnsnames.ora
# Generated by Oracle configuration tools.
OFS1_192.168.0.2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ofs1)
(SERVER = DEDICATED)
)
)
OFS1_LOCALHOST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ofs1)
(SERVER = DEDICATED)
)
)