In Windows
1. Select name from v$database;
It can be viewed directly by running the
2. Check the Tnsnames.ora connection, there is a sid,sid is the service name
1. View the installation directory for Oracle,
method is to view the registry:
such as: Hkey_local_machine\software\oracle\oracle_home REG_SZ E:\ORACLE\ORA92
Get the installation directory for Oracle
In general, if the server is installed with a default value then this value is: D:\ORACLE\ORA92
2. Locate the Tnsnames.ora file
Locate the \network\admin\tnsnames.ora file below the root directory and open
3. Take a closer look at the Tnsnames.ora configuration inside
For example
# TNSNames. ORA Network Configuration File:d:\oracle\ora92\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
wzz=
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = wzz) (PORT = 1521))
)
(Connect_data =
(SERVER = dedicated)
(service_name = wzz)
)
)
The service_name is the service name, such as the above file, the service name is Wzz
C # Gets the Oracle server name:
#region Read the value of the installation home directory from the registry
///<summary>
///Read the value of the installation home directory from the registry
///</summary>
///<param name= "Setupkey" ></param>
///<returns></returns>
PublicStaticString Readhomedirectory (String setupkey)
{
RegistryKey ReadKey;
Try
{
ReadKey = Registry.LocalMachine.OpenSubKey
("Software\\oracle",FALSE);
foreach (String nameIn Readkey.getvaluenames ())
{
if (name = = Setupkey)
{
return Readkey.getvalue (name). ToString ();
}
}
return null;
}
catch
{
return null;
}
}
#endregion
Under Linux system
1.
SYS@SZTYORA> Show Parameter Servic
2.CD $ORACLE _base/admin Look at a couple of them.
View the name of the Oracle database server