Java Hibernate Oracle sessions never get closed - oracle

I'm opening some Oracle sessions from a java-hibernate app. When I shutdown my java-hibernate application, the oracle sessions remain opened, even if the java process is not seen as running with ps -fea | grep java.
The problem is that this oracle sessions never die, they remain there and the only way to kill them is either manually kill oracle process, restart the oracle instance or restart the unix box where oracle resides.
My java/hibernate app always closes the session with a final statement in the source code, no matter what.
Thanks in advance.

Is difficult to help you without more information, but I thing I can guess. When you open or close sessions using hibernate you probably dont open real oracle sessions. Hibernate may use a pool or control when open or not a real session. So, your problem is not close your java session after each statement but to correctly close and finish hibernate's pool or whatever before kill your app.
Please post more information so i dont have to guess :)

Related

How kill running procedure in cx_oracle?

I have very long time executable proc, and need close it. What is the best way to do this?? Using Oracle 19, cx_oracle 7.2.2. Connection started in SessionPool.
Found several ways, throw ^C forcibly and try
ALTER SYSTEM CANCEL SQL 'SID, SERIAL[, #INST_ID][, SQL_ID]';
Depending on what you want to achieve, you have either the cancel sql statement you pointed to, or the alter system kill session method. The first one will just cancel the current sql (if you specify the sql_id), and then the session continues (depending on how you handle errors in your code). The second method will kill your session, and your program will need to recapture a connection from the pool and try again.
Another comment, you better upgrade your cx_oracle to the newest oracledb provider. 7.2 is fairly old.

How to stop task in oracle sql developer

I ran a script in Oracle sql developer last night which is a quite simple command:
'update TABLE set column A=...'
The table is a large one maybe about 70GB.
The task kept running for the whole night and still running....
Could I just click on the stop button on the window? I'm afraid of locking the session or the rolling back procedure will take longer time.
So what will happen to the database after we click stop? Or is there a more efficient way to kill task...
I would recommend not to stop it from SQL Developer instead you can get the session id from V$SESSION of this connection and kill it
alter system kill session 'sid,serial#';

iseries datasource lock timeout

we're having an issue with lock timeouts connecting from a was 6 server to an iseries v6r1 db.
We have the default table and record lock wait times on the relevant tables, however these seem to be overridden by the transaction (http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/rzakj/rzakjrecords.htm) suggests this is what's happening.
We're using the XA toolbox driver (com.ibm.as400.access.AS400JDBCXADataSource); does anyone know where we can configure the default lock wait time on this driver? I can't find any documentation anywhere.
Thanks in advance.
If you are having problems finding answers trying posting your message to WEB400 at midrange.com. There are several people who use WebSphere App Server on there.

Oracle ALTER DATABASE OPEN

Im having some trouble with an oracle database. Every time i try to connect, i get this message.
ORA-01033: ORACLE initialization or
shutdown in progress
I searched the web, and found that the solution is to execute an alter database open command, but what I dont understand is where should i execute if, since I cant connect to the database.
Am I missing something?
Thanks in advance
You should connect AS SYSDBA:
sqlplus "sys/pwd AS SYSDBA"
An ORA-01033 would also be thrown if the connection attempt were made against a mounted standby database (Oracle Data Guard environment) by a non-sysdba user. Maybe a database role change (switchover or failover) has occurred since your last connection attempt.
Which OS are you using? The database is still shutting down - check the alert log as to the status of where it is at. Sometimes there are sessions hanging around that need to manually be killed off, there should be an indication of this in the alert log. It also depends how the database was shutdown, NORMAL, TRANSACTIONAL, IMMEDIATE. Even with a SHUTDOWN IMMEDIATE the sessions hanging around may still happen. To find the sessions on UNIX use the 'ps' to list all processes on the server ('ps -eaf' on Solaris) command and 'grep' for the ORACLE_SID name.

How to troubleshoot Oracle database server errors?

My team inherited an Oracle-based web application and they are fairly inexperienced with Oracle database servers.
The Oracle 10g server is running on a Windows 2003 Server with plenty of disk space and from time to time, all connectivity is lost, the application stops working, not even SQL Plus is able to connect to the database server.
But when we check the Windows Service manager, it says that the service is up and running. A restart usually fixes the problem, but we need to properly troubleshoot it so we know what's causing it and so we can avoid it to happen anymore.
Where should we start looking for clues? What are the criticial log files we should be investigating?
On the server you should have an environment variable called ORACLE_HOME which indicate the root of the Oracle install. Most likely the Oracle trace/dump folders will be under there. Search for a folder called "bdump" (background dump). That's where the main log file, knows as the alert log, will be, as well as trace files generated by background processes. There will be an adjacent file called "udump" which will contain any trace files generated by user processes.
However, my real advice is that you should either hire someone who knows Oracle or get Oracle Support involved.
The alert log would be the first file to check.
It will probably be in $ORACLE_HOME/admin/bdump and (probably) called alert_DATABASE-SID.log
It contains most of the important actions that the database does, as well as any important errors that occur.
I have to agree with cagcowboy. Check your alert logs for errors. If no errors then maintain a sysdba login into the database and when it hangs, attempt to do a hang analysis. See metalink note 215858.1 on hanganalyze.
Have you tried tnsping? We've occasionally run into problems with the listener that requires an assist from our DBA. tnsping is the diagnostic tool we use to do triage.
I would recommend hiring an experienced Oracle DBA if at all possible.
check the alert log to see how the Db is structured. sometimes badly set parameters make hangs or slow performance. or you can shutdown and start in mount mode, then check the v$parameter values for problems. setting total memory is very important.

Resources