21 Ekim 2014 Salı

CREATE DATABASE LINK



There are two main ways which are easy to create database links between databases instances.

Format;

create database link [link_name] connect to [user_name] identified by [password]
using [database_connection_string / allias];


1-) If there is an description about database connection inside tnsnames.ora file about the database which will be connected, it is easy by just writing allias names of it in code.
For instance,

create database link test_hamdi to connect hamdi identified by "hamditest18"  using 'TESTDB';

In tnsnames.ora,connection string will be defined as written here;

TESTDB=
   (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=10.1.1.111)
      (PORT=1532)
    )
    (CONNECT_DATA=
      (SID=TEST)
    )



2-)If there is not any description about database connection string inside tns.names.ora file,it is also possible to write directly appropriate string inside linking sql code just like below;

create database link test_hamdi to connect hamdi identified by "hamditest18" using '(DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=10.1.1.111)
      (PORT=1532)
    )
    (CONNECT_DATA=
      (SID=TEST)
    )
  )'


It is assumed that strings above are connection information for TESTDB database.


WARNING: Be sure that you can ping to each databases from tellnet which database link will be created

Hiç yorum yok:

Yorum Gönder