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

About the Author : Anurag Pandey | Database cloud Architect | Oracle | SQL Server | PostgreSQL | AI and Data Platform Enthusiast

Anurag Pandey is a Database Architect with expertise in Oracle, PostgreSQL, SQL Server, Linux, and enterprise database platforms and specializes in database architecture, performance tuning, high availability, disaster recovery, cloud modernization, and operational excellence. With extensive experience in enterprise-scale environments, Anurag is passionate about leveraging AI, automation, and modern data platforms to improve reliability, scalability, and business outcomes. He actively contributes to technical communities through knowledge sharing, architecture guidance, and thought leadership in database and data engineering domains.

Follow more articles at

Visit Blog

Oracle Database Deep Health Check Checklist

Oracle Database Deep Health Check Checklist Recommended assessment levels Level Purpose Typical scope L1 Operational health Availability, sp...