1 修改tnsnames.ora文件,在本地服务器建立远程服务连接
$ORACLE_HOME/network/admin/tnsnames.ora
REPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 168.168.211.122)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbc2)
)
)
----------
命令行远程访问 sqlplus easyrep/easyrep@repdb
easydb方法远程访问 lrt_table.vConnect->connect ( "easyrep", "easyrep", "repdb" )
2 建立database link
CREATE PUBLIC DATABASE LINK hisdb
CONNECT TO easyrep IDENTIFIED BY easyrep
USING 'repdb';
3 执行SQL
select * from easyrep.skmzd@hisdb;
4 建立同义词
SQL> create synonym easycore.skmzd2 for easyrep.skmzd@hisdb;
Synonym created.
5 使用同义词
SQL> select * from easycore.skmzd2 where kmh='5010520';
KMXH KMH KMM Z Y
---------- ---------- ---------------------------------------- - -
KMBZ DYCDZH CDZH HZKMH CBBZ
-------------------- ---------- ---------- ---------- ----------
4769 5010520 ?????? 6 0
010000010001003 0 0 50105 7
SQL> delete from easycore.skmzd2 where kmh='5010520';
1 row deleted.
6 删除同义词
SQL> drop synonym easycore.skmzd2;
Synonym dropped.
7 删除database link
drop PUBLIC DATABASE LINK hisdb;
阅读(760) | 评论(0) | 转发(0) |