是这样的
CREATE  DATABASE  LINK  ykhr  CONNECT  TO  YKHR  IDENTIFIED  BY  YKHR  USING  'ORCL_192.168.0.3'  
 
CREATE  SYNONYM  DEPARTMENT  FOR  DEPARTMENT@ykhr  ;  
select  *  from  department  
 
老是报错:tns:could  not  resolve  service  name

解决方案 »

  1.   

    'ORCL_192.168.0.3' 有没错阿?
      

  2.   

    GLOBAL_NAMESProperty Description 
    Parameter type  Boolean 
    Default value  false 
    Modifiable  ALTER SESSION, ALTER SYSTEM 
    Range of values           true | false 
    GLOBAL_NAMES specifies whether a database link is required to have the same name as the database to which it connects.If the value of GLOBAL_NAMES is false, then no check is performed. If you use or plan to use distributed processing, then Oracle recommends that you set this parameter to true to ensure the use of consistent naming conventions for databases and links in a networked environment.
      

  3.   

    不用配置,试试用要连接的远程数据库名作为database link的名字
      

  4.   

    服务器 tnsping ORCL_192.168.0.3 试试