Create Oracle database link to SQL Server

1.4k Views Asked by At

How can I create a database link from Oracle on PL/SQL to SQL Server based on this picture:

Example: the SQL Server installed in computer IP 190.168.0.1 and that computer user is MCHSQLSERVER password is 12345678 and the server name of SQL Server is DESTOP01 user of database is sa and password is 123123

enter image description here

Please help if any one know this.

1

There are 1 best solutions below

0
On

After configuring the heterogeneous services

CREATE DATABASE LINK DB_LINK_NAME
   CONNECT TO user_name 
   IDENTIFIED BY password
   USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Your_host_name_or_IP)(PORT=Your_port))(CONNECT_DATA(SID=Your_service_id))(HS=OK))';

If you want a public DB Link is quite similar just add the word public:

CREATE PUBLIC DATABASE LINK DB_LINK_NAME
   CONNECT TO user_name 
   IDENTIFIED BY password
   USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Your_host_name_or_IP)(PORT=Your_port))(CONNECT_DATA(SID=Your_service_id))(HS=OK))';

Access the remote table using:

select * from remote_table@DB_LINK_NAME;