0% found this document useful (0 votes)
414 views4 pages

Create (Shared) (Public) Database Link Dblink: Welcome - Wip Using

The document discusses how to create an Oracle database link (DBLink) to connect to a remote Oracle database. It provides the basic SQL syntax for creating a DBLink, including specifying the DBLink name, remote user, password, and connection string. An example CREATE DBLink statement is given. The document also discusses how to create DBLinks to non-Oracle databases, providing steps to create a DBLink to a MySQL database.

Uploaded by

g_vedha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
414 views4 pages

Create (Shared) (Public) Database Link Dblink: Welcome - Wip Using

The document discusses how to create an Oracle database link (DBLink) to connect to a remote Oracle database. It provides the basic SQL syntax for creating a DBLink, including specifying the DBLink name, remote user, password, and connection string. An example CREATE DBLink statement is given. The document also discusses how to create DBLinks to non-Oracle databases, providing steps to create a DBLink to a MySQL database.

Uploaded by

g_vedha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Create a DBLink

The Oracle docs note the syntax for creating an Oracle dblink as follows:

CREATE [ SHARED ] [ PUBLIC ] DATABASE LINK dblink


[ CONNECT TO
{ CURRENT_USER
| user IDENTIFIED BY password
[ dblink_authentication ]
}
| dblink_authentication
]
[ USING 'connect_string' ] ;

 Oracle has invested heavily in distributed database technology and the creation of a
database link is very straightforward.  You specify the dblink name, the remote user to
connect to, the password for the remote user and the TNS service name for the database
link connection:

create public database link


  mylink
connect to
  remote_username
identified by
  mypassword
using 'tns_service_name';

create database link DBLink_LMCWIP01 connect to LMCWIP01 identified by


welcome_wip using ‘

CREATE DATABASE LINK "RIJMASTER.WORLD" CONNECT TO "CBDSIEPMAN" IDENTIFIED by


"******" USING '(DESCRIPTION=(ADDRESS=(COMMUNITY=TCP.world)(PROTOCOL=TCP)
(Host=EAGLE.SIEP.SHELL.COM)(Port=1521))(CONNECT_DATA=(SID=EDW817P)
(SERVER=DEDICATED)))'

or CREATE DATABASE LINK "RIJMASTER.WORLD" CONNECT TO "CBDSIEPMAN" IDENTIFIED by


"******" USING 'tnsnames';

desc LMCWIP01.activity@DBLink_LMCWIP01

create database link FXPGSM2P connect to rptmig identified by rptmig


using 'FXPGSM2P.WORLD';
SELECT
DBMS_METADATA.GET_DDL('DB_LINK','ACSP_FXGSM1U2.WORLD','PUBLIC') from
dual;

SQL> select * from dba_db_links;

no rows selected

SQL> create database link DBLink_LMCWIP01 connect to LMCWIP01 identified by welcome_wip


using 'WIPPNGP';

Database link created.

SQL>

SQL> desc LMCWIP01.Z_REPORTING_DATES@DBLINK_LMCWIP01

Name Null? Type

----------------------------------------- -------- ----------------------------

LAST_YIELD_UPDATE_DATE DATE

DBLink problem :

Connected to WIPPNGP1 and checked if the object exist under LMCWIP01 :

SQL>select object_name from dba_objects where owner = ‘LMCWIP01’;

OBJECT_NAME
--------------------------------------------------------------------------------
Z_REPORTING_DATES
Z_STORED_PROC_ERRORS
Z_LOT_YIELDS
Z_LOT_YIELDS_PK
Z_LOT_YIELDS_WF_STEP
Z_LOT_YIELDS_WF_STEP_PK

3680 rows selected.


Connected to WIPSGPP1 and test run the command below :

SQL> desc LMCWIP01.Z_REPORTING_DATES@DBLINK_LMCWIP01

Name Null? Type

----------------------------------------- -------- ----------------------------

LAST_YIELD_UPDATE_DATE DATE
You can also create a dblink to non-Oracle databases,  Francisco Riccio describes the
steps for a database link to MySQL:

Step 1:  Your first step is having installed the TRANSPARENT GATEWAY (it comes in
as of the options when you install Oracle).

Step 2: You must have a user in the SQL Server.

Step 3: In the directory <ORACLE_HOME>\tg4msql\admin look for the file


inittg4msql.ora and have the following options:
HS_FDS_CONNECT_INFO="SERVER=name_server;DATABASE=name_db"
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=user_sqlserver
HS_FDS_RECOVERY_PWD=pass_user_sqlserver

Step 4: Configure the listener and add the following


(SID_DESC =
(PROGRAM = tg4msql)
(SID_NAME = MSQL)
(ORACLE_HOME = C:\oracle1)
)
)

and in our tnsnames.ora add


MSQL=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = servidor)(PORT = 1521))
)
(CONNECT_DATA =
(SID = MSQL)
)
(HS=OK)
)

where HS set up as a heterogonous service

Step 5: create a link to sql server.


create database link msql connect to user_sqlserver identified by password using 'MSQL';

Step 6: You can now use the database link to a foreign database:
select * from table@msql

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy