We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

how to create database link in oracle using static ip

anup1109
anup1109 asked
on
Medium Priority
3,957 Views
Last Modified: 2013-12-19
hi
how to create database link in oracle using static ip

ap
Comment
Watch Question

Sean StuberDatabase Developer & Administrator
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2012

Commented:
do you know the port and service/sid name?

if so, add a definition to your database SERVER's tnsnames.ora like this...


YOUR_DB_NAME.world =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = your.ip.address.here)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = your_service_name)
    )
  )

then create a database link inside the database like...

create database link "your_db_link"
connect to your_user
identified by "your_password"
using 'your_db_name'
Database Developer & Administrator
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2012
Commented:
you can also put the entire tns entry in the link itself


create database link your_db_link
connect to your_user
identified by your_password
using '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=your.ip.address.here)(PORT = 1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=your_service_name)))'

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Anup, DB links and IPs have an intermediate layer in between: TNS
So your question ends up being two-part:
  • How do I build up a TNS address using a static IP?
  • How do I use it to create a DB link?
For the first question, you just use your static IP where you would put the host name.
For the second, you create a DB link referencing the TNS alias, or else specify the TNS connection string in place. Both things are done through the keyword USING (sdstuber's 1st and 2nd examples respectively).
Note that you can omit the CONNECT TO ... IDENTIFIED BY ... portion. In that case, remote connections will be attempted with the same credentials you used to connect to your local DB.
Again, it's NOT that DB links have static IPs... it's TNS connection strings that have them :-)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.