9 Jan 2014

Database Link Practical

DATABASE LINK PRACTICAL
STEP-1
      FIND  MACHINE NAME  &  DATABASE NAME
      OF  SECOND MACHINE (SERVER-2).
STEP-2
       CREATE A SERVICE ON FIRST MACHINE (SERVER-1)
       USING VALUES OF SECOND MACHINE (SERVER-2).
 STEP-3.
        CREATE DATABASE LINK  ON FIRST MACHINE (SERVER-1)
        USING ABOVE CREATED SERVICE.
 STEP-4.
          WRITE QUERIES USING DATABASE LINK TO RETRIEVE DATA
           FROM DATABASE ON SECOND MACHINE (SERVER-2)
          WHILE STAY CONNECTED TO FIRST MACHINE (SERVER-1)

  • Create One Network Service Using Net Manager Tool.
    • Press Start  Button
    • Select ProgramsàOracle-OraHome90àConfiguration And Migration Toolsà Net Manager
      •  Click On Naming Method Configuration And Press Next Button.
      • Expand The Node Of Local And Click On Profile Option.
      • > 
         
        In Available Methods If You Found TNSNAMES Then Select It And Press
            Button.

      • Press FileàSave Network Configuration.
    • Select ProgramsàOracle-OraHome90àConfiguration And Migration Toolsà Net Manager
      • Expand The Node Of Local, Then Again Expand The Node Of Service Naming.
      • Click On Any Created Service Name Then Press Create Button (+)
      • On Welcome Screen Write The Service Name On Net Service Name Option
Net Service Name: ABCL And Press Next Button.
      • Select TCP/IP(Internet Protocol) And Press Next Button.
      • Write Down The Host Name (Pc Name You Want to Connect) And Press Next Button.
        • Before Writing The Service Check The Oracle Sid On Computer You Want To Connect By Following Query
          • CONNECT SYS/ORACLE  AS SYSDBA
          • SELECT INSTANCE_NAME FROM V$INSTANCE;
      • Now Write Down The Name  Of Service on (Oracle 8i or later) Service Name :ORCL  And Press Next Button.
      • Press Test Button
      • If Message Appear Successful Then Press Close Button.
      • Press Finish Button To Continue.
    • You Can See The Service Name On Your Screen.
    • Press FileàSave Network Configuration.
    • Press Exit  Button.



 

  •  
o   Simple Database Link…

§  Connect System/Manager.

§  Create Database Link DB_LINK Connect To Scott Identified By Tiger
Using ‘ABCL’           à Service Name Created In Net Manager.

 


§  SELECT * FROM  SCOTT.EMP @ DB_LINK;


o   Public Database Link…

§  Connect System/Manager

§  Create Public Database Link PUBLIC_LINK Using ‘ABCL’;

§  SELECT * FROM SCOTT.EMP@PUBLIC_LINK

§  SELECT * FROM HR.EMPLOYEES@PUBLIC_LINK
  •  




No comments:

Post a Comment