Thursday, 27 June 2013

Create database link using host:port/service new syntax

when  we want to access data from different database that time we use database link through service name to access particular  data.so my this post is for to create database link without change in to tnsname.ora file that means without using service name.

Example:-
                 Targate Database: orcl
                 Source Database :  test

1)target database
    SQL>create user test
              identified by test
              default tablespace test;
  SQL>grant connect,resource to test;
        
  SQL> connect scott/tiger;

  SQL>  create table test(id number);

SQL>begin
                for i in 1..10 loop
        insert into test values(i);
       end loop;
      end;
/
SQL> commit;

SQL> select count(*) from test;

  COUNT(*)
----------
         10

SQL>

2)Source Database

SQL> CREATE DATABASE LINK test_db_link
    CONNECT TO scott IDENTIFIED BY tiger
   USING '192.168.128.135:1521/db11g';     ---(use ip address or host_name which you specified in listener file)

SQL>select *  from test@test_link;

COUNT(*)
----------
         10
                                       ********END*************

No comments:

Post a Comment

work on autovacuum postgreSQL parameter

 In This blog, we are discussing the auto vacuum parameter on a small scale. we will understand the below parameters and will see how to mod...