1.在本地创建一个网络服务(tnsnames.ora)
cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
vi tnsnames.ora
ly001 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = [图片]192.168.1.44)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = [图片]VDEDU.oracle.com)
)
)
2.创建数据库链接,using后面写tnsnames.ora里面的网络服务名,也就是 tnsnames.ora里面顶头写的那个单词,等号左面的
SYS@VDEDU>CREATE PUBLIC DATABASE LINK LINK_liyang_HR3 CONNECT TO HR IDENTIFIED by oracle USING 'ly001';
3.在本地登陆数据库,使用数据库链接,查询或修改对方的表
SYS@VDEDU>select count(*) from employees@LINK_liyang_HR3;
cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
vi tnsnames.ora
ly001 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = [图片]192.168.1.44)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = [图片]VDEDU.oracle.com)
)
)
2.创建数据库链接,using后面写tnsnames.ora里面的网络服务名,也就是 tnsnames.ora里面顶头写的那个单词,等号左面的
SYS@VDEDU>CREATE PUBLIC DATABASE LINK LINK_liyang_HR3 CONNECT TO HR IDENTIFIED by oracle USING 'ly001';
3.在本地登陆数据库,使用数据库链接,查询或修改对方的表
SYS@VDEDU>select count(*) from employees@LINK_liyang_HR3;