--创建dblink
CREATE PUBLIC DATABASE LINK weixinDDL CONNECT TO WEIXIN_FJ IDENTIFIED BY weixin_fj USING 'WEIXIN_FJ';
CREATE SHARED PUBLIC DATABASE LINK weixinDDL2 AUTHENTICATED BY WEIXIN_FJ IDENTIFIED BY weixin_fj USING 'WEIXIN_FJ';
--*
create database link weixinDDL4 connect to WEIXIN_FJ identified by WEIXIN_FJ
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 221.130.48.67)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = cring)
)
)'
create database link WEIXINDDL connect to WEIXIN_FJ identified by WEIXIN_FJ using 'cring'
---查询服务名称 window
SHOW PARAMETER service_names
--查询db_link
select db_link,owner from dba_db_links for update;
--删除 dblink
DROP WEIXIN_FJ LINK WEIXINDL(DBLINK名) ;
--删除 public dblink
drop public database link WEIXINDDL
--删除 dblink
drop database link WEIXINDDL
--复制表
Create table tb_name as select * from tb_name@dblink_name;
Create table t_em_hb2 as select * from t_em_hb@WEIXINDDL5;
insert into tb_name select * from t_em_hb@WEIXINDDL5;
select count(0) from t_em_hb2;
select count(0) from t_em_hb;
select * from t_wechat_red_enve_user_new;
SELECT * FROM t_wechat_red_enve_user_new@WEIXINDDL link;
SELECT * FROM t_wechat_red_enve_user_new@weixinDDL link;
---