Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Very long SQL connection opening time

Tags:

oracle

Recently, We have migrated our Oracle 9.2.0.6 production database from Windows 32bit RAC (2 nodes) to Linux 64 bit environment. Linux 64 bit environment has 8 times more memory than Windows 32 bit environment and Linux 64 bit has faster disk ( RAID 10 compare to RAID 5 of windows).

However, after this migration, we have noticed sql connection time has been increased significantly. Some time, it is taking 16 seconds to open a connection. We have used different driver (JDBC, ODBC, OCI) and SQLPlus. But, we have noticed no difference in sql connection time. We have investigated network, but noticed no problem with network.

Some time, it is taking around 16 seconds to open a single connection. This database has around 50000 user schema.

Can anybody tell me what can be done to reduce the connection opening time? Your help would be appreciated.

like image 635
user284534 Avatar asked Mar 02 '10 16:03

user284534


People also ask

How long does a SQL connection last?

At the time of writing the first connection pool created in a process would always have a timer interval of 3min 10s, so you'd normally see sql connections being closed somewhere between 3min 10s and 6min 20s after you call Close() on the ADO object.

What happens if we keep connection open?

While the specific details matter in general there is nothing wrong with keeping connections open for long durations. If your application is connection pooling - the connection slots in the pool typically remain connected until they are needed.

What happens if you don't close SQL connection?

Not closing connections could cause timeouts as the connection pool may run out of available connections that can be used. A side point to this. If you use the using keyword, that will automatically close the connection for you.

Should you keep SQL connection open?

From MSDN, "Note If the SqlConnection goes out of scope, it is not closed. Therefore, you must explicitly close the connection by calling Close or Dispose." Cheers!


2 Answers

if suddenly the tnsping is become very slow(means it's a all right system before), but ping to the same database server is fast, The most possible reason is the listener.log file is too large:

$ORACLE_HOME/network/log/listener.log

Some OS (SunOS in my experience) will meet writing to a very large text file performance issue(exceed 4G?), so tail/clean the log file will immediately solve the tnsping takes very long time problem.

like image 181
Eric Guo Avatar answered Oct 16 '22 17:10

Eric Guo


It was DNS in our case. After our admin commented out all DNS entries on the side of the server the system started responding without delay.

like image 26
Zeks Avatar answered Oct 16 '22 16:10

Zeks