Enabling SQL Tracing for an instance

Hi,
I am aware that SQL_TRACE init parameter is deprecated :
Oracle® Database Upgrade Guide
10g Release 2 (10.2)
Part Number B14238-01
Initialization Parameters Deprecated in Release 10.2
SQL_TRACE
So I searched the recommended way of enabling sql tracing for an instance and I found :
Oracle® Database Performance Tuning Guide
10g Release 2 (10.2)
Part Number B14211-01
20.4.2 Step 2: Enabling the SQL Trace Facility
You can enable the SQL Trace facility for an instance by setting the value of the SQL_TRACE initialization parameter to TRUE in the initialization file.
Well, the Tuning guide should not mention deprecated parameter, should it?
Anyway, I found later that the recommended way is to use
exec DBMS_MONITOR.DATABASE_TRACE_ENABLEPlease update your tuning guide.
Cam on rat nieu ;-)

Laurent,
Sorry to post a reply after nearly 2 years :-)
But:
Does dbms_monitor.database_trace_enable() only trace existing sessions or does it also enable tracing for all new sessions?
I've been consulting the documentation and searching on the Internet but I can't determine this.
Cheers & thanks,
Colin

Similar Messages

  • Enabling SQL Tracing for already connected session

    Hi,
    I've a requirement. i.e. my users are connected to db through schema making sessions( As multiple users are connected from single Schema). Now there are certian users which have to run batch jobs and I want to trace there SQL for tunning. I want to know how can I enable SQL tracing for specific user,session,id since it is difficult to trace exact user as multiple users are running the batch jobs.
    I have a strategy to enable tracing at schema level. Can I do this while users are connected and running quries. As normally first we enable the tracing and then run the quries.
    Kindly help me in working out this.
    Regards,
    Abbasi

    You didn't post your Oracle version, but maybe you have DBMS_MONITOR available to you.
    Hope this helps!

  • Enable SQL Tracing for Session

    Hi,
    I know how to enable SQL tracing for a session created either through SQL*Plus or like similar tool, but I want to explore is there any way to can we enable sql tracing for a single session which is connected to database through an application.
    ssome time for testing purpose we have a requirement to enable tracing for that user which run batch Job. Now that particular user gets connected to database through application and i want to enable tracing right at that moment. How can I accomplish it.
    Regards,
    Ababsi

    If you don't want to identify database session you can try to create a logon trigger to enable tracing for all database sessions created by a specific Oracle user account. In the following example you need to replace UWCLASS with the Oracle user account for which you want to trace sessions:
    CREATE OR REPLACE TRIGGER trace_trig
    AFTER LOGON
    ON DATABASE
    DECLARE
    sqlstr VARCHAR2(200) := 'ALTER SESSION SET EVENTS ''10046 TRACE NAME CONTEXT FOREVER, LEVEL 12''';
    BEGIN
      IF (USER = 'UWCLASS') THEN
        execute immediate sqlstr;
      END IF;
    END trace_trig;
    /Reference:
    http://psoug.org/reference/system_trigger.html
    If you want to identify database session you need to query V$SESSION to retrieve SID and SERIAL# of the session you want to trace and then you can use DBMS_MONITOR. See examples in http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php
    Edited by: P. Forstmann on 15 janv. 2011 11:07

  • Enabling SQL tracing from Forms

    Hi...
    can I enable SQL tracing for Particular instance or session from my 6i/9i forms.I can do it directly from database but what if i want to do it from Forms programatically or forms provides something which can help me ....
    any idea ???
    Thanx in advance

    REPOST

  • SQL Tracing for session started from Java code

    I am working with Oracle 10g on Solaris 9. I am facing a problem when trying to enable SQL Trace for Oracle sessions initiated from Weblogic server. I am querring V$SESSION to get the SID and SERIAL# of those sessions and then using DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION(<sid>, <serial#>, TRUE); from the SQLPlus (using sys login). But the trace file is not being generated in UDUMP even after some queries are fired from the application. But when I am using the same procedure to turn SQL Trace on for SQLPlus sessions or SQLDeveloper sessions, they are just working fine.
    Can anyone please help me out?

    Please help.....
    There is already a thread
    Problem with SQL_Trace for a Session
    but there is no solution there.

  • Automize SQL TRACE for a selected session

    Hi,
    Should I automize the process of SQL Tracing for a particular session of our choice?
    Let’s say when there are several sessions, and we want to select the particular session for SQL TRACING, then the SQL tracing for that session enable via running a routine.
    I used AFTER LOGON trigger for enabling SQL trace, but using this approach enable SQL TRACING all the sessions.
    My Logon Trigger for enabling SQL Tracing:
    create or replace trigger LOGON_SQL_TRACE
    after logon on database
    begin
    execute immediate
    'alter session set sql_trace=true';
    end;
    I want to use a perfect routine that first get the sid, serial# or username etc. from V$session, V$process or else, and then enable the SQL TRACING for the selected session.
    Like SYS.DBMS.SYSTEM.SET_SQL_TRACE_IN_SESSION package is available for doing that or may be some others as well.
    But how should we use these packages or other SQL tracing commands in a routine, which we can use for, enable SQL Tracing implicitly.
    Any ideas will be great.
    Bill

    SYS.DBMS.SYSTEM.SET_SQL_TRACE_IN_SESSION is just fine.
    You can get the SID and SERIAL# from v$session; you just have to know the username, osmachine, the OS process, ...
    Fred

  • SQL TRACE FOR THIRD PART TOOL

    Hi,
    Should we use the Logon trigger for SQL TRACING,for the third party tool?
    How should we manage SQL tracing and then read this trace file using
    TKPROF for that specific session that is using the third party tool?
    I wanted that whenever this third party tool connect to database with any user, the sql tracing will start for that specific seesion and then read the sqltrace for that session using TKPROF.
    Any ideas/exmp will be great.
    Regards
    CLEE

    Should we use the Logon trigger for SQL TRACING,for the third party tool?
    Yes you can use like
    CREATE OR REPLACE TRIGGER af_sess_Logon
    After logon on database
    Begin
    if ( user='SCOTT') then
    execute immediate 'alter session set sql_trace=true';
    End if;
    End;
    sql tracing will start for that specific seesion and then read the sqltrace for that session using TKPROF.
    for tkprof you can user command line
    or use host in sql
    kuljeet pal singh

  • SQL Trace for ODS Scripts

    Hi,
    How can I turn on SQL Tracing for ODS Transfer scripts?
    Best regards,
    Johan

    Hi Johan,
    If SAP Note 1289112 is not the case, please clarify what "ODS Transfer" means.
    Regards,
    Sergiy

  • Setting SQL TRACING

    Hi ,
    I want to set Sql tracing on in my machine.
    I am using the oracle 9i Database (9.2.0.4.0).
    My operating system is windows 2000 professional.
    Can anyone tell me how to enable SQL tracing in my database and wat is the use of it.
    Thanks...

    http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htm#8760

  • SQL Server 2012 - 3 SQL clustered instances - one default/ two named instances - how assign/should assign static ports for named instances

    We have two physical servers hosting 3 SQL 2012 clustered instances, one default instance and two named instances.
    The default instance is using port 1433 and the two named instances are using dynamic port assignment.
    There is discussion about assigning static port numbers to the two named clustered SQL instances.
    What is considered best-practice?  For clustered named instances to have dynamic or static ports?
    Are there any pitfalls to assigning a static port to a named instance that is a cluster?
    Any help is greatly appreciated

    Hi RobinMCBC,
    In SQL server the default instance has a listener which listens on the fixed port which is TCP port 1433. And for the named instance the port on which the SQL server listens is random and is dynamically selected when the named instance of the SQL server
    starts.
    For Standalone instance of the SQL server we can change the dynamic port of the named instance to the static port by using SQL server configuration manager as other post, however, in case of the cluster, when we change the port no. of the named instance
    to the static port using the method described above, the port no. again changes back to the dynamic port after you restart the services. I recommend you changing the Dynamic port of the SQL Server to static port 
    on all the nodes , disabling and enabling the checkpointing to the quorum.
    For more information, you can review the following article about how to change the dynamic port of the SQL Server named instance to an static port in a SQL Server 2005 cluster.
    http://blogs.msdn.com/b/sqlserverfaq/archive/2008/06/02/how-to-change-the-dynamic-port-of-the-sql-server-named-instance-to-an-static-port-in-a-sql-server-2005-cluster.aspx
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • To list only user databases with the size for a instance in sql server 2005

    Hi,
    I looking for T-SQl to  list only user databases with their size for a instance in sql server 2005

    Try this:
    use [databasename]
    go
    if convert(varchar(20),SERVERPROPERTY('productversion')) like '8%'
    SELECT [name], fileid, filename, [size]/128.0 AS 'Total Size in MB',
    [size]/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS 'Available Space In MB',
    CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS 'Used Space In MB',
    (100-((([size]/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0)/([size]/128.0))*100)) AS 'percentage Used'
    ,((CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0)/([size]/128.0))*100 as 'percentage used'
    FROM sysfiles
    else
    SELECT [name], file_id, physical_name, [size]/128.0 AS 'Total Size in MB',
    [size]/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS 'Available Space In MB',
    CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS 'Used Space In MB',
    (100-((([size]/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0)/([size]/128.0))*100)) AS 'percentage Used'
    --,((CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0)/([size]/128.0))*100 as 'percentage used'
    FROM sys.database_files
    go
    Or can refer below link:
    http://gallery.technet.microsoft.com/scriptcenter/All-Databases-Data-log-a36da95d
    Please click the Mark as answer button and vote as helpful if this reply solves your problem

  • MS SQL 2008 R2 Named instance: Login failed. Microsoft SQL server, Error: 18452) - Tryig to access using the FQDN assigned for the backup network card.

    Hi,
       I have a windows 2008 R2 Enterprise servers with standalone MS-SQL 2008 R2 named instance.  The server is having two networks, once production and the second for backup. The server FQDN is resolving to the production IP. The backup NIC
    DNS dynamic update is disabled and an "A" record is registered with the dns.  While trying to connect to the instance using the management studio:
    Successfuly able to connect using the instance name, the production hostname, production IP and backup IP. 
    but while trying to connect to the insance using the backup hostname getting the below error:
    "Login failed. The login is an untrusted domain and cannot be used with windows authentication. (Microsoft SQL server, Error: 18452) "
    This is required for the backup tool to get connected using the backup FQDN of the server.
    Should I need to create a host name alias,  request you to kindly assist me with the best recommedation to fix this.
    http://blogs.msdn.com/b/dbrowne/archive/2012/05/21/how-to-add-a-hostname-alias-for-a-sql-server-instance.aspx

    Hi,
    It might be a kerberos issue.  Check that there are valid SPN's registered using the setspn utility - http://technet.microsoft.com/en-us/library/cc731241.aspx
    Thanks, Andrew
    My blog...

  • TF400525: Make sure the SQL Server Reporting Services service for this instance is running.

    I am trying to install TFS 2012 update 4 on single server installation.
    I am getting below error:
    TF400525: Make sure the SQL Server Reporting Services service for this instance is running.

    Hi CFSA, 
    Thanks for your post.
    If you want install TFS 2012 Server with Reporting Server, you must ensure the provided Reporting Services is running first.
    As Daniel said, please check that in SQL Server Configuration Manager to ensure Reporting Services is installed and running.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • What is the recommended static port range for SQL Server 2008 to SQL Server 2014 named instance?

    I want to assign a static port to SQL Server 2008 to SQL Server 2014 named instance.   Should the port be greater than 49151?  The following links give contradicting information:
    https://msdn.microsoft.com/en-us/library/ms177440(v=sql.105).aspx
    Avoid numbers greater than 49151 which Windows might select for other purposes.
    https://technet.microsoft.com/en-us/library/ms345327(v=sql.100).aspx
    Port numbers should be assigned from numbers 49152 through 65535
    Thanks..

    I would still pick a port number below the ephemeral list (dynamic port usage [41952-65535]) as it'll reduce the chances of having a port collision when SQL Server starts up.
    Also, I'd stick to lower numbers if possible (<25,000) as some firewalls skew higher port numbers to be more malicious (if heuristics are used).
    -Sean
    The views, opinions, and posts do not reflect those of my company and are solely my own. No warranty, service, or results are expressed or implied.

  • Enable SQL Notification Services for BAM alerts , Biztalk 2010

    Hi,
    Enable SQL Notification Services for BAM alerts is greyed out.
    I need to enable bam alerts in BizTalk 2010.
    Regards,
    Sharmishtha

    Hi,
    If I understand correct, your problem is that the BAM Alerts configuration is greyed out in the BizTalk Configuration tool. If this is the problem it's due probably because you don't have the SQL Server 2005 Notification Services installed. Notification
    Services is required for BAM Alerts feature.
    You can take a look at the following link, even it's for multi-computer installation:
    http://social.technet.microsoft.com/wiki/contents/articles/1888.install-and-configure-bam-business-activity-monitoring-in-a-multi-computer-environment.aspx
    Best regards.

Maybe you are looking for