Advertisement
ExaGridDba

Trace.java start and stop tracing

Nov 7th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.PreparedStatement;
  3. import java.sql.SQLException;
  4.  
  5. public class Trace
  6. {
  7.  
  8.         public static void on( Connection conn )
  9.                 throws SQLException
  10.         {
  11.                 String sql = "alter session set tracefile_identifier = tracefile";
  12.                 PreparedStatement pstmt = conn.prepareStatement( sql );
  13.                 pstmt.execute();
  14.                 sql = "alter session set events '10046 trace name context forever, level 12'";
  15.                 pstmt = conn.prepareStatement( sql );
  16.                 pstmt.execute();
  17.         }
  18.  
  19.         public static void off( Connection conn )
  20.                 throws SQLException
  21.         {
  22.                 String sql = "alter session set events '10046 trace name context off'";
  23.                 PreparedStatement pstmt = conn.prepareStatement( sql );
  24.                 pstmt.execute();
  25.         }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement