by simon baird

Friday, August 03, 2007

Oracle create database link example

The syntax for the create database link command is pretty much impossible to figure out. I always get it wrong. Even when I read the docs carefully. So here's my version of the example.
CREATE DATABASE LINK
    name_of_link
  CONNECT TO
    oracle_username
  IDENTIFIED BY
    password -- no quotes here
  USING
    'database_sid' -- single quotes here
/
-- test
select * from dual@name_of_link
/

6 comments:

sw4bennelong said...

thankyou - helped me!

Anonymous said...

me too, thank you! :)

KayVee said...

Simplified & Effective!
Thanks a ton...

Anonymous said...

thanks. was helpful.

Stephen Wood said...

USING 'database_sid'

Should read

USING 'TNS alias in local tnsnames.ora'

Just putting in the SID of a remote DB in there without a TNS entry won't work.

Anonymous said...

Many thanks from an Oracle novice now I have the power to sql across databases!