Chinaunix首页 | 论坛 | 博客
  • 博客访问: 606509
  • 博文数量: 841
  • 博客积分: 5000
  • 博客等级: 大校
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-28 10:08
文章分类

全部博文(841)

文章存档

2011年(1)

2008年(840)

我的朋友

分类:

2008-10-28 10:11:12


  本地数据库SID=T2
  
  远程数据库SID=LIFE02
  
  假设你的网络设定无误
  
  1) vi local database tnsname.ora
  
  life02 =
  (description =
  (address = (protocol = tcp)(host = 192.168.1.1)(port = 1521))
  (connect_data = (sid = life02))
  )
  
  2)建立属于公开的(public)或者是专属的db link object
  
  SQL> CREATE PUBLIC DATABASE LINK MYTEST
  2 CONNECT TO APPLE IDENTIFIED BY APPLE
  3 USING 'life02'
  
  Database link created.
  
  3)复制远程数据库的table到本地数据库来
  
  SQL> COPY FROM APPLE/APPLE@LIFE02 -
  > CREATE ABC -
  > USING SELECT * FROM TEST;
  
  Array fetch/bind size is 15. (arraysize is 15)
  Will commit when done. (copycommit is 0)
  Maximum long size is 80. (long is 80)
  Table ABC created.
  
  3 rows selected from APPLE@LIFE02.
  3 rows inserted into ABC.
  3 rows committed into ABC at DEFAULT HOST connection.
  
  SQL> SELECT * FROM ABC;
  
  ID
  ----------
  100
  200
  333
  
  SQL>
  
  4)从本地端表格复制数据到远程数据库表格上
  
  SQL> COPY FROM JACK/JACK@T2 TO APPLE/APPLE@LIFE02 -
  > INSERT TEST -
  > USING SELECT * FROM T1;
  Array fetch/bind size is 15. (arraysize is 15)
  Will commit when done. (copycommit is 0)
  Maximum long size is 80. (long is 80)
  2 rows selected from JACK@T2.
  2 rows inserted into TEST.
  2 rows committed into TEST at APPLE@LIFE02.
  
  详细资料请参考SQL*Plus User's Guide and Reference
【责编:admin】

--------------------next---------------------

阅读(317) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~