Database Links in Oracle

A database link is a schema object in one database that enables you to access objects on another database.

SQL> desc dba_db_links
 Nombre                                                                                     ¨Nulo?   Tipo
 —————————————————————————————— ——– ————————————————————-
 OWNER                                                                                      NOT NULL VARCHAR2(30)
 DB_LINK                                                                                    NOT NULL VARCHAR2(128)
 USERNAME                                                                                            VARCHAR2(30)
 HOST                                                                                                VARCHAR2(2000)
 CREATED                                                                                    NOT NULL DATE

Use the below query to find the db links available for a database:


set lines 152
col owner for a15
col db_link for a30
col username for a15
col host for a30

select owner,db_link,username,host,CREATED
from dba_db_links;

spool db_link_test.sql

select ‘select count(*) from tab@’||db_link||’;’
from dba_db_links;

spool off

spool db_link_output.log

@db_link_test.sql

spool off

=================


How to Test if a DB link is working fine?

select ‘ connect ‘||owner||’/’||owner||’1’||chr(10)||
‘select count(*) from tab@’||db_link||’;’
from dba_db_links;

select distinct owner
from dba_db_links;

5 thoughts on “Database Links in Oracle”

  1. Appreciating the hard work you put into your
    website and detailed information you present. It’s awesome to come across a
    blog every once in a while that isn’t the same unwanted rehashed information.
    Great read! I’ve bookmarked your site and I’m adding your RSS feeds to
    my Google account.

    My blog post :: nordvpn coupons inspiresensation; https://t.co,

  2. 350fairfax nordvpn cashback
    I do not know if it’s just me or if perhaps everybody else encountering issues with your blog.
    It seems like some of the written text within your posts
    are running off the screen. Can someone else please comment and let me know if this is happening to them too?
    This may be a problem with my web browser
    because I’ve had this happen previously. Kudos

Leave a Reply

Your email address will not be published. Required fields are marked *