日期:2014-05-16 浏览次数:20584 次
create database link source_link connect to db1_user identified by db1_pwd using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ) )' ;
create snapshot log on t_task_msg;
create snapshot sn_t_task_msg refresh fast Start with sysdate next sysdate with primary key as select * from t_task_msg@source_link; 或 create snapshot sn_t_task_msg as select * from t_task_msg@source_link; Alter snapshot sn_t_task_msg refresh fast Start with sysdate next sysdate with primary key;
create or replace trigger tr_t_task_msg after insert or update or delete on sn_t_task_msg for each row begin if deleting then delete from t_task_msg where fid=:old.fid; end if; if inserting then insert into t_task_msg(fid,fserviceid,fcontent,fuserid,fstate,finserttime) values(:new.fid,:new.fserviceid,:new.fcontent,:new.fuserid,:new.fstate,:new.finserttime); end if; if updating then update t_task_msg set fserviceid=:new.fserviceid, fcontent=:new.fcontent, fuserid=:new.fuserid, fstate=:new.fstate, finserttime=:new.finserttime where fid=:old.fid; end if; end tr_t_task_msg;