oracle資料庫dblink怎麼用

時間 2021-08-11 18:15:23

1樓:匿名使用者

select *

from 表名@dblink名

2樓:

建立公開資料庫連結

create public database link “資料庫連結別名”

connect to “登陸使用者” identified by “登陸密碼”

using '(description =(address_list =(address =(protocol = tcp)(host = ip)(port = 1521)))(connect_data =(sid = sid)))';

例如:create public database link mydblink

connect to user1 identified by password1

using '(description =(address_list =(address =(protocol = tcp)(host = 10.10.10.

10)(port = 1521)))(connect_data =(sid = ora10)))';

oracle中建立了dblink怎麼使用

3樓:智者總要千慮

建立dblink一般有兩種方式,不過在建立dblink之前使用者必須有建立dblink的許可權。想知道有關dblink的許可權,以sys使用者登入到本地資料庫:

select * from user_sys_privs t

where t.privilege like upper('%link%');

1 sys create database link no

2 sys drop public database link no

3 sys create public database link no

可以看出在資料庫中dblink有三種許可權create database link(所建立的dblink只能是建立者能使用,別的使用者使用不了),create public database link(public表示所建立的dblink所有使用者都可以使用),drop public database link。

在sys使用者下,把create public database link,drop public database link許可權授予給你的使用者

grant create public database link,drop public database link to scott;

然後以scott使用者登入本地資料庫

1.建立dblink的第一種方式,是在本地資料庫tnsnames.ora檔案中配置了要遠端訪問的資料庫。

create public database link

to_bylw connect to scott identified by tiger using 'bylw';

其中to_bylw是你建立的dblink名字,bylw是遠端資料庫的例項名,scott/tiger是登入到遠端資料庫的使用者/密碼。然後在本地資料庫中通過dblink訪問遠端資料庫'bylw'中scott.tb_test表,sql語句如下所示

select * from scott.tb_test@to_bylw;

2.建立dblink的第二種方式,是在本地資料庫tnsnames.ora檔案中沒有配置要訪問的遠端資料庫,

create database link to_test

connect to scott identified by tiger

using '(description =

(address_list =

(address = (protocol = tcp)(host = 192.168.1.5)(port = 1521))  )  (connect_data =

(server = dedicated)

(service_name = bylw)  )  )';  第二種是把第一種配置在tnsnames.ora檔案中的資訊,直接放在建立dblink語句後面。第一種情況tnsnames.

ora檔案中資訊如下:  bylw =  (description =

(address_list =

(address = (protocol = tcp)(host = 192.168.1.5)(port = 1521))  )  (connect_data =

sql資料庫和oracle資料庫哪個好

兄弟,聽我的。肯定學習oracle。原因 1 oracle是商用的最廣泛的關係型資料庫管理系統,廣泛應用於銀行 電信 電力 社保等各個領域。特別是對於unix和linux平臺,sqlserver怎麼用啊?我想你學習,肯定為了將來應用,或者工作,你的簡歷裡面寫oracle和sqlserver完全是不一...

oracle資料庫備份語句

exp 畢竟也需要連線到資料庫,也就是需要提供使用者名稱,密碼,所以你說的資料庫模式匯出,是無法正常實現的。但是使用dba使用者登陸,可以實現匯出整個資料庫的類似功能。資料庫模式 exp system passwd oracle full y file db081222.dmp log db0812...

oracle資料庫語句問題

就是當你在多表連線查詢時方便你區分,就是乙個標識,和效率無關!select from g2 contract materials gm where 5003094 vsselect from g2 contract materials where contract id 5003094 乙個用了 g...