你必须先在数据库a上建立一个b的数据库连接, 然后你的查询语句要改为: select t_a.name,t_b.addr,t_b.teacher from t_a,t_b@b t_b where t_a.name=t_b.name
还是有问题 数据库db1中有表test,db2中有表t_test SQL> select * from test;A B C ---------- ---------- ---------- 3 john 3 4 MIKE 4 2 Tom 2 1 Jack 3SQL> select * from t_test;A ADDR ---------- ---------- 1 Liaoning 2 Beijing建立连接 create database link mylink connect to scott identified by tiger using 'db1:1521:orcl' 然后进行查询 select test.a,t_test.b from test,t_test@db2 t_test where test.a=t_test.a出错: select test.a,t_test.b from test,t_test@db2 t_test where test.a=t_test.a * ERROR 位于第 1 行: ORA-12154: TNS: 无法处理服务名
还是出错 select test.a,t_test.b from test,t_test@mylink t_test where test.a=t_test.a * ERROR 位于第 1 行: ORA-06401: NETCMN: 无效的驱动程序指示符
in init.ora: globe_name=false then bounce you db
将问题改的简单些,方便回答: 想另一个数据库db2中的表t_test create database link mylink connect to scott identified by tiger using 'db2'; select * from t_test@db2; 出错 select * from t_test@db2 * ERROR 位于第 1 行: ORA-12154: TNS: 无法处理服务名 什么原因?
重启出问题了 在sqlplus中我:connect system/manager@db1 as sysdba 然后 shutdown重启不了了 SQL> connect system/manager@db1 as sysdba ERROR: ORA-12154: TNS:could not resolve service name
然后你的查询语句要改为:
select t_a.name,t_b.addr,t_b.teacher from t_a,t_b@b t_b where
t_a.name=t_b.name
数据库db1中有表test,db2中有表t_test
SQL> select * from test;A B C
---------- ---------- ----------
3 john 3
4 MIKE 4
2 Tom 2
1 Jack 3SQL> select * from t_test;A ADDR
---------- ----------
1 Liaoning
2 Beijing建立连接
create database link mylink
connect to scott
identified by tiger using 'db1:1521:orcl'
然后进行查询
select test.a,t_test.b from test,t_test@db2 t_test where test.a=t_test.a出错:
select test.a,t_test.b from test,t_test@db2 t_test where test.a=t_test.a
*
ERROR 位于第 1 行:
ORA-12154: TNS: 无法处理服务名
select test.a,t_test.b from test,t_test@mylink t_test where test.a=t_test.a
*
ERROR 位于第 1 行:
ORA-06401: NETCMN: 无效的驱动程序指示符
globe_name=false
then bounce you db
想另一个数据库db2中的表t_test
create database link mylink
connect to scott identified by tiger
using 'db2';
select * from t_test@db2;
出错
select * from t_test@db2
*
ERROR 位于第 1 行:
ORA-12154: TNS: 无法处理服务名
什么原因?
在sqlplus中我:connect system/manager@db1 as sysdba
然后 shutdown重启不了了
SQL> connect system/manager@db1 as sysdba
ERROR:
ORA-12154: TNS:could not resolve service name
但查询还是执行不了,提示依然和从前一样
1 scott有权利访问两个数据库以及相应的表
2 两个数据库的init.ora文件都改了
3 两个数据库都是激活状态查询不行
http://www.experts-exchange.com/Databases/Oracle/Q_20484585.html