Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how should i connect to db name different in global_name

Status
Not open for further replies.

newssis

MIS
Dec 18, 2008
13
US
Hi all,

I am confuse totally now.

I the system which was prebuild and now i have to support and get data.

I have DB instance name testep1 and

when is do select * from globalname it gives me testet1..


then i tried querying select * from v$database it gives me testep1

and then again when i did.. select ora_database_name from dual it gives me testet1..

So what do i need to put in my tnsnames.ora..

The SID is testep1.. and i confirm that on the system and in configuration as well.

Please guide me!!

Thanks
Pat
 

You can put the SID (or any alias) in tnsnames.ora:

Code:
testep1 = 
(description=
   (address=(protocol=tcp)(host=yourHost)(port=1521))
   (connect_data=(sid=testep1))
)
PS: Check your listener.ora file and the local sqlnet.ora
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
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]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.”
 
...Sorry...it took me from before LK posted to compose my post. I didn't intend to cross-post with another fully appropriate post.

[santa]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.”
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top