Monday, July 5, 2010

How the TNSNAMES.ORA file is used

Here is to explain the behavior how tnsnames.ora and sqlnet.ora file work together. 


1. The default domain in the Sqlnet file is used for a default purpose only. 

CASE 1: 
in tnsnames.ora 
des6i.world = (....)  

in sqlnet.ora file 
names.default_domain = world 

So, in sqlplus log screen, the following can be typed in: scott/tiger@des6i 
Note the fully qualified des6iworld would not be typed in, because it  
will be automatically appended to the end of the connect string specified. 

CASE 2: 
in tnsnames.ora 
des6i.world = (....)  
CASE.NW.NOS.ORALCE.COM = (....) 

in sqlnet.ora file 
names.default_domain = world 

What would happen in the case where multiple domain have been defined in the  
tnsnames.ora but with only one sqlnet.ora?  Just remember, the key is what is  
defined in the TNSNAMES.ORA file, sqlnet.ora is for convenience.   
The entire connect string can be typed in. 

In sqlplus log screen, just type in :  
scott/tiger@des6i  <--- should again work 
scott/tiger@des6i.world  <--- should again work 
scott/tiger@CASE  <--- should *NOT* work, because in fact it will be CASE.world 
scott/tiger@CASE.NW.NOS.ORALCE.COM    <--- should work 

What is being said is that if the domain is added after the name when loginning 
as defined in the tnsnames.ora file, then don't use the default domain that is  
defined in the sqlnet.ora file. 

CASE 3: 
In fact a sqlnet.ora file is not really needed for the purposes of login 

E.g., in tnsnames.ora 
des6i  = (....)   <--- note here, no domain 
CASE.NW.NOS.BOEING.COM = (....) 

no sqlnet.ora file exists anywhere. 

In sqlplus log screen, just type in :  
scott/tiger@des6i  <--- should again work 
scott/tiger@CASE.NW.NOS.BOEING.COM    <--- should work 
scott/tiger@CASE   <--- should *NOT* work 
scott/tiger@des6i.world  <--- should *NOT* work 


Source : Oracle Metalink Note:201316.1


No comments:

Post a Comment