Sys.fn_xe_file_target_read_file performance

Hi,
I am working with extended events and the function sys.fn_xe_file_target_read_file. I am using the file_name and file_offset to get new events, since the last time I queried the function. I am checking for new events once a minute like this:
exec sp_executesql N'SELECT @@SERVERNAME AS server_name, @session_name AS session_name, @collection_id AS collection_id, module_guid, package_guid, [object_name], event_data, [file_name], file_offset FROM sys.fn_xe_file_target_read_file(@file_path, NULL,
@file_name, @file_offset)',N'@session_name nvarchar(13),@collection_id bigint,@file_path nvarchar(84),@file_name nvarchar(104),@file_offset bigint',@session_name=N'system_health',@collection_id=4127175,@file_path=N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\LOG\system_health*.xel',@file_name=N'C:\Program
Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\LOG\system_health_0_130317495005090000.xel',@file_offset=66560
I have started to get a problem on some servers that it is very slow, even when there are few new events. It can take up to 30 seconds to get one single event.
After some investigations I found out that it seems to be related to the number of files. I had configured the extended event target to 100 files of the size 5 MB. On the server where we have the problem there were 41 files. When I deleted all files but
the latest, then the time went down to about 1 second. After stopping and starting the session and then deleting the old file (keeping only one small file), the time went down to about 50 ms.
So I am trying to figure out how sys.fn_xe_file_target_read_file works (what is it doing), and the pros and cons of having many files or large files. I will do some testing, but if anyone has any experiences to share it would be great.
The version number is 11.0.3373.0.
Best regards
Ola Hallengren
http://ola.hallengren.com

