oracle資料庫dblink怎麼用

2021-08-11 09:05:56 字數 2179 閱讀 2490

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 =

oracle資料庫,Oracle新建資料庫

樓主只要新建一個表空間,並把它分配給一個使用者就可以了。確定樓主是以管理員身份登入的 1.首先,建立 新 使用者 create user username identified by password username 新使用者名稱的使用者名稱 password 新使用者的密碼 也可以不建立新使用者...

在oracle資料庫中表空間和資料庫什麼區別

ms sql使用者登入就能建立資料庫的意思是她本身就有一個資料庫,你連的是預設資料庫。oracle安裝的時候也會問你是否在安裝資料庫軟體的時候建立一個例項,如果你同意建立例項那麼你連線進來的時候也會有個預設的資料庫給你去建立表之類的東西。所以根本上這些都是差不多,都是因為他們裡面有例項在執行了。再說...

在oracle資料庫中如果查詢資料庫中有哪幾張表

分兩種情況,一種是查詢當前使用者下的表,另一種是查詢當前資料庫下所有的表。查詢當前使用者的表 select table name from user tables 查詢當前資料庫下所有的表 select from user tables 查詢當前使用者的表 select from all table...