To generate a database link between two different servers/database then
Query:-
CREATE
DATABASE LINK DB_Test
CONNECT TO HR
IDENTIFIED BY O123------à(Here
UserName=” HR” and Password=” O123”)
USING
'(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=192.168.0.01
) -------------------------------à(Need to pass the IP address of the server)
(PORT=1521))-----------------------------------------à(Port Number of the
database)
(CONNECT_DATA=
(SID=Employees)))';----------------------------------à (SID of the database)
O/P:- database
link DB_Test created.
Hint:- The
whole connection-related information you will get from the TNS file.
With the help
of this query database link will be created between two different databases, Now
example to access the table through database link
Query:- select * from Salary@ DB_Test;
O/P:- This query
will display the data of the Salary table with the help of a database link.
No comments:
Post a Comment