I was doing some testing with Process Monitor. I can see that it is accessing all files. Here is the output from this
query:
SELECT *
FROM sys.fn_xe_file_target_read_file('C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health*.xel',
NULL,
'C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130317438925230000.xel',
2050560
"Time of Day","Process Name","PID","Operation","Path","Result","Detail"
"21:51:06.3127313","sqlservr.exe","1784","CreateFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health*_0_9223372036854775807.xel","NAME INVALID","Desired Access: Read Attributes, Synchronize, Dis, Options: Synchronous
IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Write, AllocationSize: n/a"
"21:51:06.3129550","sqlservr.exe","1784","CreateFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health*_0_9223372036854775807.xel","NAME INVALID","Desired Access: Read Attributes, Synchronize, Dis, Options: Synchronous
IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, AllocationSize: n/a"
"21:51:06.3131669","sqlservr.exe","1784","CreateFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health*_0_9223372036854775807.xel","NAME INVALID","Desired Access: Read Attributes, Synchronize, Dis, Options: Synchronous
IO Alert, Attributes: n/a, ShareMode: Read, Write, AllocationSize: n/a"
"21:51:06.3133810","sqlservr.exe","1784","CreateFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health*_0_9223372036854775807.xel","NAME INVALID","Desired Access: Read Attributes, Synchronize, Dis, Options: Synchronous
IO Non-Alert, Open Reparse Point, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a"
"21:51:06.3227988","sqlservr.exe","1784","QueryDirectory","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health*.xel","SUCCESS","Filter: system_health*.xel, 1: system_health_0_130313895108460000.xel"
"21:51:06.3233465","sqlservr.exe","1784","CreateFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130313895108460000.xel","SUCCESS","Desired Access: Generic Read, Dis, Options: Sequential Access, Synchronous
IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
"21:51:06.3234822","sqlservr.exe","1784","QueryStandardInformationFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130313895108460000.xel","SUCCESS","AllocationSize: 1,019,904, EndOfFile: 1,019,904, NumberOfLinks:
1, DeletePending: False, Directory: False"
"21:51:06.3235452","sqlservr.exe","1784","CreateFileMapping","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130313895108460000.xel","FILE LOCKED WITH ONLY READERS","SyncType: SyncTypeCreateSection, PageProtection: "
"21:51:06.3235944","sqlservr.exe","1784","QueryStandardInformationFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130313895108460000.xel","SUCCESS","AllocationSize: 1,019,904, EndOfFile: 1,019,904, NumberOfLinks:
1, DeletePending: False, Directory: False"
"21:51:06.3236933","sqlservr.exe","1784","CreateFileMapping","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130313895108460000.xel","SUCCESS","SyncType: SyncTypeOther"
"21:51:06.3239419","sqlservr.exe","1784","CreateFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130314358881960000.xel","SUCCESS","Desired Access: Generic Read, Dis, Options: Sequential Access, Synchronous
IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
"21:51:06.3240541","sqlservr.exe","1784","QueryStandardInformationFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130314358881960000.xel","SUCCESS","AllocationSize: 5,242,880, EndOfFile: 5,241,344, NumberOfLinks:
1, DeletePending: False, Directory: False"
"21:51:06.3241084","sqlservr.exe","1784","CreateFileMapping","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130314358881960000.xel","FILE LOCKED WITH ONLY READERS","SyncType: SyncTypeCreateSection, PageProtection: "
"21:51:06.3241553","sqlservr.exe","1784","QueryStandardInformationFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130314358881960000.xel","SUCCESS","AllocationSize: 5,242,880, EndOfFile: 5,241,344, NumberOfLinks:
1, DeletePending: False, Directory: False"
"21:51:06.3242521","sqlservr.exe","1784","CreateFileMapping","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130314358881960000.xel","SUCCESS","SyncType: SyncTypeOther"
"21:51:06.3245153","sqlservr.exe","1784","CreateFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130316898777600000.xel","SUCCESS","Desired Access: Generic Read, Dis, Options: Sequential Access, Synchronous
IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
"21:51:06.3246253","sqlservr.exe","1784","QueryStandardInformationFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130316898777600000.xel","SUCCESS","AllocationSize: 954,368, EndOfFile: 952,832, NumberOfLinks: 1, DeletePending:
False, Directory: False"
"21:51:06.3246796","sqlservr.exe","1784","CreateFileMapping","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130316898777600000.xel","FILE LOCKED WITH ONLY READERS","SyncType: SyncTypeCreateSection, PageProtection: "
"21:51:06.3247272","sqlservr.exe","1784","QueryStandardInformationFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130316898777600000.xel","SUCCESS","AllocationSize: 954,368, EndOfFile: 952,832, NumberOfLinks: 1, DeletePending:
False, Directory: False"
"21:51:06.3248247","sqlservr.exe","1784","CreateFileMapping","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130316898777600000.xel","SUCCESS","SyncType: SyncTypeOther"
"21:51:06.3250799","sqlservr.exe","1784","CreateFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130317438925230000.xel","SUCCESS","Desired Access: Generic Read, Dis, Options: Sequential Access, Synchronous
IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
"21:51:06.3251936","sqlservr.exe","1784","QueryStandardInformationFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130317438925230000.xel","SUCCESS","AllocationSize: 2,064,384, EndOfFile: 2,064,384, NumberOfLinks:
1, DeletePending: False, Directory: False"
"21:51:06.3252493","sqlservr.exe","1784","CreateFileMapping","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130317438925230000.xel","FILE LOCKED WITH ONLY READERS","SyncType: SyncTypeCreateSection, PageProtection: "
"21:51:06.3252962","sqlservr.exe","1784","QueryStandardInformationFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130317438925230000.xel","SUCCESS","AllocationSize: 2,064,384, EndOfFile: 2,064,384, NumberOfLinks:
1, DeletePending: False, Directory: False"
"21:51:06.3253930","sqlservr.exe","1784","CreateFileMapping","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130317438925230000.xel","SUCCESS","SyncType: SyncTypeOther"
"21:51:06.9404203","sqlservr.exe","1784","CloseFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130313895108460000.xel","SUCCESS",""
"21:51:06.9405464","sqlservr.exe","1784","CloseFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130314358881960000.xel","SUCCESS",""
"21:51:06.9406615","sqlservr.exe","1784","CloseFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130316898777600000.xel","SUCCESS",""
"21:51:06.9408089","sqlservr.exe","1784","CloseFile","C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012ENT01\MSSQL\Log\system_health_0_130317438925230000.xel","SUCCESS",""
 

Similar Messages

  • SYS Auditing ???

    Hi All,
    I have a application schema called SPRE. I want to audit insert/update/delete/alter on any SPRE objects by any database user but I dont want to audit any action performed by "SPRE" user itself.
    I know how to setup this.....like run below as system
    audit inser,update,delete on SPRE.table1;
    audit inser,update,delete on SPRE.table2;
    audit inser,update,delete on SPRE.table3;
    but questions I have is...
    1. How to audit if sys user perform any insert,update,delete?
    2. How to stop audit entry if SPRE user performed insert,update,delete
    Thanks,
    Anuj

    1. Set the following parameter
    audit_sys_operations=TRUE
    AUDIT_FILE_DEST=<OS directory to store the SYS audit trail>
    2. Set the audit options for each user on each table (there are no commands to specifically exclude just 1 user)
    SQL> AUDIT UPDATE, INSERT, DELETE ON SPRE.xxxx BY <username>;
    Or maybe you could just set audit on each table for all users and simply exclude the SPRE user when generating audit reports from the audit table

  • Query performance difference -- CPU time difference on two servers

    Two SQL servers, server A & B, Hardware information as below:
    Server A: Clustered. Two physical processors (4 cores). RAM 64GB, SQL Server max memory: 58GB.
    Server B: Standalone. One physical processor (4 cores). RAM 16GB, SQL Server max memory: 10GB.
    The two databases on A & B are identical (using backup & restore method), same query execution CPU time are different, it is slower on the cluster server with more CPU & Mmeory. I tried many times and all same result, I also tried run DBCC DROPCLEANBUFFERS
    & DBCC FREEPROCCACHE before running the query.
    When I run the query, on Server A (Slow one), CPU usage is at 20% ~30%. RAM usage is 14%. It is new set up environment so just me using it now.
    When I run the query on Server B (Fast one), CPU usage is 40%, RAM usage is 85%.
    Both two servers have SAN connected storage.
    Query execution plan is exactly same on two serers.
    Could someone give me some advise how to troubleshoot this problem? Any suggestion is appreciated a lot! Thanks a lot!
    FYI, Below are the statistics when running same query in same DB on two servers:
    Server A CPU & IO Statistics:
    SQL Server parse and compile time: 
       CPU time = 109 ms, elapsed time = 297 ms.
    (1005301 row(s) affected)
    Table 'PODT'. Scan count 1, logical reads 55184, physical reads 3, read-ahead reads 55180, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'MRICLDEFENT'. Scan count 0, logical reads 71898, physical reads 3, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'POHD'. Scan count 1, logical reads 103154, physical reads 3, read-ahead reads 103150, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
     SQL Server Execution Times:
    CPU time = 7769 ms,  elapsed time = 16693 ms.
    Server B CPU & IO Statistics:
    SQL Server parse and compile time: 
       CPU time = 32 ms, elapsed time = 39 ms.
    (1005301 row(s) affected)
    Table 'PODT'. Scan count 1, logical reads 55184, physical reads 3, read-ahead reads 55180, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'MRICLDEFENT'. Scan count 0, logical reads 71898, physical reads 3, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'POHD'. Scan count 1, logical reads 103154, physical reads 3, read-ahead reads 103150, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
     SQL Server Execution Times:
    CPU time = 3931 ms,  elapsed time = 14387 ms.                             

    hi, Vivian_Vivian
    i just want to ask you 
    which sql version do you use?
    have you ever tried xevent before??
    if you use the sql2k8 or latter you can try xevent out to find somgthing clues about your cpu time problem
    i provide you the script,pls post your output in the xevent here so that we could judge what  the head of the problem is
    USE [master]
    GO
    CREATE EVENT SESSION [TrackSQLWait] ON SERVER
    ADD EVENT sqlserver.sql_statement_starting (
        ACTION ( sqlserver.session_id, sqlserver.database_id,sqlserver.sql_text ,package0.collect_system_time)
        WHERE ( sqlserver.database_id = 7 ) ), --★Do
    ADD EVENT sqlserver.sql_statement_completed (
        ACTION ( sqlserver.session_id, sqlserver.database_id, sqlserver.sql_text ,package0.collect_system_time)
        WHERE ( sqlserver.database_id = 7 ) ), --★Do
    ADD EVENT sqlserver.error_reported (
        ACTION ( sqlserver.session_id, sqlserver.database_id, sqlserver.sql_text ,package0.collect_system_time)
        WHERE ( sqlserver.database_id = 7 ) ), --★Do
    ADD EVENT sqlos.wait_info (
        ACTION ( sqlserver.database_id, sqlserver.session_id, sqlserver.sql_text,sqlserver.plan_handle ,package0.collect_system_time)
        WHERE 
        ( duration > 1000
          AND ( ( wait_type > 31    -- Waits for latches and important wait resources (not locks) 
                                -- that have exceeded 10 seconds. 
                  AND ( ( wait_type > 47
                          AND wait_type < 54
                        OR wait_type < 38
                        OR ( wait_type > 63
                             AND wait_type < 70
                        OR ( wait_type > 96
                             AND wait_type < 100
                        OR ( wait_type = 107 )
                        OR ( wait_type = 113 )
                        OR ( wait_type > 174
                             AND wait_type < 179
                        OR ( wait_type = 186 )
                        OR ( wait_type = 207 )
                        OR ( wait_type = 269 )
                        OR ( wait_type = 283 )
                        OR ( wait_type = 284 )
                OR ( duration > 30000        -- Waits for locks that have exceeded 30 secs.
                     AND wait_type < 22
    ADD TARGET package0.asynchronous_file_target (  SET filename = 'E:\ExtendedEvent\TrackSQLWait.xel' ,
                                                    metadatafile = 'E:\ExtendedEvent\TrackSQLWait.xem' )
    WITH ( MAX_MEMORY = 4 MB ,
            EVENT_RETENTION_MODE = ALLOW_SINGLE_EVENT_LOSS )
    GO
    ALTER EVENT SESSION [TrackSQLWait]
    ON SERVER
    STATE=START
    -- Query the Event data from the Target.
    SELECT  event_data.value('(event/@name)[1]', 'varchar(50)') AS [event_name] ,
            event_data.value('(event/data[@name="source_database_id"]/value)[1]',
                             'int') AS [source_database_id] ,
            OBJECT_NAME(event_data.value('(event/data[@name="object_id"]/value)[1]',
                                         'int')) AS [object] ,
            event_data.value('(event/data[@name="object_type"]/value)[1]',
                             'varchar(60)') AS [object_type] ,
            event_data.value('(event/data[@name="state"]/text)[1]', 'varchar(50)') AS [state] ,
            event_data.value('(event/data[@name="duration"]/value)[1]', 'bigint') AS [duration] ,
            event_data.value('(event/data[@name="cpu"]/value)[1]', 'bigint') AS [cpu] ,
            event_data.value('(event/data[@name="reads"]/value)[1]', 'bigint') AS [reads] ,
            event_data.value('(event/data[@name="writes"]/value)[1]', 'bigint') AS [writes] ,
            event_data.value('(event/data[@name="error"]/value)[1]', 'bigint') AS [error] ,
            event_data.value('(event/data[@name="severity"]/value)[1]', 'int') AS [severity] ,
            event_data.value('(event/data[@name="user_defined"]/value)[1]',
                             'varchar(5)') AS [user_defined] ,
            event_data.value('(event/data[@name="message"]/value)[1]',
                             'varchar(max)') AS [message] ,
            event_data.value('(event/data[@name="wait_type"]/text)[1]',
                             'varchar(250)') AS wait_typetype ,
            event_data.value('(event/data[@name="wait_type"]/value)[1]',
                             'varchar(250)') AS wait_typevalue ,
            event_data.value('(event/data[@name="max_duration"]/value)[1]',
                             'bigint') AS max_duration ,
            event_data.value('(event/data[@name="completed_count"]/value)[1]',
                             'bigint') AS [completed_count] ,
            event_data.value('(event/action[@name="plan_handle"]/value)[1]',
                             'varchar(max)') AS [plan_handle] ,
            DATEADD(hh, DATEDIFF(hh, GETUTCDATE(), CURRENT_TIMESTAMP),
                    event_data.value('(event/action[@name="collect_system_time"]/text)[1]',
                                     'datetime2')) AS [system_time] ,
            event_data.value('(event/action[@name="session_id"]/value)[1]',
                             'bigint') AS [session_id] ,
            event_data.value('(event/action[@name="sql_text"]/value)[1]',
                             'varchar(max)') AS [sql_text]
    FROM    ( SELECT    CAST(event_data AS XML) AS event_data
              FROM      sys.fn_xe_file_target_read_file('E:\ExtendedEvent\TrackSQLWait_*.xel',
                                                        'E:\ExtendedEvent\TrackSQLWait_*.xem',
                                                        NULL, NULL)
            ) AS tab
    WHERE   event_data.value('(event/data[@name="duration"]/value)[1]', 'bigint') > 100
            AND event_data.value('(event/@name)[1]', 'varchar(50)') LIKE 'wait_info'
    ORDER BY [system_time]
    ALTER EVENT SESSION [TrackSQLWait]
    ON SERVER
    STATE=STOP
    GO
    DROP EVENT SESSION [TrackSQLWait] ON SERVER
    please replacing the related parameter to fit for your situation
    thanks

  • Logical Standby Apply Processes Die when granting a user sysdba on Primary

    I've run into an issue where the sql apply processes are stopping when granting a user sysdba privilege on the primary.
    The error is insufficient privileges.
    Of course the workaround that we have used is to skip the transaction on the logical and then manually grant the sysdba privilege on the standby. I'm hoping there is a more elegant solution as I have 8 DBAs on my team and each on of the transactions will need to be skipped individually, and is a bit of a pain. Just thought I would ask if anyone out there has run into the same issue and has a better workaround.

    I think you misunderstand. We run our standby in guard_mode 'STANDBY', which allows sys to perform the grant operation directly on the logical. Where it is failing is when we grant on the primary. That or I misunderstand. Are you saying that if I put in the script on the primary, the alter session command, then it will propagate down cleanly? That is something I have not tried of course, but makes sense how that could work, unless it throws an error on the primary because it is not a standby.

  • Oracle Auditing question.

    Hi All,
    I have a application schema called SPRE. I want to audit insert/update/delete/alter on any SPRE objects by any database user but I dont want to audit any action performed by "SPRE" user itself.
    I know how to setup this.....like run below as system
    audit inser,update,delete on SPRE.table1;
    audit inser,update,delete on SPRE.table2;
    audit inser,update,delete on SPRE.table3;
    but questions I have is...
    1. How to audit if sys user perform any insert,update,delete?
    2. How to stop audit entry if SPRE user performed insert,update,delete
    Thanks,
    Anuj

    sys.aud$, dba_audit_trail
    OR
    SELECT view_name FROM   dba_views WHERE  view_name LIKE 'DBA%AUDIT%' ORDER BY view_name;
    SELECT view_name
    FROM   dba_views
    WHERE  view_name LIKE 'DBA%AUDIT%'
    ORDER BY view_name;
    VIEW_NAME
    DBA_AUDIT_EXISTS
    DBA_AUDIT_OBJECT
    DBA_AUDIT_POLICIES
    DBA_AUDIT_POLICY_COLUMNS
    DBA_AUDIT_SESSION
    DBA_AUDIT_STATEMENT
    DBA_AUDIT_TRAIL
    DBA_COMMON_AUDIT_TRAIL
    DBA_FGA_AUDIT_TRAIL
    DBA_OBJ_AUDIT_OPTS
    DBA_PRIV_AUDIT_OPTS
    DBA_REPAUDIT_ATTRIBUTE
    DBA_REPAUDIT_COLUMN
    DBA_STMT_AUDIT_OPTSHTH
    -Anantha
    Edited by: Anantha R on Mar 29, 2010 3:23 PM

  • How to find what values were passed onto a store procedure at the last run

    my web application is calling a store procedure but not returning the desired results in the ASP.net page
    when i execute the store procedure in sql server by providing the same values i get the desired result
    is there any way i could tell what values were passed onto the store procedure when it was called by the web page
    i am using sql server 2012 express 

    To add to the Profiler suggestion, you can also capture this information using Extended Events.  Below is a script example to capture RPC and batch completed events.  This can be done from the SSMS Object Explorer as well:
    --create ExtendedEvent session
    CREATE EVENT SESSION [ParameterTrace] ON SERVER
    ADD EVENT sqlserver.rpc_completed(
    ACTION(sqlserver.sql_text)),
    ADD EVENT sqlserver.sql_batch_completed(
    ACTION(sqlserver.sql_text))
    ADD TARGET package0.event_file(SET filename=N'C:\Temp\ParameterTrace.xel')
    WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
    GO
    --start session
    ALTER EVENT SESSION [ParameterTrace] ON SERVER
    STATE = START;
    GO
    --stop session
    ALTER EVENT SESSION [ParameterTrace] ON SERVER
    STATE = STOP;
    --query trace data
    SELECT CAST(event_data AS XML) AS event_data
    FROM sys.fn_xe_file_target_read_file(N'C:\temp\ParameterTrace*', default, default, default);
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Opi & upi

    I'm confused between these terms: Oracle program Interface and User program Interface .what do they really mean.One more thing what's the different between ORA_<SID>DBA & ORA<SID>_OPER I know that both of them are groups that are granted all dba privileges ,but what's the different between each.
    Thanks in advance

    User Process does not interact directly with Oracle Server rather it generates call using User program Interface (UPI).
    Server Process communicates with Oracle Server using the Oracle program Interface (OPI).
    ORA_<SID>DBA group represents SYSDBA and ORA<SID>_OPER group represents SYSOPER.
    The difference between them is level of privileges they have.
    SYSDBA are authorized to perform following operations.
    Perform STARTUP and SHUTDOWN operations
    ALTER DATABASE: open, mount, back up, or change character set
    CREATE DATABASE
    CREATE SPFILE
    ARCHIVELOG and RECOVERY
    Includes the RESTRICTED SESSION privilege
    Allows a user to connect as user SYS
    SYSOPER
    Perform STARTUP and SHUTDOWN operations
    CREATE SPFILE
    ALTER DATABASE OPEN/MOUNT/BACKUP
    ARCHIVELOG and RECOVERY
    Includes the RESTRICTED SESSION privilege
    Manu

  • Incorrect password fo emcli deploy_plugin_on_server

    When I am deploying my imported plugin , I am getting the output as below. I entered "sysman" as the password and <plugin_id> is my imported plugin. Can you please let me know the correct password for this command.
    $ emcli deploy_plugin_on_server -plugin=<plugin_id>
    Enter repository DB sys password:
    Performing pre-requisites check... This will take a while.
    Invalid repository sys password passed
    $

    Gayatri,
    You may want to consult with the person/DBA who created the database before changing the SYS password.
    Generally, there is no default SYS password. It is specified during the creation of the database. EM neither changes nor sets the password during installation/setup.
    Regards,
    - Loc

  • Extended events returning CDATA

    Hi,
    I created a XE session in SQL Server 2008 to capture deadlocks (xml_deadlock_report), but the result is returned in CDATA inside the value field.
    This way became more difficult to query the result for information about the deadlock. I already tested this in SQL Server 2012 and the result is XML inside the value, not CDATA.
    Is there any configuration I can use to get the result in XML or this really a difference between 2008 and 2012 ?
    Here the creation of the session:
    CREATE EVENT SESSION [Deadlocks] ON SERVER 
    ADD EVENT sqlserver.xml_deadlock_report(
        ACTION(package0.callstack,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_id,sqlserver.is_system,sqlserver.session_nt_username,sqlserver.sql_text,sqlserver.username)) 
    ADD TARGET package0.asynchronous_file_target(SET filename=N'E:\XEL\Deadlocks.xel',max_file_size=(100),max_rollover_files=(5))
    WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,
    MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=ON)
    GO
    Here a small peace of the result:
    <event name="xml_deadlock_report" package="sqlserver" id="123" timestamp="2014-07-03T21:19:50.068Z">
      <data name="xml_report">
        <value>&lt;deadlock&gt;
     &lt;victim-list&gt;
      &lt;victimProcess id="process40c4bc8"/&gt;
     &lt;/victim-list&gt;
     &lt;process-list&gt;
      &lt;process id="process40c4bc8" taskpriority="0" logused="400" waitresource="PAGE: 8:1:105636" waittime="4053" ownerId="627488528" transactionname="implicit_transaction" lasttranstarted="2014-07-03T18:20:55.113"
    XDES="0xac2bc9f0" lockMode="IX" schedulerid="8" kpid="17100" status="suspended" spid="73" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2014-07-03T18:20:56.150"
    lastbatchcompleted="2014-07-03T18:20:56.150" clientapp="jTDS" hostname="UPA-SRV-BOTA" hostpid="123" loginname="stok" isolationlevel="read committed (2)" xactid="627488528" currentdb="8"
    lockTimeout="4294967295" clientoption1="671090784" clientoption2="128058"&gt;
       &lt;executionStack&gt;
    Inside the 'value' everything is CDATA, so I can't use XML query on these nodes.
    Thank you !
    Dennes - Se resolveu, classifique a mensagem, por favor - [http://www.bufaloinfo.com.br] NOVO DVD Segurança no ASP.NET : http://www.bufaloinfo.com.br/LearingSeriesSegurancaASPNET2.asp

    Hi Dennes,
    According to your description, I also do a test in SQL Server 2008 R2 , indeed, it store xml content with CDATA tags and when you search a xml field without automatic removing of the CDATA tag.
    A database in Microsoft SQL Server can sometimes contain characters that are treated as markup characters by the XML parser; for example, angle brackets (< and >), the less-than-or-equal-to symbol (<=), and the ampersand (&) are treated as markup
    characters. However, you can wrap this type of special characters in a CDATA section to prevent them from being treated as markup characters. The text within the CDATA section is treated by the XML parser as plain text. For more information, you can review
    the following article.
    http://msdn.microsoft.com/en-us/library/ms171758(v=sql.100).aspx
    In addition, you can use the following statement to view the deadlock data from event data file in SQL Server.
    SELECT *FROM sys.fn_xe_file_target_read_file('C:\XEL\Deadlocksfile.xel', 'C:\XEL\file.xem', null, null)
    Then in event_data column, the event data will show as follows. For example,
    <value><![CDATA[0x0000000002A7FB06
    0x0000000002428878
    0x000000000242A2FA
    0x0000000000D4DB30
    0x000000000051C820
    0x000000000051C11C
    0x00000000024ED39E
    0x00000000004FB450
    0x00000000004FB116
    0x00000000004FAF5B
    0x00000000006344FA
    0x00000000006347DD
    0x0000000000A7C0CD
    0x00000000006353D2
    0x0000000074AC37D7
    0x0000000074AC3894]]></value>
    You need to specify the node names in the query, and also have to decide if you should have the different nodes in the same column or if they should be in different columns. There is an similar issue about extract data from an xml column.
    http://stackoverflow.com/questions/6941769/xml-column-extract-cdata
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Restore problem - how to get rid of corrupt database ?

    Folks,
    Some dumb developer managed to trash on of our Oracle database by doing a mistake in SQLDev.
    This database was / is using the "autobackup" feature as proposed in the installation wizard.
    For some reason it would seem that the restore is not complete, tough.
    I get an error when mounting the database
    ORA-01248: file 5 was created in the future of incomplete recovery
    ORA-01110: data file 5: <path to file>
    not sure to understand what happened but I can live without that specific database assuming the others are ok.
    Any advise as of how to get rid of that specific database and enjoy the rest of the server ?!
    Nest step will be to understand why autobackup is not doing what it is supposed to do...
    This is Oracle 11g standard on Oracle Linux.

    1. What statement did the developer issue? What did they do?none - they used the SQLDevelopper GUI to copy tables form db1 to db2
    2. What system table was affected?SYS tables where unintentionally affected.
    3. What does "erased" mean? DELETE statements? TRUNCATE? UPDATE?
    4. What does "corrupted" mean?Corrupted in the sense that the SYS table content was mangled to the extent that the database engine would not run anymore (the database process would not start). This has been fixed after the recovery.
    Run some SQL statements and show us what you are referring to. We can not recommend a fix based on what you've posted.Well I can run many statements on a database that will not go into an open state...
    Just to repeat the above:
    lSQL> startup;
    ORACLE instance started.
    Total System Global Area 845348864 bytes
    Fixed Size 1339796 bytes
    Variable Size 532680300 bytes
    Database Buffers 306184192 bytes
    Redo Buffers 5144576 bytes
    Database mounted.
    ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
    SQL> alter database open resetlogs;
    alter database open resetlogs
    ERROR at line 1:
    ORA-01248: file 5 was created in the future of incomplete recovery
    ORA-01110: data file 5: '/home/oracle/beautec/data/MODM_tab_0100.dat'
    Again I can live without that shema assuming it is the only one having problems - but I can't drop it as far as I know...
    That said I can log in as SYS and perform a drop database followed by using DBCA to create a new database in less than 20 minutes. Which I expect is more
    time than you've spent working with this so far.No point to get insulting - I spent much more than 20m on the issue. Unfortunately - as you have probably understood from my earlier posting - my DBA expertise is limited. That's the very reason I am looking for help.
    I can do
    shutdown abort;
    startup mount exclusive restrict;
    drop database;
    exit
    but that's the whole database going into the toilet - a bit extreme...

  • System health log file

    I have a set of SQL server system health log file that I would like to examine but can't read them in Management Studio. How can I open these log file, the file extension is .xel?
    thank you;
    Saeed

    Hello ,
    Best practice to use the extended sessions to capture the health information and save it to a file that is located outside of SQL Server. Therefore, you can still access it if there is a failure. The following example saves the output from an event session
    to a file:
    CREATE EVENT SESSION [diag]
    ON SERVER
    ADD EVENT [sp_server_diagnostics_component_result] (set collect_data=1)
    ADD TARGET [asynchronous_file_target] (set filename='c:\temp\diag.xel')
    GO
    ALTER EVENT SESSION [diag]
    ON SERVER STATE = start
    GO
     below reads the extended session log file:
    SELECT
    xml_data.value('(/event/@name)[1]','varchar(max)') AS Name
    , xml_data.value('(/event/@package)[1]', 'varchar(max)') AS Package
    , xml_data.value('(/event/@timestamp)[1]', 'datetime') AS 'Time'
    , xml_data.value('(/event/data[@name=''component_type'']/value)[1]','sysname') AS Sysname
    , xml_data.value('(/event/data[@name=''component_name'']/value)[1]','sysname') AS Component
    , xml_data.value('(/event/data[@name=''state'']/value)[1]','int') AS State
    , xml_data.value('(/event/data[@name=''state_desc'']/value)[1]','sysname') AS State_desc
    , xml_data.query('(/event/data[@name="data"]/value/*)') AS Data
    FROM
    SELECT
    object_name as event
    ,CONVERT(xml, event_data) as xml_data
    FROM
    sys.fn_xe_file_target_read_file('C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log\*.xel', NULL, NULL, NULL)
    AS XEventData
    ORDER BY time
    Ref
    Also you can see the article :https://www.simple-talk.com/sql/database-administration/database-properties-health-check/
    Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/

  • SYSDBA privileges

    I installed an instance of Oracle 8.0i in a Windows NT 4.0 Server edition. After that I logged in using the SYS account and I could not perform some tasks like changing some instance's parameters, shutdown the instance, etc.
    What should I configure in order to have SYSDBA privileges?
    Thanks in advance.
    Walter
    null

    Hi Walter,
    what you need to do is
    1.set an init.ora parameter
    remote_login_passwordfile=exclusive.
    2.shutdown and startup the instance so that the parameter takes effect.
    3.connect as internal.
    4.grant sysdba to sys.
    this will allow the sys user to connect and perform the sysdba activities.
    If this doesnt allow you to connect as sys and perform sysdba tasks,you will have to create the passwordfile i.e. pwd<sid>.ora
    using the 'orapwd' command .
    That should allow you to connect.
    Thanks and Regards,
    Mandar

  • Performance issue on the sys.dba_audit_session

    i have the following query which is taking long time and had performance issue.
    SELECT TO_CHAR(current_timestamp AT TIME ZONE 'GMT', 'YYYY-MM-DD HH24:MI:SS TZD') AS curr_timestamp, COUNT(username) AS
    failed_count
    FROM sys.dba_audit_session
    WHERE returncode != 0
    AND timestamp >= current_timestamp - TO_DSINTERVAL('0 0:30:00')
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.04 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 2 68.42 216.08 3943789 3960058 0 1
    total 4 68.43 216.13 3943789 3960058 0 1
    The view dba_audit_session is a select from the view dba_audit_trail. If you
    look at the definition of dba_audit_trail it does a CAST on the ntimestamp#
    column. Therefore disabling index access because there is not a function
    based index on ntimestamp#. I am not even sure a function based index would
    work to match what the view does.
    cast ( /* TIMESTAMP */
    (from_tz(ntimestamp#,'00:00') at local) as date),
    To get index access the metric would have to avoid the use of the view. I have changed the query like this.
    SELECT /*+ INDEX(a I_AUD3) */ TO_CHAR(current_timestamp AT TIME ZONE 'GMT', 'YYYY-MM-DD
    HH24:MI:SS TZD') AS curr_timestamp, COUNT(userid) AS failed_count
    FROM sys.aud$ a
    WHERE returncode != 0
    and action# between 100 and 102
    AND ntimestamp# >= systimestamp at time zone 'GMT' - 30/1440
    is it correct way to di it?
    could you comment on this ?

    The query is run by grid Control (or DBConsole) to count the metric related to audit sessions which is ON by default in 11g. To decrease the impact of this query you should purge the aud$ table regularly.
    Best way is to use DBMS_AUDIT_MGMT to periodically purge the data older than "whatever date". If you don't need the audit infor, you can simply truncate aud$.

  • PERFORMANCE PROBLEM - SYS OBJECTS

    Hi all,
    I'm having something strange here! The performance of queries that run against SYS objects like view DBA_OBJECTS , DBA_SEGMENTS, DBA_EXTENTS are VERY SLOWLY!! It's hang everytime and i need to kill the session and the PID process.
    One example is the following:
    SELECT owner, object_name, object_type FROM sys.all_objects
    WHERE object_type IN ('PACKAGE', 'PROCEDURE', 'SEQUENCE', 'TABLE', 'TYPE',
    'VIEW', 'FUNCTION') ORDER BY owner, object_name;
    The objects of schema SYS was analyzed recently.
    I have run the query with trace and nothing was found on that trace. The trace says the the query runs in few seconds but it didn't.
    Any help?
    Tks,
    Paulo Portugal

    Please take a look at the DBMS_XPLAN for the query to determine if there is a problem, and see if you are able to use DBA_OBJECTS rather than ALL_OBJECTS.
    For example, on one of my databases, querying ALL_OBJECTS:
    | Id  | Operation                                               | Name       | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    |*  1 |  TABLE ACCESS BY INDEX ROWID                            | SUM$       |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    |*  2 |   INDEX UNIQUE SCAN                                     | I_SUM$_1   |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    |   3 |  SORT ORDER BY                                          |            |      1 |    294 |   7329 |00:00:01.10 |     151K|   407K|   407K|  361K (0)|
    |*  4 |   FILTER                                                |            |      1 |        |   7329 |00:00:01.07 |     151K|       |       |          |
    |*  5 |    HASH JOIN                                            |            |      1 |  14668 |  14672 |00:00:00.09 |     196 |  1155K|  1155K| 1175K (0)|
    |   6 |     TABLE ACCESS FULL                                   | USER$      |      1 |    157 |    157 |00:00:00.01 |      15 |       |       |          |
    |*  7 |     TABLE ACCESS FULL                                   | OBJ$       |      1 |  14668 |  14672 |00:00:00.02 |     181 |       |       |          |
    |*  8 |    TABLE ACCESS BY INDEX ROWID                          | IND$       |   2575 |      1 |   2409 |00:00:00.04 |    5157 |       |       |          |
    |*  9 |     INDEX UNIQUE SCAN                                   | I_IND1     |   2575 |      1 |   2575 |00:00:00.02 |    2577 |       |       |          |
    |  10 |     NESTED LOOPS                                        |            |   9134 |     28 |   4291 |00:00:00.83 |     145K|       |       |          |
    |  11 |      FIXED TABLE FULL                                   | X$KZSRO    |   9134 |     26 |  68239 |00:00:00.13 |       0 |       |       |          |
    |* 12 |      INDEX RANGE SCAN                                   | I_OBJAUTH1 |  68239 |      1 |   4291 |00:00:00.55 |     145K|       |       |          |
    |* 13 |       FIXED TABLE FULL                                  | X$KZSPR    |      1 |     14 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 14 |        FIXED TABLE FULL                                 | X$KZSPR    |      1 |      6 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 15 |         FIXED TABLE FULL                                | X$KZSPR    |      1 |      3 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 16 |          FIXED TABLE FULL                               | X$KZSPR    |      1 |      3 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 17 |           FIXED TABLE FULL                              | X$KZSPR    |      1 |      3 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 18 |            FIXED TABLE FULL                             | X$KZSPR    |      1 |      6 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 19 |             FIXED TABLE FULL                            | X$KZSPR    |      1 |     11 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 20 |              FIXED TABLE FULL                           | X$KZSPR    |      1 |      3 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 21 |               FIXED TABLE FULL                          | X$KZSPR    |      0 |     14 |      0 |00:00:00.01 |       0 |       |       |          |
    |* 22 |                FIXED TABLE FULL                         | X$KZSPR    |      1 |     11 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 23 |                 FIXED TABLE FULL                        | X$KZSPR    |      1 |     11 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 24 |                  FIXED TABLE FULL                       | X$KZSPR    |      1 |      3 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 25 |                   FIXED TABLE FULL                      | X$KZSPR    |      1 |      3 |      0 |00:00:00.01 |       0 |       |       |          |
    |* 26 |                    FIXED TABLE FULL                     | X$KZSPR    |      1 |      6 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 27 |                     FIXED TABLE FULL                    | X$KZSPR    |      1 |     11 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 28 |                      FIXED TABLE FULL                   | X$KZSPR    |      1 |      6 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 29 |                       FIXED TABLE FULL                  | X$KZSPR    |      1 |      6 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 30 |                        FIXED TABLE FULL                 | X$KZSPR    |      1 |      6 |      1 |00:00:00.01 |       0 |       |       |          |
    |* 31 |                         FIXED TABLE FULL                | X$KZSPR    |      0 |     14 |      0 |00:00:00.01 |       0 |       |       |          |
    |* 32 |                          FIXED TABLE FULL               | X$KZSPR    |      0 |     11 |      0 |00:00:00.01 |       0 |       |       |          |
    |* 33 |                           FIXED TABLE FULL              | X$KZSPR    |      0 |      6 |      0 |00:00:00.01 |       0 |       |       |          |
    |  34 |                            VIEW                         |            |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    |  35 |                             FAST DUAL                   |            |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    |* 36 |                              TABLE ACCESS BY INDEX ROWID| SUM$       |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    |* 37 |                               INDEX UNIQUE SCAN         | I_SUM$_1   |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    Predicate Information (identified by operation id):
       1 - filter(BITAND("S"."XPFLAGS",8388608)=8388608)
       2 - access("S"."OBJ#"=:B1)
       4 - filter(((("O"."TYPE#"<>1 AND "O"."TYPE#"<>10) OR ("O"."TYPE#"=1 AND =1)) AND (INTERNAL_FUNCTION("O"."OWNER#") OR ("O"."TYPE#"<>11 AND
                  "O"."TYPE#"<>14 AND  IS NOT NULL) OR (INTERNAL_FUNCTION("O"."TYPE#") AND  IS NOT NULL) OR ("O"."TYPE#"=13 AND  IS NOT NULL) OR ("O"."TYPE#"=11 AND
                   IS NOT NULL) OR ("O"."TYPE#"=12 AND  IS NOT NULL) OR ("O"."TYPE#"=6 AND  IS NOT NULL) OR (INTERNAL_FUNCTION("O"."TYPE#") AND  IS NOT NULL) OR
                  ("O"."TYPE#"=22 AND  IS NOT NULL) OR ("O"."TYPE#"=14 AND  IS NOT NULL) OR INTERNAL_FUNCTION("O"."TYPE#") OR ("O"."TYPE#"=33 AND  IS NOT NULL) OR
                  ("O"."TYPE#"=46 AND  IS NOT NULL) OR ("O"."TYPE#"=62 AND  IS NOT NULL) OR ("O"."TYPE#"=66 AND  IS NOT NULL) OR ("O"."TYPE#"=48 AND  IS NOT NULL)
                  OR ("O"."TYPE#"=44 AND  IS NOT NULL) OR ("O"."TYPE#"=59 AND  IS NOT NULL) OR ("O"."TYPE#"=23 AND  IS NOT NULL) OR ("O"."TYPE#"=68 AND  IS NOT
                  NULL) OR (INTERNAL_FUNCTION("O"."TYPE#") AND  IS NOT NULL) OR ("O"."TYPE#"=42 AND  IS NOT NULL) OR ("O"."TYPE#"=32 AND  IS NOT NULL) OR
                  ("O"."TYPE#"=81 AND  IS NOT NULL) OR ("O"."TYPE#"=55 AND =1)) AND (DECODE("O"."TYPE#",0,'NEXT
                  OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTION',9,'PACKAGE',11,'PACKAGE
                  BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA
                  SOURCE',29,'JAVA CLASS',30,'JAVA RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB
                  SUBPARTITION',42,NVL(,'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER GROUP',55,'XML
                  SCHEMA',56,'JAVA DATA',57,'SECURITY PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB
                  CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='PACKAGE' OR DECODE("O"."TYPE#",0,'NEXT
                  OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTION',9,'PACKAGE',11,'PACKAGE
                  BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA
                  SOURCE',29,'JAVA CLASS',30,'JAVA RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB
                  SUBPARTITION',42,NVL(,'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER GROUP',55,'XML
                  SCHEMA',56,'JAVA DATA',57,'SECURITY PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB
                  CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='PROCEDURE' OR DECODE("O"."TYPE#",0,'NEXT
                  OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTION',9,'PACKAGE',11,'PACKAGE
                  BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA
                  SOURCE',29,'JAVA CLASS',30,'JAVA RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB
                  SUBPARTITION',42,NVL(,'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER GROUP',55,'XML
                  SCHEMA',56,'JAVA DATA',57,'SECURITY PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB
                  CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='SEQUENCE' OR DECODE("O"."TYPE#",0,'NEXT
                  OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTION',9,'PACKAGE',11,'PACKAGE
                  BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA
                  SOURCE',29,'JAVA CLASS',30,'JAVA RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB
                  SUBPARTITION',42,NVL(,'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT)
       5 - access("O"."OWNER#"="U"."USER#")
       7 - filter(("O"."NAME"<>'_NEXT_OBJECT' AND "O"."NAME"<>'_default_auditing_options_' AND "O"."LINKNAME" IS NULL))
       8 - filter(("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9))
       9 - access("I"."OBJ#"=:B1)
      12 - access("OBJ#"=:B1 AND "GRANTEE#"="KZSROROL")
           filter((INTERNAL_FUNCTION("PRIVILEGE#") AND "GRANTEE#"="KZSROROL"))
      13 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR (-"KZSPRPRV")=(-50)) AND
                  "INST_ID"=USERENV('INSTANCE')))
      14 - filter((((-"KZSPRPRV")=(-184) OR (-"KZSPRPRV")=(-181)) AND "INST_ID"=USERENV('INSTANCE')))
      15 - filter(((-"KZSPRPRV")=(-141) AND "INST_ID"=USERENV('INSTANCE')))
      16 - filter(((-"KZSPRPRV")=(-152) AND "INST_ID"=USERENV('INSTANCE')))
      17 - filter(((-"KZSPRPRV")=(-109) AND "INST_ID"=USERENV('INSTANCE')))
      18 - filter((((-"KZSPRPRV")=(-144) OR (-"KZSPRPRV")=(-141)) AND "INST_ID"=USERENV('INSTANCE')))
      19 - filter((((-"KZSPRPRV")=(-189) OR (-"KZSPRPRV")=(-190) OR (-"KZSPRPRV")=(-191) OR (-"KZSPRPRV")=(-192)) AND "INST_ID"=USERENV('INSTANCE')))
      20 - filter(((-"KZSPRPRV")=(-181) AND "INST_ID"=USERENV('INSTANCE')))
      21 - filter((((-"KZSPRPRV")=(-200) OR (-"KZSPRPRV")=(-201) OR (-"KZSPRPRV")=(-202) OR (-"KZSPRPRV")=(-203) OR (-"KZSPRPRV")=(-204)) AND
                  "INST_ID"=USERENV('INSTANCE')))
      22 - filter((((-"KZSPRPRV")=(-251) OR (-"KZSPRPRV")=(-252) OR (-"KZSPRPRV")=(-253) OR (-"KZSPRPRV")=(-254)) AND "INST_ID"=USERENV('INSTANCE')))
      23 - filter((((-"KZSPRPRV")=(-246) OR (-"KZSPRPRV")=(-247) OR (-"KZSPRPRV")=(-248) OR (-"KZSPRPRV")=(-249)) AND "INST_ID"=USERENV('INSTANCE')))
      24 - filter(((-"KZSPRPRV")=(-265) AND "INST_ID"=USERENV('INSTANCE')))
      25 - filter(((-"KZSPRPRV")=12 AND "INST_ID"=USERENV('INSTANCE')))
      26 - filter((((-"KZSPRPRV")=(-222) OR (-"KZSPRPRV")=(-223)) AND "INST_ID"=USERENV('INSTANCE')))
      27 - filter((((-"KZSPRPRV")=(-258) OR (-"KZSPRPRV")=(-259) OR (-"KZSPRPRV")=(-260) OR (-"KZSPRPRV")=(-261)) AND "INST_ID"=USERENV('INSTANCE')))
      28 - filter((((-"KZSPRPRV")=(-177) OR (-"KZSPRPRV")=(-178)) AND "INST_ID"=USERENV('INSTANCE')))
      29 - filter((((-"KZSPRPRV")=(-268) OR (-"KZSPRPRV")=(-267)) AND "INST_ID"=USERENV('INSTANCE')))
      30 - filter((((-"KZSPRPRV")=(-265) OR (-"KZSPRPRV")=(-266)) AND "INST_ID"=USERENV('INSTANCE')))
      31 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR (-"KZSPRPRV")=(-50)) AND
                  "INST_ID"=USERENV('INSTANCE')))
      32 - filter((((-"KZSPRPRV")=(-205) OR (-"KZSPRPRV")=(-206) OR (-"KZSPRPRV")=(-207) OR (-"KZSPRPRV")=(-208)) AND "INST_ID"=USERENV('INSTANCE')))
      33 - filter((((-"KZSPRPRV")=(-277) OR (-"KZSPRPRV")=(-278)) AND "INST_ID"=USERENV('INSTANCE')))
      36 - filter(BITAND("S"."XPFLAGS",8388608)=8388608)
      37 - access("S"."OBJ#"=:B1)Querying DBA_OBJECTS produces a much more compact plan that executes faster:
    | Id  | Operation                        | Name        | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    |   1 |  SORT ORDER BY                   |             |      1 |    814 |   7329 |00:00:00.24 |    5353 |   407K|   407K|  361K (0)|
    |   2 |   VIEW                           | DBA_OBJECTS |      1 |    814 |   7329 |00:00:00.21 |    5353 |       |       |          |
    |   3 |    UNION-ALL                     |             |      1 |        |   7329 |00:00:00.21 |    5353 |       |       |          |
    |*  4 |     FILTER                       |             |      1 |        |   7329 |00:00:00.19 |    5353 |       |       |          |
    |*  5 |      HASH JOIN                   |             |      1 |  14668 |  14672 |00:00:00.09 |     196 |  1155K|  1155K| 1209K (0)|
    |   6 |       TABLE ACCESS FULL          | USER$       |      1 |    157 |    157 |00:00:00.01 |      15 |       |       |          |
    |*  7 |       TABLE ACCESS FULL          | OBJ$        |      1 |  14668 |  14672 |00:00:00.03 |     181 |       |       |          |
    |*  8 |      TABLE ACCESS BY INDEX ROWID | IND$        |   2575 |      1 |   2409 |00:00:00.04 |    5157 |       |       |          |
    |*  9 |       INDEX UNIQUE SCAN          | I_IND1      |   2575 |      1 |   2575 |00:00:00.02 |    2577 |       |       |          |
    |* 10 |       TABLE ACCESS BY INDEX ROWID| SUM$        |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    |* 11 |        INDEX UNIQUE SCAN         | I_SUM$_1    |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    |* 12 |     FILTER                       |             |      1 |        |      0 |00:00:00.01 |       0 |       |       |          |
    |  13 |      NESTED LOOPS                |             |      0 |      5 |      0 |00:00:00.01 |       0 |       |       |          |
    |  14 |       INDEX FULL SCAN            | I_LINK1     |      0 |      5 |      0 |00:00:00.01 |       0 |       |       |          |
    |  15 |       TABLE ACCESS CLUSTER       | USER$       |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    |* 16 |        INDEX UNIQUE SCAN         | I_USER#     |      0 |      1 |      0 |00:00:00.01 |       0 |       |       |          |
    Predicate Information (identified by operation id):
       4 - filter(((("O"."TYPE#"<>1 AND "O"."TYPE#"<>10) OR ("O"."TYPE#"=1 AND =1)) AND (DECODE("O"."TYPE#",0,'NEXT
                  OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTION',9,'PACKAGE',11,'PACKAGE
                  BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX
                  PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA SOURCE',29,'JAVA CLASS',30,'JAVA
                  RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB
                  SUBPARTITION',42,NVL(,'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER
                  GROUP',51,'SUBSCRIPTION',52,'LOCATION',55,'XML SCHEMA',56,'JAVA DATA',57,'SECURITY
                  PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB
                  CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='PACKAGE' OR
                  DECODE("O"."TYPE#",0,'NEXT OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTIO
                  N',9,'PACKAGE',11,'PACKAGE BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX
                  PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA SOURCE',29,'JAVA CLASS',30,'JAVA
                  RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB
                  SUBPARTITION',42,NVL(,'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER
                  GROUP',51,'SUBSCRIPTION',52,'LOCATION',55,'XML SCHEMA',56,'JAVA DATA',57,'SECURITY
                  PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB
                  CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='PROCEDURE' OR
                  DECODE("O"."TYPE#",0,'NEXT OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTIO
                  N',9,'PACKAGE',11,'PACKAGE BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX
                  PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA SOURCE',29,'JAVA CLASS',30,'JAVA
                  RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB
                  SUBPARTITION',42,NVL(,'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER
                  GROUP',51,'SUBSCRIPTION',52,'LOCATION',55,'XML SCHEMA',56,'JAVA DATA',57,'SECURITY
                  PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB
                  CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='SEQUENCE' OR
                  DECODE("O"."TYPE#",0,'NEXT OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTIO
                  N',9,'PACKAGE',11,'PACKAGE BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX
                  PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA SOURCE',29,'JAVA CLASS',30,'JAVA
                  RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB
                  SUBPARTITION',42,NVL(,'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER
                  GROUP',51,'SUBSCRIPTION',52,'LOCATION',55,'XML SCHEMA',56,'JAVA DATA',57,'SECURITY
                  PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB
                  CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='TABLE' OR
                  DECODE("O"."TYPE#",0,'NEXT OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTIO
                  N',9,'PACKAGE',11,'PACKAGE BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX
                  PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA SOURCE',29,'JAVA CLASS',30,'JAVA
                  RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB
                  SUBPARTITION',42,NVL(,'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSU)
       5 - access("O"."OWNER#"="U"."USER#")
       7 - filter(("O"."NAME"<>'_NEXT_OBJECT' AND "O"."NAME"<>'_default_auditing_options_' AND "O"."LINKNAME" IS NULL))
       8 - filter(("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR
                  "I"."TYPE#"=9))
       9 - access("I"."OBJ#"=:B1)
      10 - filter(BITAND("S"."XPFLAGS",8388608)=8388608)
      11 - access("S"."OBJ#"=:B1)
      12 - filter('DATABASE LINK'='FUNCTION')
      16 - access("L"."OWNER#"="U"."USER#")Example of using DBMS_XPLAN to retrieve actual timing:
    http://jonathanlewis.wordpress.com/2006/11/09/dbms_xplan-in-10g/
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • Account to monitor performance without sys credentials?

    Hi folks!
    I want to achieve the option for non sys users to get performance information out of the EMGC.
    When they access the database and click on the performance link they will be asked for a username and password. I'm quite happy to create an db account that they can use (eg. perftestuser) but what priviledges does this account need in the database to get access to the relevant performance data that is displayed in the EMGC?
    Any help is welcome.
    cu
    Andreas

    Hi,
    we have the same 'problem' - a read-only user for all.
    We granted:
    ROLES : OEM_MONITOR + SELECT_CATALOG_ROLE
    SYSTEM PRIVILEGES: CREATE_SESSION
    that's enough.
    Best regards
    Andreas

Maybe you are looking for

  • Report on BEx query with 2 structures (one in rows and one in columns)

    Hi, experts! I have to make Crystall report on BEx query with 2 structures, one in columns (with KF's), and one in rows. Is it possible to create such report? Because when I create such report, I cant see fields in structures, only characteristics fi

  • Mail crashes trying to sync To Do items

    Can anyone solve a mail bug which is connected to the Apple Mail To Do Folder. I have one item that I have deleted a million times but it just keeps mutliplying when I try and receive email - and then the application crashes. Here is the crash log fo

  • Placing a ArchiCAD DXF into CS4 Illustrator

    Hi everyone, I am trying to open a DXF file into CS4 Illustrator but it's just not happening. The DXF is being provided by Graphisoft ArchiCAD. I've also been sent DXF files from autoCAD to test on to see if these open which also I'm afraid to say do

  • What version of photoshop should I get?

    I recently purchased a new computer (mac mini with cinema display) and I need to get photoshop. I previously had cs 5 but was illegally downloaded so i need to actually purchase the download this time. I am trying to figure out if I should do one of

  • Time Lapse import from GoPro

    My Gopro camera has a time-lapse option/feature that takes one photo every X seconds.  You can then import those photo stills onto your computer, which I have done.  For a 30 minute time-lapse "video," I've collected a little over 1000 stills and hav