Monday, 8 April 2013

How to create Database Link without editing tnsnames.ora file

01system@TEST11> select * from v$version;
02 
03BANNER
04--------------------------------------------------------------------------------
05Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
06PL/SQL Release 11.1.0.7.0 - Production
07CORE    11.1.0.7.0      Production
08TNS for Linux: Version 11.1.0.7.0 - Production
09NLSRTL Version 11.1.0.7.0 - Production
10 
115 rows selected.
12 
13 
14system@TEST11> select * from dba_db_links;
15 
161. no rows selected



Create database link testlink_db2 using full tns entry:
01system@TEST11> create database link testlink_db2
02 connect to system identified by oracle
033  using
04 '(DESCRIPTION=
055    (ADDRESS=
066     (PROTOCOL=TCP)
077     (HOST=10.2.10.18)
088     (PORT=1525))
099    (CONNECT_DATA=
1010     (SID=test10)))'
1111  /
12 
13Database link created.


Now little check and cleanout:
01system@TEST11> select * from v$version@testlink_db2;
02 
03BANNER
04----------------------------------------------------------------
05Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
06PL/SQL Release 10.2.0.4.0 - Production
07CORE    10.2.0.4.0      Production
08TNS for Linux: Version 10.2.0.4.0 - Production
09NLSRTL Version 10.2.0.4.0 - Production
10 
115 rows selected.
12 
13-- cleanout
14system@TEST11> drop database link testlink_db2;
15 
16Database link dropped.

No comments:

Post a Comment