Thursday, 18 December 2014

Database LINK creation in ORACLE

To create a Database Link between two servers (server1 accessing server2) :
1. First create a user in server2 with necessary Grants(specify according to the operation to be performed on server2)
2. Then open the server1, create a entry(give any name ex:ENTRYNAME) for server2 in tnsnames.ora( with server2
     Ipaddress,SID etc;)
3. Test tnsping for server2 with the entry name given in tnsnames.ora
4. Once test worked, then connect to server1 and give the following command to create public link between the servers
     create public database link EXAMPLE.COM connect to USERNAME identified by <password> using 'ENTRYNAME'(last 
     one,entry name should be in quotes)
5. Now the connection established. Test the access through any sql query in server1
    ex: select count(*) from USERNAME.TABLENAME@EXAMPLE.COM (Here the table located in server2)
    result : gives the count of server2 table

No comments:

Post a Comment