Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Doug.

Asked: October 30, 2001 - 10:55 am UTC

Last updated: July 13, 2004 - 12:02 am UTC

Version: 8.1.7

Viewed 1000+ times

You Asked

What is the overhead in using a DNS name (ie abc.oracle.com) vs 123.123.123.123 in Net8? Is this resolved at the session level, packet level, or ???

Thanks for your help.

and Tom said...

It is resolved by the OS and the OS does the caching, we resolve it via OS calls each time we need to dereference it.

IMO -- the overhead is neglible on a properly configured system and you should always use the hostname.

Rating

  (10 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Guys, there is a big confusion here.

Andre Whittick Nasser, October 30, 2001 - 1:06 pm UTC

I did not understand if you are referring to hostname vs IP address or DNS vs IP address.

DNS
===

Typically, when you use adresses with domains like server.acme.com.br you will use DNS mechanisms external to your system, probably involving naming resolution in servers located in other regions, possibly other countries, which, logically, will take some time.

Your machine is configured to "point" to a top-level server that will begin DNS name resolution.

When your machine encounters something like server.acme.com.br, what it will do is the following in a hierarquical manner:

1) Find a level 1 DNS server that maps the country domains like server.acme.com.br (br stands for Brazil).
2) The top, level 1 server will redirect the request to the Brazil's server that will identify .com as a a domain for commercial organizations.
3) Next, another server will locate Acme company in the .com domain.
4) At last, inside Acme, the machine named "server" will be found.

Note that US DNS addresses do have the country suffix, like ".br". They usually simply end in .com, .org, .edu, etc


hostnaming
==========

On the other hand, if you are simply mentioning the hostname, that is an alias that you place in a file called HOSTS (/etc/hosts in UNIX) where you say IP address www.xxx.yyy.zzz is frinedly know as, say, "server". This, as Tom said, is immediate.

Instead of issuing: ping www.xxx.yyy.zzz
you just do: ping server



Tom Kyte
October 30, 2001 - 1:32 pm UTC

I personally did not find it confusing. Their terminology might not have been 100%.

The gist of the question was:

should I have tnsnames.ora entries like this:


appsweb4 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = appsweb4.us.oracle.com)(PORT=1521))
(CONNECT_DATA = (SID = apps4))
)

or like this:


appsweb4 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.2.3.4)(PORT=1521))
(CONNECT_DATA = (SID = apps4))
)

The first has to be resolved via DNS (which is what they must be using, not many people use "files" anymore) and the other does not. my answer -- use the hostname, not the ip address in the config files. You'll be hurting later on when the ip address changes if you don't.

The DNS lookup, as it is cached locally, is pretty darn fast and should not scare anyone away. don't use ip's, use hostnames.


re: Guys, there is a big confusion here.

A reader, October 30, 2001 - 1:46 pm UTC

> I did not understand...

So? Is this askandre.oracle.com?

Addresses

Andre Whittick Nasser, October 30, 2001 - 2:00 pm UTC

Yes, if you are talking about pure Net8 configuration, you are correct.

NEVER HARDCODE YOUR IP ADDRESSES !!!

It implies reconfiguring every tnsnames.ora file. Whereas using alias, either via DNS or through any other centralized naming method, there will be only one place to change.

As to the caching stuff, if you are accessing always the same database, the IP address will be in cache, all right.

But if you think of conventional, all-around internet navigation, on the average, DNS *WILL* incurr additional overhead.

Hostname vs. IP address

Lin, October 30, 2001 - 2:21 pm UTC

Tom,

My first time here. Glad to find a wealth of info you provided. Thanks for your great service to Oracle users.

Now get back to the topic. We use 8.1.7 on Windows 2000. We have two servers and configured tnsnames to access the other database from each machine. Recently, the network admin changed the IP addresses on these servers (hostnames remained the same). When I tried to connect the 'remote' database using the old tnsnames.ora file, I got a time out error (ORA-12535). Then I created a new service name in Net8 using the new IP address instead of hostname, it worked. It seemed that the hostname did not resolve to the new IP address. This is in contrast of your follow up comment, that is, use hostname, not IP address when connecting. Any advice on this issue? Thanks.

Tom Kyte
October 30, 2001 - 2:33 pm UTC

In all probability you were not using DNS to resolve that name OR your DNS was messed up.

Windows/2000 has a hosts file as well -- maybe you had an entry there with the old ip address.

Next time, try pinging the hostname from windows -- if you cannot ping it, something is wrong in your network configuration and needs to be fixed.

Hostname vs. IP address

Lin, October 30, 2001 - 2:29 pm UTC

Tom,

My first time here. Glad to find a wealth of info you provided. Thanks for your great service to Oracle users.

Now get back to the topic. We use 8.1.7 on Windows 2000. We have two servers and configured tnsnames to access the other database from each machine. Recently, the network admin changed the IP addresses on these servers (hostnames remained the same). When I tried to connect the 'remote' database using the old tnsnames.ora file, I got a time out error (ORA-12535). Then I created a new service name in Net8 using the new IP address instead of hostname, it worked. It seemed that the hostname did not resolve to the new IP address. This is in contrast of your follow up comment, that is, use hostname, not IP address when connecting. Any advice on this issue? Thanks.

if the host name or ip changes then where to look

A reader, September 03, 2002 - 11:27 am UTC

Tom,

System:
(8.1.7.3.0 running on Windows 2000 advanced server running Oracle Enterprise Edition)
There has been a talk in our company to change IP address/computer names
of machines.
Some of our database servers are using machine names, some are using static IP addresses.
1.I am looking for some document (a step by step one) to know what to do when IP address/Machine name changes on a machine that has Oracle running on it.
2.I was talking to our Network Administrator and he recommended using IP's (172.16.2.223) instead of machine name (555g121b) because IP's are static.
Your thoughts on this?

TIA

Tom Kyte
September 03, 2002 - 11:32 am UTC

1) there should be nothing that needs to be done.

Only if you hard coded IP addresses into configuration files (they would be the tnsnames.ora and listener.ora files) would you have to do anything.

Changing the machine name -- that should be OK as long as the HOSTNAME doesn't change. If you change the HOSTNAME (the dns name) -- you would have to edit all of the tnsnames.ora and listener.ora files and fix them up.

2) you need a new network administrator -- that is my thought. Anyone who calls themselves a network admin and says "use IP addresses, not hostnames" needs to go back to class -- they missed the first day apparently.

That would be the dumbest thing you could do. So, you go put 172.16.2.223 into all of the configuration files all over the place (all of the clients tnsnames.ora, your listener.ora). Great. Next week they tell you the data center is moving and taking your machine with it. Your new IP address is 12.136.32.23. Now what? Time to go hunt down all of those files and fix them. OR -- you could have put 555g121b into the config files -- updated DNS and wah-lah. You are back in business and didn't have to do a single thing.


Just read the answer to this original question -- you see my thoughts on this subject.

Why use tnsnames?

Dave, September 03, 2002 - 1:25 pm UTC

As a side issue, if folks think it is a pain to have to go round redistributing a new tnsnames.ora file or editing the old one, why are they using them? They should be considering using Oracle Names/LDAP instead. Add a new instance/delete an instance/modify a hostname, no problem. Using tnsnames is like some kind of job-creation scheme for admins.

Tom Kyte
September 03, 2002 - 3:13 pm UTC

Agreed, we use LDAP and Oracle nameserver internally ourselves.

services.ora and snmp_ro.ora

A reader, September 03, 2002 - 4:51 pm UTC

Tom,
System:
(8.1.7.3.0 running on Windows 2000 advanced server running Oracle Enterprise Edition)

Here we use static IP's but we keep changing machine name..
So, that's why the admin suggested to use IP.
Anyway...the machine name is about to change...and I was searching for the machine name in Oracle directory to see where I need to make a change...
Besides the two that you mention..there are couple more:
services.ora and snmp_ro.ora

services has entries like:
555g121b = (ORACLE_NODE, 555g121b, 555g121b, (PLATFORM=(osName=Windows NT)(osVersion=5.0)))


listener_555g121b = (ORACLE_LISTENER, 555g121b, (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.2.223)(PORT = 1521))))


corp = (ORACLE_DATABASE, 555g121b, (DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.2.223)(PORT = 1521)))(CONNECT_DATA=(SID=prod)(SERVER=DEDICATED))), listener_555g121b)


555g121b:80 = (oracle_sysman_webserver, 555g121b, </code> http://555g121b:80/server-status, <code>Apache/1.3.12.0.1a, E:\oracle\Apache\Apache\conf\httpd.conf, E:\oracle\Apache\Apache)

As you can see..it is a mix of both machine name as well as
IP.

snmp_ro.ora has entries like:

snmp.visibleservices = (listener, prod)
snmp.shortname.listener = LISTENER
snmp.longname.listener = listener_555g121b
snmp.configfile.listener = E:\oracle\network\admin\listener.ora
snmp.oraclehome.listener = E:\oracle
snmp.servicename.listener_555g121b = OracleOraHome81TNSListener
snmp.SID.prod = prod
snmp.oraclehome.prod = e:\oracle
snmp.address.prod = (ADDRESS=(PROTOCOL=BEQ)(PROGRAM=ORACLE)(ARGV0=ORACLEprod)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))
snmp.remoteaddress.prod = (DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.2.223)(PORT = 1521)))(CONNECT_DATA=(SID=prod)(SERVER=DEDICATED)))
ifile = E:\oracle\network\admin\snmp_rw.ora
ifile = E:\oracle\network\admin\sqlnet.ora


Question:
1.services.ora and snmp_ro.ora....do i need to change the machine name to the new machine name in all the entries..
Aren't these two files recreated when the instance starts..
Well..Services.ora..when services starts...and snmp_ro.ora
when listner starts.

2.O.K...O.K.... I will read up on Oracle Names/LDAP.


TIA






Tom Kyte
September 03, 2002 - 6:50 pm UTC

or, just stop using DNS and make up your own hostname... never heard of people constantly changing HOSTNAMES on you -- ip addresses, yes, hostnames -- no. I'd put my foot down after a bit.

clarify..

A reader, September 03, 2002 - 7:53 pm UTC

So, I guess I was right about my (1) question that services.ora and snmp_ro.ora will recreate themselves?

"or, just stop using DNS and make up your own hostname"
How do you do this?


Tom Kyte
September 03, 2002 - 8:19 pm UTC

Those are oem and snmp files and to be honest -- I've never used them. No ideas but I would guess that they would not recreate themselves.

Plus you have the iAS stuff -- not just the database. No ideas down there.

changing a hostname is *just a really bad idea*. They have it sdrawkcab where you work.


To do it yourself hostnames -- /etc/hosts on Unix (c:\winnt\system32\drivers\etc\hosts or something like that in windows)

hostnames with different port number

Naveen C, July 12, 2004 - 9:30 pm UTC

Hi.
My DB is running with a listener on port 1530..
now how do i do it with hostnaming.. ? in the etc/hosts file how the entry will be..?

when i give the ip-host-alias it goes to the default port and returns me an error.. beucs there is no listener on that port..

Thanks

Tom Kyte
July 13, 2004 - 12:02 am UTC

you won't be -- hostnaming says "things will be assumed - such as the port and the sid".

you've changed the assumptions. hence you cannot use the "simple, no configuration hostnameing" configuration.