dblink 怎么用

 Ceate [Shared][Public] Database Link Dblink_Name
[Connect To {Current_User|User Identified By Password [Authenticated By User Identified By Password}|Authenticated By User Identified By Password][Using’Connect_String’];
        具体参数略,需要db_domain。并且需要在远端数据库上有用户帐户。
步骤一、在sam数据库tnsnames.ora存在tnsname,如
     sam=
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = zx)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = sam)
)  )
步骤二、以system登陆book数据库,创建一个to_sam_mx的database link
Conn system@book
Create public database link to_sam_m1
        Connect to currnet_user using ‘sam’;
Create publink database link to_sam_m2
        Connect to tuner identified by tuner using ‘sam’;
Create public database link to_sam_m3 using ‘sam’;
        步骤三、验证步骤二中的连接
Show parmeter db_domain
select ‘global_name from global_name@to_sam_m1
select ‘global_name from global_name@to_sam_m2
select ‘global_name from global_name@to_sam_m3
步骤四、select * from dba_db_links 观察连接

应用测试
1、        )connect demo@book  
2、        )select * from cc@to_sam_m2;
select * from location;
insert into location values(999,’ottawa’)
                insert into cc@to_sam_m2 values(‘’);
                select * from cc@to_sam_m2;
                commit;
3、        )connect tuner@sam
验证数据变更
        可以使用v$dblink的动态性能图来进行性能查看

你可能感兴趣的:(数据库,user,database,System,domain,insert)