Tuesday, March 17, 2020

Create public database link in oracle database


Create public database link in oracle database
================================================

ORCL TNS alias entry should be added in tnsnames.ora file and tnsping working fine


SQL> !tnsping orcl

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 17-MAR-2020 15:09:24

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xxx.ctttttb0k1yfde.as-sou-2.amazonaws.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =ORCL)))
OK (1340 msec)



SQL> create public database link AWS_RDS connect to admin identified by admin1234567890  using 'ORCL' ;

Database link created


using TNS
==============

create public database link  AWS_RDS_TNS connect to admin identified by admin1234567890
USING '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xxx.ctttttb0k1yfde.as-sou-2.amazonaws.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =ORCL)))';


SQL> create public database link  AWS_RDS_TNS connect to admin identified by admin1234567890
USING '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xxx.cttttb0k1yfde.as-so-3.amazonaws.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =ORCL)))';
  2
Database link created.

SQL> select * from dual@AWS_RDS_TNS;

D
-
X

SQL>


Drop public database link
=============================

SQL> drop public database link AWS_RDS_TNS;

Database link dropped.


SQL>

No comments:

Post a Comment