利用DBLINK同步表資料庫 老劉

2021-06-22 17:19:55 字數 884 閱讀 4042

把10.10.17.2資料庫上的test表定時同步到10.10.17.3資料庫

1.在10.10.17.3上建立dblink指向10.10.17.2資料庫

配置tns資訊如下:

[oracle@june3 admin]$ cat tnsnames.ora

# generated by oracle configuration tools.

june =

(description =

(address_list =

(address = (protocol = tcp)(host = 10.10.17.2)(port = 1521))

)(connect_data =

(service_name = june)

))extproc_connection_data =

(description =

(address_list =

(address = (protocol = ipc)(key = extproc0))

)(connect_data =

(sid = pl***tproc)

(presentation = ro)

)開始建立dblink

sql> create public database link dbl_june connect to test identified by test

2 using 'june';

database link created.

其中dbl_june 為dblink名字

test identified by test 為10.10.17.2的資料庫使用者名稱密碼

using 'june' june為tn

資料庫鏈結(DBLINK)

在分布式資料庫應用中,會使用到資料庫鏈結,即dblink,它是用來訪問分布式環 境下其它資料庫例項的,它定義的是乙個資料庫伺服器到另乙個資料庫伺服器的單向入 口,注意 是 單向 這說明只有擁有dblink的那方才能訪問dblink指向的資料庫服 務器。建立dblink 使用 create datab...

資料庫鏈結DB LINK

通過資料庫鏈結,可以訪問另外乙個資料庫中的表。select from table name db link create database link db link name using net service name 其中net service name是通過在tnsname.ora中配置的網路...

SQL 利用merge 同步資料庫之間表的資料

同步兩個資料庫之間兩表的資料也許的資料庫管理員偶爾需要做的一件事情,下面來記錄一下常用的兩種方法 方法一 使用delete truncate 方法二 使用 merge into merge是在sql server 2008被引入,它能將insert,update,delete簡單的並為一句。根據與源...