Pat,
As you have probably discovered already, the Oracle
database and the Oracle
instance that manages a database can have
two entirely different names. The name you should specify in your tnsnames.ora entry (as you will see, below) should be the name of the Oracle
instance (or, on Windows, the
service name).
(In the code/results below, I have used "<...>" to represent values which contain entries specific to your environment.)
On Windows, to determine the appropriate (instance/service) name to specify in the tnsnames.ora file, you can navigate as follows:
Code:
Start -> Control Panel -> Administrative Tools -> Services -> (service that appears like...) "OracleService<[B][I]SomeName[/I][/B]>"
The <
SomeName> entry, above is called the Oracle
SID, which stands for
System
IDentifier, and it is the name of the
Oracle Instance that manages your Oracle database on your Windows machine. (Write down the
SID value to provide it in the tnsnames.ora entry, below.)
On *nix systems, there are multiple methods to identify the Oracle SID (Oracle Instance Name). Two methods to identify Oracle instances from an operating system prompt are::
Code:
<prompt> % ps -ef | grep pmon
oracle 15375 15351 0 10:42:16 pts/1 0:00 grep pmon
oracle 5206 1 0 Jun 13 ? 0:09 ora_pmon_<SID-1>
oracle 6621 1 0 Jun 13 ? 0:03 ora_pmon_<SID-2>
oracle 5895 1 0 Jun 13 ? 0:02 ora_pmon_<SID-3>
(above shows all [B][I]running[/I][/B] Oracle instances.)
(following shows all instances on the machine, [B][I]running or not[/I][/B].)
cat /etc/oratab
<SID-1>:<$ORACLE_HOME for SID-1>:<Whether or not to start instance on machine re-boot>
Once you identify your proper Oracle SID value, you can then proceed to the tnsnames.ora entries. I'm posting, below, both the format and a working example from my tnsnames.ora file.
Code:
(Format for tns entry in tnsnames.ora)
<TNS Alias that you make up> =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP address or name of machine where database instance resides>)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = <SID that manages target db> )
)
)
(Working example of tns entry)
MYDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = mufasa)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = testdb)
)
)
Let us know if this helps to resolve your question.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services:
www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”