Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: enable tracing from .NET application.

Re: enable tracing from .NET application.

From: Steve Howard <stevedhoward_at_gmail.com>
Date: 28 Dec 2006 06:44:52 -0800
Message-ID: <1167317092.076898.291690@i12g2000cwa.googlegroups.com>

probashi wrote:
> is it possible to enable tracing from .NET application using the
> following:
>
> alter session set sql_trace = true
>
> PS: I am using ADO.NET 2.0 and Visual Studion 2005 and C#

Hi,

Try something like the following...

using System;
using Oracle.DataAccess.Client;

public class test {
  public static void Main() {
    string DBConnection = "user id=rep;password=rep;Data Source=racdb.test;Statement Cache Size= 10";

    OracleConnection conn = new OracleConnection(DBConnection);     OracleDataReader rdr = null;
    conn.Open();
    OracleCommand cmd = new OracleCommand("alter session set events '10046 trace name context forever, level 12'", conn);

    cmd.ExecuteNonQuery();
    cmd.CommandText = "select * from all_objects where object_id = :c";     OracleParameter p_object_id = new OracleParameter();     cmd.Parameters.Add(p_object_id);
    p_object_id.Value = 1;
    rdr = cmd.ExecuteReader();
    while (rdr.Read())
      Console.WriteLine(rdr[0]);
    conn.Close();
  }
}

Regards,

Steve Received on Thu Dec 28 2006 - 08:44:52 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US