query

Oracle DB Links | Query from another database table using DB Links



Sharing buttons:

the next topic that we have is Oracle

database links this is a very nice topic

because sometimes

let's take you have a production server

you have a test server from production

server you want to query only one table

inside the test server or from the test

server you want to query the data of one

table which resides on the quality

server or the QA server then what you

can do is you can create the database

links and with these database links you

can actually query the data from one

database to another database remember

there is a difference between database

links and Oracle client networking

earlier what we did is when we install

Oracle client Oracle client can connect

to our database server and query but in

database links what you can do is you

can make two databases query from each

other once again I repeat in Oracle

client you connect you install a client

software which is a lightweight in which

you connect to a remote server and query

this is where you are nothing but

directly connecting to the database

server and you are querying but with

database links what you can do is you

can enable one database to query from

another database now let us get inside

the database links sometimes we need to

query a remote database or pull data

from remote database it might happen

while creating DB link we need to know

username and password of the remote

database if you don't know the username

and password definitely you cannot

connect to the database

apart from username and password of the

remote DB we need to have TNS entry in

DNS names dot ora of local DB and TNS

ping command should work without the

networking between both the databases

the DB link will not work the simple

command that we have is create database

link you give the name for example in

our case we can put it as Prada be calm

next we can connect to the Scot user

identified by we need to give the

password of the Scot user that is Tiger

next we need to give using the TNS entry

in our case it will be prod dB now how

do you select or retrieve data from

remote database select star from Scot

dot EMP add the rate

prod DB com this way the data out of

Scot dot EMP will be given from the prod

DV database not from the local database

now remember guys this activity we

cannot have right now because we will

need two separate databases in order to

perform this activity I would request

you guys to create two databases on your

linux server

let's take you first create a Prada be

you then create a test DB then create a

database link between prod me intensity

be to work on database links this

activity I leave up to you guys to

practice on your test servers very

simple activity but once again I

reiterate there is a difference between

Oracle client and a server connectivity

and database to database connectivity DB

links help one database to query from

another database