How to get triggering sql text in a statement trigger
hi,
I need to get sql text that run on the table in statement trigger on that table. I will log sql statements that run on table for a few weeks. I search for it, there is a ORA_SQL_TEXT function but this function is working on event triggers not statement or for each row triggers.
is there any other way to achive that ?
You can use AUDIT
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_4007.htm#i2115972
>
Auditing Queries on a Table: Example To choose auditing for every SQL statement that queries the employees table in the schema hr, issue the following statement:
AUDIT SELECT
ON hr.employees;
To choose auditing for every statement that successfully queries the employees table in the schema hr, issue the following statement:
AUDIT SELECT
ON hr.employees
WHENEVER SUCCESSFUL;
To choose auditing for every statement that queries the employees table in the schema hr and results in an Oracle Database error, issue the following statement:
AUDIT SELECT
ON hr.employees
WHENEVER NOT SUCCESSFUL;
Auditing Inserts and Updates on a Table: Example To choose auditing for every statement that inserts or updates a row in the customers table in the schema oe, issue the following statement:
AUDIT INSERT, UPDATE
ON oe.customers;
Similar Messages
-
How to get offending SQL-Text from OracleException
Hi,
is there a way find out the SQL which was the reason for an OracleException ?
I try to connect to a Oracle RDB database via ODP.NET and a SQLNET-driver of Oracle RDB. During the connect a "table or view not found" error fires and stops the connect. Up to now i was not able to find out which object is missing here. I tried to use the trace feature but it does not show the SQL used inside the connect...
Regards
AndreasHi,
you are right, this table (view) was missing. I finally sniffered the ethernet to find out what ODP.NET is doing here. I posted the solution for RDB in the thread "Info: how to prepare Oracle RDB for ODP.NET".
Regards
Andreas -
Hi All,
How to get the physical SQL query for the OBIEE reports.
Thanks in advance,
Haree.Hi Anitha,
Thanks for your reply,
I am getting XML script in log file. (Settings > Administration > Manage Sessions > View Log).
How to get physical SQL query ?
Thanks,
Haree -
How to get Grand Total Text in ALV GRID
Hi Folks,
I am able to get the SUBTOTAL TEXT .....But i need...
How to get Grand Total Text in ALV GRID Display...
Can any one give a Solution for this...Hi Surendar,
Check out this code.. this is showing Total Text in Toal line in the very first column.
REPORT zsales_ord_det_1 .
TABLES: ztable_10.
TYPE-POOLS: slis.
DATA: BEGIN OF it OCCURS 0,
srno(6) type c,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it.
DATA : BEGIN OF it_temp OCCURS 0,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it_temp.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: v_repid LIKE sy-repid,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
gs_layout TYPE slis_layout_alv,
gd_layout TYPE slis_layout_alv,
i_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
START-OF-SELECTION.
v_repid = sy-repid.
SELECT * FROM ztable_10 INTO TABLE it_temp.
LOOP AT it_temp .
it-srno = 'Total'.
it-name = it_temp-name.
it-age = it_temp-age.
APPEND it.
ENDLOOP.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'IT'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = i_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
wa_fieldcat-row_pos = 1.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'SRNO'.
wa_fieldcat-tabname = it.
append wa_fieldcat to i_fieldcat.
LOOP AT i_fieldcat INTO wa_fieldcat.
IF wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-do_sum = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat.
ENDIF.
IF wa_fieldcat-fieldname = 'SRNO'.
Hide this field so that it can display it's content i.e.
Total text in Subtotal level
wa_fieldcat-tech = 'X'.
wa_fieldcat-no_out = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat TRANSPORTING tech no_out.
ENDIF.
ENDLOOP.
wa_sort-spos = 1.
wa_sort-fieldname = 'SRNO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort.
gd_layout-no_totalline = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = gd_layout
it_fieldcat = i_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = i_sort
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
Regards,
Seema -
How to get the short text in tcode "msc3n" -- Basic data 2 -- short text.
I have to display the short text in my report output.
How to get the short text in tcode "msc3n" ( msc3n --> Basic data 2 --> short text.)?
Is there any function module availble to get this short text or is this stored in any data base table ?
Please help me. Your help will be highly appreaciated.
THANKS.Hi,
Use FM 'READ_TEXT' to get this values.
Say for exampele my material is 1900001 and batch is 0000000517.
Then my parameters to the FM will be as follows:-
Text Name 000000000001900001 0000000517
Language EN
Text ID VERM
Text Object CHARGE
This information you can get as follows.
Open the short text window in the text editor.
Here you can enter the long text.
In the editor Go to Header and you will find the details.
Please note that the text name will comprise of
Material
Batch
Plant
Stor. Location
if all the details are given.
I hope this helps you.
Regards,
Ankur Parab -
How to get the bold texts in JTextPane?
How to get the bold texts in JTextPane?
I believe you need to look at the Elements of the Document. Use the Document.getDefaultRootElement() method to get the first root Element. From there you can iterate through all the Elements. You should then be able to check the attributes of the element to see if it contains the Bold attribute using something like:
AttributeSet attributes = element.getAttributes();
if ( attributes.containsAttribute(StyleConstants.Bold, Boolean.TRUE)
// do processing here -
How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"
How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"?
I have an install SQL scripts that creates a Linked Server. I want to put some security on the Linked Server and only grant the Agent Job Signon (the "Run As" or "Executed as User") access to the linked server. I need to retrieve the
Agent Job Signon (something like "NT SERVICE\SQLAgent$FIDEV360BI02").
I could query certain jobs and SUBSTRING the Message column - using some form of the query below, which would return "Executed as user: NT SERVICE\SQLAgent$SSDEVBI02. The step succeeded." But that is pretty imprecise.
use msdb
SELECT [JobName] = JOB.name,
[Step] = HIST.step_id,
[StepName] = HIST.step_name,
[Message] = HIST.message,
[Status] = CASE WHEN HIST.run_status = 0 THEN 'Failed'
WHEN HIST.run_status = 1 THEN 'Succeeded'
WHEN HIST.run_status = 2 THEN 'Retry'
WHEN HIST.run_status = 3 THEN 'Canceled'
END,
[RunDate] = HIST.run_date,
[RunTime] = HIST.run_time,
[Duration] = HIST.run_duration,
[Retries] = HIST.retries_attempted
FROM sysjobs JOB
INNER JOIN sysjobhistory HIST ON HIST.job_id = JOB.job_id
-- CHANGE THIS
-- WHERE JOB.name like '%GroupMaster%' or Job.name like '%etlv%'
ORDER BY HIST.run_date, HIST.run_timeby default all sql jobs are executed as sql server agent account, unless otherwise a proxy is setup.
you can get the proxy information as Olaf mentioned, if the proxy_id is null for the step, it implies that the job step was executed as sql server service account and in such case it will be null
so, if it is null, it ran as sql server agent account.
so, one work around is get the sql server agent service account and if the proxy is null, that means it ran as sql server agent account, so, use isnull function. the disadvantage would be if the sql server agent account was switched, you might not get the
accurate information as the new account will show up though the job really ran as old account, to get this information, you need to get this from the logmessage column as you mentioned above.
try this code...
/*from sql 2008r2 sp1, you get the service accounts using tsql,otherwise you have to query the registry keys*/
declare @sqlserveragentaccount varchar(2000)
select @sqlserveragentaccount= service_account
from sys.dm_server_services
where servicename like '%sql%server%agent%'
select message,isnull(name,@sqlserveragentaccount) as AccountName
from sysjobhistory a inner join sysjobsteps b
on a.step_id=b.step_id and a.job_id=b.job_id
left outer join sysproxies c on c.proxy_id=b.proxy_id
Hope it Helps!! -
HOW CAN GET BACK MY TEXT MSG & PICTURES DELETED
HOW CAN GET BACK MY TEXT MSG & PICTURES DELETED I REALY NEED
lilsimms1228 wrote:
How can I get an overview of old text messages and phone call [personal detail removed]
If you are the account owner, you can access the last year of calls records and the last three months of message summary (date, time, number texted, there is no where to see the text context) through your online account. Click on the HOME Tab once logged in and choose PRINT BILLS and then click on the pull down menu to choose any invoice for the last twelve months to view. -
How to get PO header text in PO list
Hi All,
Please let me know how to get PO header text in PO list.
Thanks,
AmaCheck this link for answer
PO Header Text -
How to get the Arabic text to speech on N8 ?
How to get the Arabic text to speech on N8 ?
Unfortunately it is not currently an available option:http://www.nokia.com/global/support/text-to-speech-s60-32-downloads/
Happy to have helped forum with a Support Ratio = 42.5 -
How to get the sql id and sql text for the pid which is completed.
Hi All,
I like to know how the get the details of sql_id and sql_text using the proecess which is completed already (ie., no more showing in the top command).
But I have the details of the process id.
Database name: 11g
os: sun os
thanks
Edited by: user9354175 on Nov 8, 2010 10:42 AMIf the session is still connected you might try this:
- query v$process where spid = os-process-number
- then join v$process to v$session using ADDR (in process) to PADDR (in session)
- then look at PREV_SQL_ID in v$session.
- use that to get the SQL_TEXT in for instance V$SQLAREA.
Could work, if all info is still in the SGA... -
How to get the SQL queries based on SQL_ID.
Hi Experts,
I want to get the SQL queries based on SQL_ID.
I have tried the following query,but I am not getting full query.
[code]SET linesize 132 pagesize 999
column sql_fulltext format a60 word_wrap
break on sql_text skip 1
SELECT REPLACE (TRANSLATE (sql_text, '0123456789', '999999999'), '9', ''),sql_id
FROM dba_hist_sqltext s
WHERE s.sql_id = '7tvurftg8zryb';[/code]
One of my friend said use grid to get full query text.
Can you please help me how to use grid ,else any other method to get the full query based on SQL_ID.
Please help me.
Thanks in advance.You have these many options to set, if sql_text is really huge. But better use a tool(TOAD) as it's really helpful and easy to use instead! (See my previous comment).
column sql_text format A10000
set echo off
set head off
set feed off
set verify off
set termout off
set lines 10000
set long 1000000
set trimspool on
set pages 0
Thanks! -
I cannot figure how to get the text(SQL statement) from a system view(i guess it is in a system view... but witch??). 'Till now i have the sql_address and the sql_hash_value..
I know it is possible.. EM does it ... so i should be able to do the same..
ps:I use 9.2v$sql ?
-
How to get tab delimited text file when Stored Procedure executes ?
Hello Everyone,
I have a stored procedure which returns 1 result set as an output.
I want the output as a Tab Delimited Text file.
I know that I can use SSIS and get the same output but I am not allowed to use SSIS in this case.
Is there any other ways ?
I will be really appreciate If someone can answer with, How many different ways I can get Tab delimited text file ?
Thanks in advance
Henaryyou can do that by using SQLCMD
http://blog.sqlauthority.com/2013/03/05/sql-server-exporting-query-results-to-csv-using-sqlcmd/
you can also use BCP
EXEC master..xp_cmdshell 'bcp "select * from tempdb.dbo.orders" queryout "c:\output.txt" -c -T'
EXEC master..xp_cmdshell 'bcp "exec usertest.dbo.proctest" queryout "c:\output.txt" -c -T'
--Prashanth -
How to get a SQL statement that trigerred a trigger ?
I'd like to trace all insert and update operations done on a table.
So, how can I get the SQL statement that triggered a trigger ?
ThanksUse AUDIT to trace all sql statement about table, views etc. (except column) :
http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_4007.htm#SQLRF01107
Or, if you are in 9i or later, you can use DBMS_FGA (you can audit just a column) :
http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10802/d_fga.htm#ARPLS015
Nicolas.
Maybe you are looking for
-
Preview is saving all files viewed while online
I am having several problems with Preview because it saves every single file I view while online, and while conducting research, this ends up being literally hundred of .pdfs some days. How do I turn off this automatic save function? Is it just a gli
-
Version: SQL Developer (3.0.02) I found 2 bugs. There is a bug in the User Defined Reports. When I add a new report, it ask me to select a db connection. The connection was created, but it did not show in the Connection. Same the bug are in the Quick
-
Wiki: how do I create a new user?
Yes, I know, it sounds silly, but I can't create a user in the ArchLinux Wiki at all. Could somebody who succeded tell me how to do this? I've tried "IceRAM" & "iceram" as usernames & empty password, didn't work.
-
Third Party SCORM Adapter 2004 with Oracle Learning Management
Need to integrate third party SCORM 2004 3rd edition compliance vendor with Oracle Learning Management (R12.1.3). Can anyone help in providing the steps to proceed and prerequisite required from Oracle and Third vendor. regards, Arunachalam
-
How to best arc image without distortion to fit curved cup template?
I have tried searching forum for this and I know it has been discussed before but not really finding what I need to do correctly. I have attached the layered image (reducing opacity so you can both template and image). The vendor provided me a flat