1、创建dblink名为:dblink_test 数据库用户名:test 密码:12345 (数字开头的要用双引号引起来) 数据库实例名:127.0.0.1:1521/ORCL
例1:create public database link dblink_test connect to test identified by "12345" using '127.0.0.1:1521/ORCL'
例2:create public database link dblink_test connect to test identified by "12345" USING '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = orcl)))';
如果遇到
ORA-22992:无法使用从远程表选择的LOB定位器解决方案
可以看看 http://www.itpub.net/thread-630700-1-1.html
解决办法:使用全局临时表。
SQL> create global temporary table foo
2 (
3 X BLOB
4 )
5 on commit delete rows;
Table created
SQL> insert into foo select blobcolumn from remoteTable@dl_remote where rownum = 1;
1 row inserted
SQL>
插入本地临时表之后,在本地的操作就没有任何问题了。