Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Oracle Tools for Debugging Problems

DZone's Guide to

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.

· Database Zone
Free Resource

Download the Guide to Open Source Database Selection: MySQL vs. MariaDB and see how the side-by-side comparison of must-have features will ease the journey. Brought to you in partnership with MariaDB.

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.

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)

Checkout this Oracle article for more help.

Interested in reducing database costs by moving from Oracle Enterprise to open source subscription?  Read the total cost of ownership (TCO) analysis. Brought to you in partnership with MariaDB.

Topics:
oracle ,sql ,debug

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}