建立資料庫連結 create database link

來源:互聯網
上載者:User

刪除資料庫連結:drop database link linkname;

建立資料庫連結:
create database link linkname
connect to username
identified by password
using 'connection string';


如果想建立全域連結,則需要使用關鍵字:public

create public database link linkname
connect to username
identified by password
using 'connection string';


connection string可以有兩種形式:
1,在檔案tnsnames.ora配置的名稱:
如:
CDRDL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.147.129.29)(PORT = 2521))
)
(CONNECT_DATA =
(SERVICE_NAME = cdrdb)
)
)
此時可以寫成:
create database link linkname
connect to username
identified by password
using 'CDRDL';

2,也可以直接使用‘=’號後面的字串,
如:
create database link linkname
connect to username
identified by password
using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.147.129.29)(PORT=2521)))(CONNECT_DATA=(SERVICE_NAME=cdrdb)))';

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.