oracle DBLink oracle

aishu521發表於2012-08-20

幫看下建立dblink是否正確:

方法一:

SQL> conn / as sysdba

Connected.

SQL> create public database link ink_sfc85

  2  connect to sfcdata identified by sfc

  3  using 'FKSFCDB2';

 

Database link created.

驗證:

SQL> select * from checkbarcode@ink_sfc85; OK

 

方法2

 

SYS@test >CREATE USER ink_drd  identified by drd

  2  default tablespace TBS_DRB;

 

User created.

 

SYS@test >GRANT "CONNECT" TO ink_drd;

 

Grant succeeded.

 

SYS@test >ALTER USER ink_drd  DEFAULT ROLE NONE;

User altered.

 

SYS@test >GRANT CREATE SESSION TO ink_drd ;

 

Grant succeeded.

 

 

SYS@test >GRANT SELECT ON "DRB"."DRB_MAIN" to ink_drd;

 

Grant succeeded.

 

本機測試:

 

INK_DRD@test >select V_CRTMANT from  DRB.DRB_MAIN;

V_CRTMANT

----------

df

dfd

dfd

TKS!

建立DBlink

SQL> create public database link ink_sfc86

  2  connect to ink_drd identified by drd

  3  using 'TEST';

 

Database link created.

 

測試dblink

SQL> select V_CODE,V_CRTUNIT from DRB.DRB_MAIN@ink_sfc86

V_CODE               V_CRTUNIT

-------------------- ----------

AD1109002            sfd

BD1109003            fdg

BD1109001            dfsf

AD1109001            test

 

其他表不可以查詢

SQL> select * from DRB.DRB_MENU;

select * from DRB.DRB_MENU

                  *

ERROR at line 1:

ORA-00942: table or view does not exis

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15187685/viewspace-741403/,如需轉載,請註明出處,否則將追究法律責任。

相關文章