Extended Events: How to capture DML on a specific table

I want to capture Select/Insert/Update/Delete commands on a specific table, lets say - dbo.MyTbl.
I can use extended events to analyze the completed TSQL commands in order to find dbo.MyTbl or [dbo].[MyTbl] (I assume the schema is always mentioned explicitly). The problem is that the table could be accessed through a view, and it won't be mentioned explicitly
in the TSQL command.
Is there a way to solve this problem through Extended Events, or a better solution for such a problem?
El castellano no es mi lengua materna. Discúlpenme por los errores gramaticales, y, si pueden, corríjanme en los comentarios, o por correo electrónico. ¡Muchas gracias! Blog: http://about.me/GeriReshef

Seems like you are looking for the Server Audit funtionality. It requires certain versions/editions. Server Audit is implemented using Extended Events but the underlying X/E mechanisms that Server Audit is using isn't directly available throuh X/E.
Tibor Karaszi, SQL Server MVP |
web | blog

Similar Messages

  • Designing principle of auditing the DML on a specific table?

    Hi All,
    What is the designing principle of auditing the DML performed on a table? or a bunch of tables?
    I know Oracle provides the auditing capability and there is Fine-Grained auditing available to use to keep track of row/column level changes.
    However, in this case, since we want to keep all the changing history of the table, and we want to do it our own way, we don`t want to use the Oracle`s FGA.
    the scenario is:
    I have a table with 40 columns, and any one of them might be updated, including the primary key. (it sucks and bad)
    we want to keep track of all the changes performed on this table, mainly DML.
    the table structure I came up with is as below and it doesn`t look good or feel right.
    So, could you share some experiences of how your design the table in this scenario? and the basic principle or rule to follow?
    CREATE TABLE TBS (COL1 VARCHAR2(10), COL2 VARCHAR2(20), COL3 VARCHAR2(20), COL4 VARCHAR2(30)....., COL40 VARCHAR2(50));
    CREATE TABLE tbs_audit (
    SEQ_NUM NUMBER,
    USER_NAME VARCHAR2(50),
    UPD_DT TIMESTAMP,
    OPERATION_TYPE VARCHAR2(20),
    COL1_OLD_VAL VARCHAR2(10),
    COL2_OLD_VAL VARCHAR2(20),
    COL40_OLD_VAL VARCHAR2(50));Thanks in advance!

    I would definitely put the auditing records into another table.
    What I am struggling with is:
    whether should I record the changed columns only or the whole row? to me, the first one is better. it saves space, and it comes easy when I want to display the changed history of certain columns.
    And for the first one, should I use table structure like 1) or 2)? which one is better? why?
    1)
    CREATE TABLE tbs_audit (
    SEQ_NUM NUMBER,
    USER_NAME VARCHAR2(50),
    UPD_DT TIMESTAMP,
    OPERATION_TYPE VARCHAR2(20),
    COL1_OLD_VAL VARCHAR2(10),
    COL2_OLD_VAL VARCHAR2(20),
    COL40_OLD_VAL VARCHAR2(50));
    2)
    CREATE TABLE tbs_audit (
    SEQ_NUM NUMBER,
    USER_NAME VARCHAR2(50),
    UPD_DT TIMESTAMP,
    OPERATION_TYPE VARCHAR2(20),
    COL_name VARCHAR2(10),
    COL_OLD_VAL VARCHAR2(20)
    );

  • How to access ( DML) not a source table?

    Hello,
    I created a form ( using wizard ) based on the table.
    I want to insert into another table based on the button. I'm playing around with the "Automatic Row Processing (DML)" process "source table".
    And this is what i'm getting:
    0.03: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.03: Branch point: BEFORE_COMPUTATION
    0.03: Computation point: AFTER_SUBMIT
    0.03: Tabs: Perform Branching for Tab Requests
    0.03: Branch point: BEFORE_VALIDATION
    0.03: Perform validations:
    0.03: ...Item Not Null Validation: P19_APPL_BUSINESS_AREA
    0.03: ...Item Not Null Validation: P19_APPL_SERVER
    0.03: ...Item Not Null Validation: P19_NSM_SUPPORT_LEVEL
    0.03: ...Item Not Null Validation: P19_ENV_TYPE
    0.03: ...Item Not Null Validation: P19_BACKUP
    0.03: ...Item Not Null Validation: P19_PUBL_MAILING_LST
    0.03: ...Item Not Null Validation: P19_BUSINESS_REQS
    0.03: Branch point: BEFORE_PROCESSING
    0.03: Processing point: AFTER_SUBMIT
    0.03: ...Process "insert_tmp": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:tmp_guidebook:P19_ID:ID|I
    0.03: Show ERROR page...
    0.03: Performing rollback...
              "MYUSER_ID HERE"
    ORA-20513: Invalid action SAVE on this object. (I)
         Error      ORA-20513: Invalid action SAVE on this object. (I)
    I'm very confused with the error message, since i 3-ple check the table. and the "delete" process on the *source* table works fine.
    Please help.
    I also found Andy's post suggesting to create an PL/SQL routine and call it by "on submit" event.
    http://forums.oracle.com/forums/thread.jspa?threadID=825248&start=15&tstart=0
    Just curious if it's possible to make this action using standard form wo going with Andy's suggestion.
    Please advise.
    Andrew

    Andy, thank you.
    It works now.
    A quick ( hopefully ) follow up question :
    once i inserted the row, i want to remove that row from the source table.
    right now i have unconditional process , but it's failing.
    See here:
    0.03: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.03: Branch point: BEFORE_COMPUTATION
    0.03: Computation point: AFTER_SUBMIT
    0.03: Tabs: Perform Branching for Tab Requests
    0.03: Branch point: BEFORE_VALIDATION
    0.03: Perform validations:
    0.03: ...Item Not Null Validation: P19_APPL_BUSINESS_AREA
    0.03: ...Item Not Null Validation: P19_APPL_SERVER
    0.03: ...Item Not Null Validation: P19_NSM_SUPPORT_LEVEL
    0.03: ...Item Not Null Validation: P19_ENV_TYPE
    0.03: ...Item Not Null Validation: P19_BACKUP
    0.03: ...Item Not Null Validation: P19_PUBL_MAILING_LST
    0.03: ...Item Not Null Validation: P19_BUSINESS_REQS
    0.03: Branch point: BEFORE_PROCESSING
    0.03: Processing point: AFTER_SUBMIT
    0.03: ...Process "Insert_Approved_GB_Process": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:TMP_GUIDEBOOK:P19_ID:ID|I
    0.05: ...Session State: Save "P19_ID" - saving same value: "44"
    0.05: ...Process "Delete_process": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:GB_PENDING_RQST:P19_ID:ID|D
    0.05: Show ERROR page...
    0.05: Performing rollback...
              "My user id here"
    Request id = 44 has been approved
    ORA-20512: Invalid action SAVE on this object. (D)
         Error      ORA-20512: Invalid action SAVE on this object. (D)
    OK      
    And the processes are defined on the page :
    Processes     Edit AllCopyCreate
    After Submit
    20     Insert_Approved_GB_Process     Automatic Row Processing (DML)     Conditional
    30     Delete_process     Automatic Row Processing (DML)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Conditional
    I'm implying that the "delete" should only occur if "insert" was successful ...
    ..And, to make life interesting, i have a button "Delete" that invokes the delete process to explicitly remove the row from the source table.
    thank you
    Andrew
    Edited by: andrey on Dec 11, 2008 10:35 AM

  • How to perform DML Operations on Spatial Table Using ADF

    Hi
    I have an urgent requirement. I have a table with Spatial column. I have generated Business components based on Spatial Table.
    Now I have to perform Create,Read,Update and Delete operations using ADF Business Components on Spatial Table.
    I have written custom create(),read(),update() and delete() methods in my Application Module and i have to implement those methods.
    Can any one help me out how to acheive above four functionalities using ADF Business Components.
    Thanks in Advance

    HI,
    see this example.
    u can do like this.
    DATA: BEGIN OF seats OCCURS 0,
            carrid   TYPE sflight-carrid,
            connid   TYPE sflight-connid,
            seatsocc TYPE sflight-seatsocc,
          END OF seats.
    DATA seats_tab LIKE HASHED TABLE OF seats
                   WITH UNIQUE KEY carrid connid with header line.
    SELECT carrid connid seatsocc
           FROM sflight
           INTO table seats.
    loop at seats.
      COLLECT seats INTO seats_tab.
    endloop.
    LOOP AT seats_tab.
    write:/ seats_tab-carrid,seats_tab-connid,seats_tab-seatsocc.
    ENDLOOP.
    rgds,
    bharat.

  • How add capture schema level to existing table level capture

    I have setup Oracle Streams 2 databases( oracle 10.2.0.4 windows 2003) 2-way replication. Database A capture 55 tables and database B capture 32 tables from same schema.
    I need add one more database C (oracle 11.1.0.7 rac windows 2003); replicate whole schema level from database A;
    What sould I do?
    Add new schema level capture process on database A?
    Can I drop current capture table level on database A and create schema level capture and use different propagation?
    Please help

    Better use 2 differents captures and 2 differents propagations, specially since on the of the capture is bi-directional.
    When troubles will come, you will be happy of this separation, Also if something special is requested, you will be confortable with the implementation and sure that no side effects on the other capture. But the ease of maintenance, the different FIRST_SCN, will make your life better.
    Remember that a propagation that goes always from A-->B, you can remove the rule set. In this case everything that enter A goes to B.
    So is it better to do
    A -> rules  |-----> B
                 |-----> Cor not proagation rules :
        A ---> B
        A ---> CI vote for the second.

  • How to capture consecutive records in a table

    i need some help in writing a sql server, this is what i am trying to achieve.
    this is the sample of the data
    Employee WDate                   Hours
    1004     2014-01-01 00:00:00.000 8
    1004     2014-01-02 00:00:00.000 8
    1004     2014-01-08 00:00:00.000 8
    1004     2014-01-09 00:00:00.000 8
    1004     2014-01-11 00:00:00.000 8
    1004     2014-01-12 00:00:00.000 3
    1004     2014-01-15 00:00:00.000 3
    the result i am expecting are:
    Employee WDate                   Hours
    1004     2014-01-01 00:00:00.000 8
    1004     2014-01-02 00:00:00.000 8
    1004     2014-01-08 00:00:00.000 8
    1004     2014-01-09 00:00:00.000 8
    Thanks in advance

    Hi,
    thanks for the response, it works with one employee but when i use with all employees i am not getting the right results. Please check the example below.
    Create table #test(Employee int, WDate        datetime, Hours int)
    insert into #test values (1001,'2014-01-01 00:00:00.000',4)
    insert into #test values (1001,'2014-01-02 00:00:00.000',6)
    insert into #test values (1001,'2014-01-03 00:00:00.000',6)
    insert into #test values (1001,'2014-01-04 00:00:00.000',6)
    insert into #test values (1001,'2014-01-05 00:00:00.000',7)
    insert into #test values (1001,'2014-01-06 00:00:00.000',5)
    insert into #test values (1001,'2014-01-07 00:00:00.000',6)
    insert into #test values (1001,'2014-05-12 00:00:00.000',3)
    insert into #test values (1004,'2014-01-01 00:00:00.000',8)
    insert into #test values (1004,'2014-01-02 00:00:00.000',8)
    insert into #test values (1004,'2014-01-08 00:00:00.000',8)
    insert into #test values (1004,'2014-01-09 00:00:00.000',8)
    insert into #test values (1004,'2014-01-11 00:00:00.000',8)
    insert into #test values (1004,'2014-01-12 00:00:00.000',3)
    insert into #test values (1004,'2014-01-15 00:00:00.000',3)
     select C.Employee,C.WDate,C.Hours  from (
     select *,  (select MIN(WDate) from #test B where A.Employee=B.Employee and A.Hours=B.Hours
     and B.WDate>A.WDate) [nextwdate]
     , (select max(WDate) from #test B where A.Employee=B.Employee and A.Hours=B.Hours
     and B.WDate<A.WDate) [previouswdate]
        from #test A) C
        where ( Datediff(day,C.WDate,C.nextwdate)=1 OR Datediff(day,C.[previouswdate],C.WDate)=1 )
    Output: (as you can see it is missing information on Jan 1, Jan 5 - 7 for employee 1001 and some rows are also missing employee 1004)
    Employee    WDate                   Hours
    1001        2014-01-02 00:00:00.000 6
    1001        2014-01-03 00:00:00.000 6
    1001        2014-01-04 00:00:00.000 6
    1004        2014-01-01 00:00:00.000 8
    1004        2014-01-02 00:00:00.000 8
    1004        2014-01-08 00:00:00.000 8
    1004        2014-01-09 00:00:00.000 8

  • SQL Server 2000 auditing/tracking DML changes on specific tables.

    Hello,
    We would like to audit/track all DML activities on couple of tables which reside on SQL Server 2000. Triggers are an option we think but thought that would impact performance because of activity on those tables. Could someone please suggest any other best
    options that are possible with SQL Server 2000 to capture these changes.
    Thanks,

    Hello,
    You may consider third party tools that may still support SQL Server 2000. The following tool supported SQL Server 2000 a few years
    ago, not sure about today:
    http://www.apexsql.com/sql_tools_comply.aspx
    Server side traces may be another option:
    http://msdn.microsoft.com/en-us/library/cc293613.aspx
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • How to find modules using a specific table in Designer 10g?

    Hi, we are in a conversion traject from Designer 6.0 to Designer 10g with patchset 10.1.2.5.
    Apart from a conversion problem for which we got a workaround (see bug number 8453702) it looks ok now.
    But with functional testing I found something strange:
    - in Des10g, when you look at the usages of a table, you do not see the "Used in Module Components" part anymore. That is pretty annoying. Now I found a way to show something with aid of the matrix diagrammer, but i'm not very happy with it.
    My questions:
    - How come this has changed? and
    - is there another way to quickly view these usages, or are we stuck with this?
    Regards, Paul.

    Hello
    Go to the repository object navigator. Go to the table definitions --> usages --> Used in sql query sets
    Regards Erik

  • How to capture multiple change in webDynPro(ABAP) Table

    Hi ,
    I would like to know 'How to Capture Multiple Change' of a node . For example , a table is bound to a node and I select Multiple entries in the table . Then, how to capture Multiple entries of the table  . Is there any method ?
    There is a method 'GET_CONTEXT_CHANGE_LOG' of 'if_wd_context' which captures single change of the node .
    Regards
    Sid

    Post this in Webdynpro forum at
    Web Dynpro Java
    have you seen these tutorials.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783
    Regards
    Raja

  • How to capture Flash SWC events?

    Can someone point me in the right direction on how to capture an event from a Flash SWC in Flex?
    Scenario:
    I have an animated gameboard that I built in Flash. Nothing fancy, just a simple tile game where you select a tile, click it and it flips over to reveal something.
    I've managed to export a SWC, and get it to display just dandy in my Flex project, but I cannot figure out how to get Flex to capture and respond to any type of event... custom or predefined (such as MouseEvent.CLICK) when clicking one of the tiles in the swc.
    I've done quite a bit of googling but I'm cross-eyed at this point and could use some expert direction.
    Thanks in advance.
    JL

    Hi Alex,
    After further research, I've found some answers to my questions, but I've encountered a related obsticle.
    I finally stumbled upon the Flex 3 Component Kit documentation, and on page 9 of that document, it describes in detail an example of adding custom events.
    To summarize, my related obsticle this:
    I created a simple MovieClip symbol in Flash (named "My Circle").
    I created a simple external class mimicing the example code in the Flex 3 Component Kit documentation (named "MyCircle.as") which extends mx.flash.UIMovieClip
    The .fla containing the MovieClip symbol "My Circle" and the external class "MyCircle.as" reside in the same directory
    In Flash I convert the symbol "My Circle" to a Flex component and verify that the class is "MyCircle" and there is no base class
    I export the now converted MovieClip as a .swc file
    In my Flex project, I add MyCircle.swc to the Library path
    In my Flex project source I add an instance of MyCircle as <local:MyCircle id="my_circle" />
    Switching to Design view in my Flex project I don't see anything. I refresh design view and still do not see a graphic representation of my .swc file. There are no errors or warnings
    Using the Outline, I select the instance of MyCircle and discover that it is indeed on the stage, but it's bounding box dimensions are essentially zero. It seems there is no image in the swc.
    Returning to Flash, I duplicated the MovieClip symbol, renamed it to "My Circle No External Class", and converted it to a Flex component. I also verified that this new component had a class name of "MyCircleNoExternalClass" and had a base class of mx.flash.UIMovieClip.
    Following the above proceedure to correctly link it to my Flex project's Library path and adding an instance of <local:MyCircleNoExternalClass /> to the source, the .swc file show's up beautifully.
    So, why would adding an external class file (with the ultimate goal of being able to dispatch custom events) cause the contents of the MovieClip itself to not be included in the .swc?
    Again, I'm following the example on page 9 of the Flex 3 Component Kit documentation and using the Flex 3.3 SDK.

  • How to capture show layer and hide layer event in photoshop through a plugin???

    How to capture show layer and hide layer event in photoshop through a plugin???for mac

    Use the Listener plug-in found in the SDK to see how you can monitor the show/hide layer event. You can also use the Getter plug-in to show what information you can find out about the current state of Photoshop.

  • How to capture the current info in the top-of-page event in Reuse block dis

    How to capture the current info in the top-of-page event in Reuse block dis

    Hi Geetha,
         If you don't have any information to pass the Heading Block, then why you are using this event ?
         please comment/ remove that TOP_OF_PAGE code. and use subtotal code in field catalog block.
          you can use below code for subtotal. 
          FORM field_catalog .
                    gs_fcat-do_sum = &2.
              fcat : 'WRBTR' '15' 'X' ' ' ' ' 'WRBTR' 'Amount',
           ENDFORM.
           Regards,
           Kunjan

  • How to capture the event in ALV grid display?

    Hi experts,
      How to capture the event in an ALV grid display which is editable. I have to capture the TAB key or ENTER key.
    regards,
    Arul Jothi.

    Hi Arul,
    Take a look at sample program BCALV_EDIT_03. (Find string "register ENTER" in the program to see how to register)
    Basically you have to Register edit events using method call REGISTER_EDIT_EVENT and then write a handler method for event DATA_CHANGED..
    If you are using a REUSE..GRID fm then first get the grid reference using function module GET_GLOBALS_FROM_SLVC_FULLSCR and then repeat the above procedure..
    Hope this helps..
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • JComboBox: how to capture the internal list  events?

    Hi
    Does anybody know how to capture JComboBox internal list events, what I mean
    is when I click the box arrow button a list of the items pops up and as you move the mouse inside that list up and down, an items gets highlighted.
    So I am interested in capturing those events - basically when the next item from the list is highlighted.
    Thanks

    You can add an item listener to the combo box for that. IIRC, your listener will get
    notified twice: once for the deselection of the previous item, and once for the new
    item's selection.
    : jay

  • Best Way to Capture Stored Procedure Calls through Extended Events?

    I am trying implement Real Simple Solution for Database Monitoring:
    If any of the RPC Calls takes more than 200 milliseconds or more than 10K Reads , I want to compile the list on daily basis and sent out an email to our team. We usually did that through RPC Completed event through Profiler.
    We want to Implement the same through Extended Events but SQL Text is not being captured because we are using SQL Server 2008 R2.
    Whats the best way with Extended Events to Capture:
    RPC Calls with Parameters and Values and Reads, Writes, CPU and Query HASH.
    What we currently have is :
    Has anyone done this using SQL Server 2008 R2 and  please let me know.
    IF EXISTS(SELECT * FROM sys.server_event_sessions WHERE name='LongRunningQueries')
    DROP EVENT SESSION [LongRunningQueries] ON SERVER;
    CREATE EVENT SESSION [LongRunningQueries]
    ON SERVER
    ADD EVENT sqlserver.module_end(
    ACTION (sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.database_id, sqlserver.plan_handle, sqlserver.session_id, sqlserver.sql_text, sqlserver.tsql_stack, sqlserver.username)),
    ADD EVENT sqlserver.rpc_completed(
    ACTION (sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.database_id, sqlserver.session_id, sqlserver.sql_text, sqlserver.username)),
    ADD EVENT sqlserver.sp_statement_completed(
    ACTION (sqlserver.client_app_name, sqlserver.session_id))
    ADD TARGET package0.asynchronous_file_target(
    SET filename='G:\LongRunningQueries.xet', metadatafile='G:\LongRunningQueries.xem')
    WITH (MAX_MEMORY = 4096KB, EVENT_RETENTION_MODE = ALLOW_MULTIPLE_EVENT_LOSS, MAX_DISPATCH_LATENCY = 300 SECONDS, MAX_EVENT_SIZE = 0KB, MEMORY_PARTITION_MODE = NONE, TRACK_CAUSALITY = ON, STARTUP_STATE = ON)
    ALTER EVENT SESSION [LongRunningQueries] ON SERVER STATE = START
    I90Runner

    Hello,
    Please read the following resource.
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d6d51f6e-c01b-4880-abb2-4f0cfd1f4531/extended-event-trace-on-event-rpccompleted-not-capturing-sqltext-action-unable-to-retrieve-sql?forum=sqldatabaseengine
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

Maybe you are looking for

  • Make an object vanish in Flash CS4 (AS3.0)

    I have a question on how i can remove an object when two objects hit. I have two objects on the stage overlapping. object #1 = character_mc object #2 = vanish_mc I want to make it so that the object #2 (vanish_mc) will vanish once i run it. I have th

  • Oracle 9i Update problem

    Hi, i�ve the following problem using an oracle 9i database import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.OutputStream; import java.io.IOException; import java.sql.*; public class prueba publ

  • 6280 best way to save media?

    I have recently bought the 6280 and was told it had a decent media player. So far I can only save 7 mp3 files so Im guessing Im doing something wrong! Do I have to convert them into a diferent type of file? Also I got this on '3' an it came with no g

  • Cells in SAP BW Query u2013 possible to use in Crystal Reports ?

    Hello Experts, we have the following scenario: - Crystal Reports Report (CRR) on top of a SAP BW Query which uses cells It seems that we cannot access the cells in Crystal Reports. Or does anyone know a way how to work with the cells ? Many thanks in

  • I have a serial number for cs6 13.0 from my company but I can't find the link to download it

    Does anybody have that link or know where I can find it?