I am using openrowset in ETL for insert data to temp table. But I got some of error in SSIS (don´t have log to debug the issue) and package is failed but session/transaction and oledb is still "open". In sys.sysprocesses is status still runnable, lastwaittype is OLEDB and when I tried to kill this session nothing happend. Last possibility is propably restart the sql server.
And the question is if I can somehow prevent the server restart? Some king of timeout for openrowset or is there any other possibility how to kill the session?
Thank you
Martin
Related
We have an application on IBM WebSphere Application Server 7.x and it connects to a remote database on z/os DB2 10.x. For annual operation, DB2 shut down and restarted. After starting the database, we first get
com.ibm.websphere.ce.cm.StaleConnectionException
and then we get
The database manager is not able to accept new requests, has terminated all requests in progress, or has terminated this particular request due to unexpected error conditions detected at the target system. ERRORCODE=-4499, SQLSTATE=58009
The connection between WebSphere and DB2 tested by 'test Connection' in WAS datasource. Both systems are up and running but there is no correct connection between them! There was no change in DB2, WAS, and JDBC driver.
Update: The JDBC driver version is 4.15.134, connection properties is IBM WebSphere default setting and the connection is direct to DB2. Another problem later showed that while the connection still has the problem, executing the query directly on z/OS's DB2 gets the same the error. The query consist of a select with a join on two different tables, selecting on each table is ok, but the final query does not work and gets ERRORCODE=-4499, SQLSTATE=58009.
Update 2
The detail of environment is: IBM WebSphere Application Server 7.0.0.45, DB2 10.1, Java version 1.6 SR16 and z/OS 1.13.
This specific query gets the error in all environments, on all application server, z/os SPUFI, database viewer, such as DBeaver.
Any help is greatly appreciated.
Finally, we found the solution, ran REORG and RUNSTATS on both tables and on all their partitions, and the error vanished both on the application and SPUFI. I guess something went wrong during restart and tables corrupted. Now everything is ok.
If I got you correctly, you complain on inability of the driver to reestablish the database connections after the DB2 for Z/OS restart.
If yes, then have you tried to set the corresponding connection properties described at the following link?
Configuration of Sysplex workload balancing and automatic client reroute for Java clients
Assuming I started execution of an inefficient and long-running query in an IBM DB2 database using the CLP. Maybe there are some terrible joins in there that take a lot of processing time in the database. Maybe I don't have the much needed index yet.
# db2 +c -m
db2 => connect to mydb
db2 => select * from view_with_inefficient_long_running_query
//// CLP waiting for database response
How do I cancel the processing of this statement/query without killing DB2 CLP? I can do so by killing it, that is, by pressing Ctrl-C:
db2 => select * from view_with_inefficient_long_running_query
^C
SQL0952N Processing was cancelled due to an interrupt. SQLSTATE=57014
# db2 +c -m
db2 =>
But is there another more elegant way? Perhaps another Ctrl- shortcut? I already saw this question, but it doesn't talk about what I want.
AFAIK, there is not CTRL- to terminate CLP. Your option is to open another terminal session and use the LIST/FORCE applications, CTRL-Z the CLP to suspend it and use another CLP to LIST/FORCE or use a GUI tool like Data Server Manager to find the application and force it to terminate.
db2 list applications for <database>
get the application handle for the session(s) you want to terminate.
db2 force application ( application-handle )
see LIST APPLICATIONS and FORCE APPLICATION.
Would you rather use a QueryTimeout configuration as in https://www.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.apdv.cli.doc/doc/r0008809.html
This way your command would stop and report SQLSTATE 57013
-913 UNSUCCESSFUL EXECUTION CAUSED BY DEADLOCK OR TIMEOUT.
Rather than use CLP directly, why not go directly from the UNIX prompt?
db2 "select * from view_with_inefficient_long_running_query"
You can hit Ctrl-C to cancel your query. The connection to the database is maintained by the DB2 Backend Process (db2bp), and you get all of the benefits of working in a UNIX shell – superior history, command pipelines, etc.
I have my Oracle server installed in a remote machine and I want a script at my local machine which will check whether Oracle server is up and running or not. I know this can be check by creating a connection through sqlplus or JDBC. But in this case oracle client won't be present and I am saving JDBC approach as my last option. So is there any other simpler way to check this, which can be easily implemented in a shell script???
Thanks
Not really. The only way to be certain that the database is responding to queries is to run a query on it, such as the venerable:
select dummy from dual
Assuming that no statements to close the connection are made before my script ends and no exception is encountered before closing the connection, does the database's connection stay open?
I'm connecting to the database programmatically via Python Psycopg2 and via Java JDBC4 driver.
Not entirely sure what you want exactly, but let's try:
You can see the connections that exist at any time with PGAdmin or this SQL command
SELECT * FROM pg_stat_activity;
It should be fairly simple to spot when - for your specific use case - the connection closes.
If an SQL query is running at the time you close a connection, I think it will run to completion, ie the backend serving it will remain alive, even if the connection is closed from the client side.
What can be done to prevent having to restart a PC after a program (C++Builder) terminated abnormaly without closing the database using firebird 2?
What I am looking for: I would like to be able to just restart the program without any other intervention. (I could have the user call a batch file executing some cleanup or add some lines of code to the program to disconnect everything.)
If your database is firebird 2.1+, there are monitoring tables that show the active connections, and the sysdba can manually delete any left-over connnections.
If you look in your release notes, the syntax details should be there.