oracle建立数据库连接

时间:2022-11-25 08:27:07

除了全库拷贝,这个应该是oracle两个数据库之间进行数据迁移最快的方法了。

CREATE PUBLIC DATABASE LINK zhengshi CONNECT TO 用户名 IDENTIFIED BY "密码" USING '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)'

 

注意,用户名不能加双引号,密码必须加。否则会报错oracle dblink 01017。

查询时,select * from 表名@zhengshi