Skip to content

SmartTechWays – Innovative Solutions for Smart Businesses

SmartTechWays: Your Hub for Oracle, SQL Server, MySQL, DevOps & AWS Insights

  • Home
  • About Us
  • Contact
  • Oracle
  • MSSQLServer
  • MySQL
  • General & Social

Tag: check dba_db_links

Create and drop database link in Oracle

Database Link ( DBlink ) in Oracle

A Database Links is used to connect the one Oracle Database Server to other Database Server. It’s save in data dictionary. Through database link you can access the data of remote database. It is one way path to access information from other database in your database by network.

Database links created with public or private way:
Public: User called PUBLIC, all database users have access to remote database.
Private: user who created the links and access to remote database.

REMOTE_OS_AUTHENT parameter operates as follows:
TRUE: An external authenticated user can connect to remote database using a connected user database link.
FALSE: An external authenticated user can not connect to remote database until a network authentication service option is used.

Create Public DB Link

--Called Connected user , no username and password
CREATE PUBLIC DATABASE LINK dblink_salesdb USING 'salesdb';

--called fixed user, username & password is part of statement
CREATE PUBLIC DATABASE LINK dblink_salesdb CONNECT TO username IDENTIFIED BY password USING 'salesdb';

You need to check the connectivity of SALES1 through TNSPING command that its working fine before creating the database link.

tnsping salesdb

Create & Verified Private DB Link

CREATE DATABASE LINK dblink_salesdb CONNECT TO username IDENTIFIED BY password USING 'salesdb';
---Access data through DB Link
SELECT * FROM schema.object_name@connection;
--Example:
SELECT * FROM hr.emp@salesdb;

Check the database link present in database

SELECT * FROM DBA_DB_LINKS;

SELECT db_link, username, password, host, created FROM DBA_DB_LINKS;

Drop the Database Link

DROP DATABASE LINK link_name;

Drop public database link link_name;

Script for drop all database links present in Oracle

select 'Drop database link '||DB_LINK||' ;'  from dba_db_links where host like '%SKAS%';

Create DDL of database link in Oracle

select 'create database link ' || name ||' connect to '|| userid ||' identified by ' || password || ' using '||''''||host ||''''||';' from sys.link$;

SELECT db_link, username, password, host, created FROM user_db_links;

Determine which connection is open

COL DB_LINK FORMAT A25
COL OWNER_ID FORMAT 99999 HEADING "OWNID"
COL LOGGED_ON FORMAT A5 HEADING "LOGON"
COL HETEROGENEOUS FORMAT A5 HEADING "HETER"
COL PROTOCOL FORMAT A8
COL OPEN_CURSORS FORMAT 999 HEADING "OPN_CUR"
COL IN_TRANSACTION FORMAT A3 HEADING "TXN"
COL UPDATE_SENT FORMAT A6 HEADING "UPDATE"
COL COMMIT_POINT_STRENGTH FORMAT 99999 HEADING "C_P_S"
SELECT * FROM V$DBLINK

Check first and last login time for Database link

SELECT DB_NAME, HOST_NAME, FIRST_LOGON_TIME, LAST_LOGON_TIME
FROM DBA_DB_LINK_SOURCES;

Share this:

  • Click to share on X (Opens in new window) X
  • Click to email a link to a friend (Opens in new window) Email
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to print (Opens in new window) Print
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Nextdoor (Opens in new window) Nextdoor

Like this:

Like Loading...
Unknown's avatarAuthor SandeepSinghPosted on October 21, 2014December 17, 2025Categories OracleTags check dba_db_links, connection open, create public db link, drop all database link, first and last login, REMOTE_OS_AUTHENT, script for backup db linkLeave a comment on Create and drop database link in Oracle

7,737,640 hits

EMAIL: contactus@smarttechways.com

Installation of SQL Server 2022 Developer editionInstallation of SQL Server 2022 Developer editionMay 5, 2024SandeepSingh
Exclude/Include option in EXPDP and IMPDP DatapumpExclude/Include option in EXPDP and IMPDP DatapumpMarch 13, 2021
Check the Undo tablespace Usage in OracleFebruary 9, 2021SandeepSingh

Do Not Sell or Share My Personal Information

  • Home
  • About Us
  • Contact
  • Oracle
  • MSSQLServer
  • MySQL
  • General & Social
SmartTechWays – Innovative Solutions for Smart Businesses Powered by WordPress.com.
 

Loading Comments...
 

    %d