How to Use JDBC to start Oracle auto trace, jdbcoracle

Source: Internet
Author: User

How to Use JDBC to start Oracle auto trace, jdbcoracle
Sometimes we need to track and analyze the specific execution process of SQL statements, especially when the application performance is optimized. Two Oracle tools can help us analyze performance. One is SQL _TRACE and the other is SESSION_EVENT. SQL _TRACE traces the SQL Execution process, such as the resolution time, execution time, and query time. SESSION_EVENT tracks the waiting events of the execution process, such as waiting for the client to respond to the time and waiting for local disk IO events. You must use the DBA permission to enable Oracle automatic tracing. Use JDBC to enable SQL _TRACE: conn. prepareStatement ("alter session set SQL _TRACE = TRUE"); ps.exe cute (); Use JDBC to enable SESSION_EVENT: Enable: ps = conn. prepareStatement ("alter session set events '10046 trace name context forever, level 12'"); ps.exe cute (); off: ps = conn. prepareStatement ("alter session set events '10046 trace name context off'"); (disable tracing before closing the connection) ps.exe cute ();
The following is the trace file obtained by enabling these two tracing:

OracleExecution Process Analysis:

  • During SQL Execution, the main execution process is in the Fetch stage of Oracle.
  • The number of Fetch OCI calls is 146, the time consumed is 50.49 seconds, and the number of queries is 145259
Analysis of wait events during Oracle execution:
  • The waiting time for the oracle server to send data to the client is 0, indicating that the network transmission on the server is normal.
  • The total time for the oracle server to wait for the client to respond is 5.92 seconds, indicating that it takes some time for the client to process data and network transmission.
  • The oracle server disk I/O time is 48.37 seconds, indicating that the main time is spent reading data blocks from the disk from Oracle.
  • It takes 0.12 seconds to send data in batches to the client. This time is acceptable.



Oracle driver for jdbc Programming

For the oracle driver package, change one. Or I will send you one. Send me your email address. Send me Baidu messages.
The package reference is correct. It will be automatically added to the ClassPath path under lib/ext.
References: if you have other questions, send me a Baidu message.

When loading the oracle JDBC driver when Java is used as the database connection pool, the system always prompts that the driver class cannot be found.

I have heard of this problem. I have seen it in online videos. I don't know much about it (it seems like a BUG). You just copied it yourself, it won't automatically get it for you. It will be okay if you use Myeclipse ..

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.