Oracle Tools for Debugging Problems
There's a lot of command line tools that come with Oracle (even the local XE version) that can help you check your connection and debug connection issues. Read on to learn more.
Join the DZone community and get the full member experience.
Join For FreeThere's a lot of command line tools that come with Oracle (even the local XE version) that can help you check your connection and debug connection issues.
You should try to connect with sqlplus and with SQL Developer first. After that, if you are running a Java program make sure it has permissions, in Windows perhaps Admin privileges, and make sure if you are on an IPv4 stack that you have disabled IPv6. Unless, of course, you are using IPv6 in your local network.
-Djava.net.preferIPv4Stack=true
To Check if Oracle is working, first check the Oracle Services:
C:\oraclexe\app\oracle\product\11.2.0\server\bin>LSNRCTL.EXE
LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: TSPANN-LAPTOP, pid: 3868>
(ADDRESS=(PROTOCOL=tcp)(HOST=tspann-laptop)(PORT=1040))
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:1149 refused:0 state:ready
LOCAL SERVER
The command completed successfully
LSNRCTL> quit
That will give you a list of instances that you can then check to see if something is actually running there. TNSPing will then let you check to see if the service or database listed is running and listening.
C:\oraclexe\app\oracle\product\11.2.0\server\bin>tnsping xe
TNS Ping Utility for 64-bit Windows: Version 11.2.0.2.0 - Production on 31-DEC-2015 10:58:30
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
C:\oraclexe\app\oracle\product\11.2.0\server\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = tspann-laptop)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVI
OK (20 msec)
Opinions expressed by DZone contributors are their own.
Comments