Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Oracle sid & service_name tips

Oracle Database Tips by Donald BurlesonDecember 5, 2015

Question: What is the difference between the SID and SERVICE_NAME in my tnsnames.ora file?  Why does Oracle have three parameters for the same thing, instance_name, service_name, db_name, and oracle_sid?

Answer: Part of the reason for this separation is in the evolution of Oracle, but we need to remember that Oracle specifies database locations in many files.  For TNS networking, the SERVICE_NAME and SERVICE_NAMES parameters were first introduced in Oracle 8i and supersede the older SID designation.

Difference between SID and SERVICE_NAME

Note the subtle difference between a SID and a SERVICE_NAME.  The SID is the same as the $ORACLE_SID environment variable in the sense that the SID is the system is for a unique instance on the server.
 
On the other hand, the SERVICE_NAME is used to register an instance with the listener.  In most all cases, Oracle recommends that the value of the service_name be the same as the SID.  However, a SERVICE_NAME  can point to more than one instance, and the DBA can gen-in additional SID's into a SERVICE_NAME .

Also see my TNS-12502 Tips.

MOSC Note 68632.1 verifies that the SERVICE_NAMES specifies one or more names for the database service to which this instance connects. You can also specify multiple service_name entries in order to distinguish among different uses of the same database.

Here is an example if two tnsnames.ora files, one using SID and the other using SERVICE_NAME:

london =
   (DESCRIPTION =
     (ADDRESS_LIST =
         (ADDRESS =
           (COMMUNITY = TCP)
           (PROTOCOL = TCP)
          (HOST = 123.45.6789)
           (PORT = 1521)
          )
      )
     (CONNECT_DATA =
        (SERVER=dedicated)
        (SERVICE_NAME = london)
    )
berlin =
   (DESCRIPTION =
     (ADDRESS_LIST =
         (ADDRESS =
           (COMMUNITY = TCP)
           (PROTOCOL = TCP)
          (HOST = hun)
           (PORT = 1521)
          )
      )
     (CONNECT_DATA = (SID = kraus))
    )

 


db_name - This is created when you issue your "create database" statement and it can be seen in the v$database view.

SQL> CREATE DATABASE mysid DATAFILE SIZE 400M
2>   DEFAULT TEMPORARY TABLESPACE temp_ts
3>   TEMPFILE SIZE 10M
4>   UNDO TABLESPACE undo_ts DATAFILE SIZE 10M;

select
   name,
   value
from
   v$parameter
where
   name = 'db_name';

NAME VALUE
------- ----------------------------------------------
db_name mysid

instance_name - In the init.ora file

init.ora
INSTANCE_NAME=mysid

select
   instance_number,
   instance_name,
   host_name
from
   v$instance

INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME
--------------- ---------------- ----------------------1               mysid            MYSERVER

service_name - The service_name is in the tnsnames.ora file to allow you to register an instance with the listener:

mysid=
  (DESCRIPTION =
    (ADDRESS =
      (PROTOCOL = TCP)
      (HOST = myserver)
      (PORT = 1521))
   )
   (CONNECT_DATA =
      (SERVICE_NAME = mysid)
   )
)

 

sid_name - We find the sid_name values listed in the listener.ora file:

SID_LIST_LISTENER =
   (SID_LIST =
      (SID_DESC =
      (SID_NAME = mysid)
      (ORACLE_HOME = /u01/app/oracle)
       )
      (SID_DESC =
      (GLOBAL_DBNAME = remote.dba.net)
      (ORACLE_HOME =/u01/app/oracle/product/10.1.2)
      (SID_NAME = mysid)
       )
   )
)

 
 

global_name - If you are using global_names (global_names = TRUE), the global_name is the combination of the db_name and db_domain:

select *
from
   global_name;

GLOBAL_NAME
---------------------------------------
MYSID.REMOTE.DBA.NET

 

For a complete description of these values, see Steve Karam's book "Easy Oracle Jumpstart":


 
 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational