iSelfSchooling.com - Since 1999  References  |  Job Openings
    Home  | Search more  | Oracle Syntax  | Computer Institute   | (Login or Register to access to VIDEOS)
 

Copyright & User Agreement

   Suggestions Email2aFriendHomepage us! |  Bookmark

Services

  Vision/Mission

  Services

  Biography

  Contact Us

 FREE Training

  Start...

  SQL

  PL/SQL

  Forms 

  Reports

  DBA Fundamentals

  Performance

  Prepare for OCP

  ShareUrNotes

...

  Acknowledgement

  Who is who

  University Directory

  Links...

 

 

 

FREE Online Oracle Training for beginners and advanced - The most comprehensive Oracle tutorial

The authors do not guarantee or take any responsibility for the accuracy, or completeness of the information.

BASICS

SQL | PL/SQL

DEVELOPERS

FORMS 2 | REPORTS | Other TOOLS

DBAs

FUNDAMENTALS 2 | PERFORMANCE | OEM

ADVANCE

APPLICATION SERVER | GRID CONTROL | ARTICLES 2 3 4

Advanced - Articles II

Lesson 01 | Lesson 02 | Lesson 03 | Lesson 04 | Lesson 05 | Lesson 06 | Lesson 07 | Lesson 08 | Lesson 09 | Lesson 10 | Lesson 11 | Lesson 12 | Lesson 13 | Lesson 14 | Lesson 15 | Lesson 16 | Lesson 17 | Lesson 18 | Lesson 19 | Lesson 20 | Lesson 21 | Lesson 22 | Lesson 23 | Lesson 24 | Lesson 25 | Lesson 26 | Lesson 27 | Lesson 28 | Lesson 29 | Lesson 30 | Lesson 31 | Lesson 32 | Lesson 33 | Lesson 34 | Lesson 35 |

Lesson 31

"As a tale, so is life; not how long it is, but how good it is, is what matters." 

-Seneca (4? B.C.-65 A.D.)

How to create database link?

As a DBA, you want to create Database links between two databases, databases “A” and database “B”:

 

Assuming that all the users of database “A” want to read only from Scott’s tables.

 

You need to do the following steps:

 

1-       Make sure to add a service name to each server.

For example: (Add this to the tnsnames.ora file of server “B.”

A =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = your-hostname)(PORT = your-port))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = A)

    )

  )

 

2-       Test your service name.

$tnsping A                 

--OR--              

MS-DOS>tnsping A

 

3-       Now, the DBA of database “B” should create a username that can have “READ ONLY” privilege to the Scott’s “EMP” tables.

 

CREATE USER users2read IDENTIFIED BY pass;

GRANT CREATE SESSION TO users2read;

GRANT SELECT ON scott.emp TO users2read;

 

4-       Login to SQLPLUS and create a database link at server “A” to access to users2read schema on the “B” database.

 

CREATE PUBLIC DATABASE LINK read_scott_emp

      CONNECT TO users2read IDENTIFIED BY pass USING ‘B’;

 

 

5-       Create a public synonym for Scott’s table.

 

CREATE PUBLIC SYNONYM emp FOR emp@read_scott_emp;

 

6-       Now, all the users on the database “A” can read only the Scott’s EMP table from the “B” database.

 

        SELECT * FROM emp;

 

 

 
 
Google
 
Web web site