您的位置: 云浮资讯网 > 星座

PL-SQL 快速建立DB_LINK

发布时间:2019-09-13 20:56:45

本地数据库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

查看本文来源

孩子便秘怎么办
新生儿咳嗽是怎么回事
脑梗塞最佳药
剖宫产术后怎么防止腹胀便秘
猜你会喜欢的
猜你会喜欢的