ORA-04052\ ORA-00604\ORA-12154
ORA-04052: error occurred when looking up remote object TBCS.SUBS_PRIVILEGE@DD2A
ORA-00604: error occurred at recursive SQL level 1
ORA-12154 TNS:Could not resolve service name(无法处理服务器名)
一个存储过程编译时报错:
line 3 PL/SQL: ORA-04052: error occurred when looking up remote object TBCS.SUBS_PRIVILEGE@DD2A
ORA-00604: error occurred at recursive SQL level 1
ORA-12154: TNS:could not resolve service name
1 insert into SUBSSCORE_DISCARD_SUBSOID(REGION,STATDAY,SUBSID)
2 SELECT DISTINCT av_region,v_agio_day,subsid
3 from yy_subs_privilege
4 WHERE region=av_region and startdate<=add_months(to_date(v_billcycle,'yyyymm'),1)
5 and enddate>to_date(v_billcycle,'yyyymm').
其中yy_subs_privilege是另一个数据库上的表,通过DBLINK连接过去,TBCS.SUBS_PRIVILEGE@DD2A,看这个DBLINK也是正常的,为什么报错呢?
我已经确认连接到的数据库是正常的,我登陆那个数据库都可以查询到数据!
SELECT DISTINCT av_region,v_agio_day,subsid
from yy_subs_privilege
WHERE region=av_region and startdate<=add_months(to_date(v_billcycle,'yyyymm'),1)
and enddate>to_date(v_billcycle,'yyyymm').
yy_subs_privilege是个同义词吧,检查一下对应的源远程的dblink是否可用?可以正常运行吗?可能这个dblink有问题!
问题定位了,是主机上的机器名和我的TNS的机器名不一样,主机上是ZW_BCV,但是TNS上配的是ZWBCV,但是奇怪,我为什么用ZWBCV也能登陆这个数据库呢!!!!