分类:
2008-10-28 10:11:14
本地数据库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 -
> 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 .
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 TO -
> 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 .
2 rows inserted into TEST.
2 rows committed into TEST at .
详细资料请参考SQL*Plus User's Guide and Reference