See history of SQL text

Dear all,

I have a sql id and I want to know when this query ran the last time.

BR.

Mustafa

Unless you have the appropriate level of active audit, there is no guaranteed way to know.

ASH data are a sample of current session - V$ ACTIVE_SESSION_HISTORY is once per second, DBA_HIST_ACTIVE_SESS_HISTORY every 10 seconds.

There is also a limit retention, V$ being a buffer in memory, the table DBA_ being in the AWR repository for a default of 8 days.

So, if the statement is long, you

If the last SQL execution is always in memory - V$ SQL - and then you get lucky.

Similarly, if it's heavy hitting then AWR via DBA_HIST_SQLSTAT can tell you in what AWR Snapper window he was executed.

Tags: Database

Similar Questions

  • How to see all the sql on sql statements commands under 'history' link

    Hi all

    How to see the history of sql on sql commands tab.
    I want to see all the sql statements.
    Where we set if we need to store more sql statements in history.
    We use Apex3.2 and 10g (EE) database.

    Thank you
    Nr

    Is there a limitation to the Apex 3.2, there are only 200 files...

    Not sure about this, as I said earlier, the report is configured to display a maximum of 1,000 records, perhaps during the in-house data entry in the apex, she could to check something. In any case, all these are an internal feature and is not supposed to be "messed" with and could lead to no support.

    Your alternative uses the same method I proposed, and you can query manually (after granting dba) table of APEX_040000.wwv_flow_sw_sql_cmds or even do a report in your application with a csv export.

  • History of SQL do not sort by date; new format of TS v4?

    I was afraid that my history of SQL was not accumulating after upgrade, as it seemed not as I expected.


    I generally sort descending timestamp, but I find that hold since the installation of the version 4.0 production this different format of timestamp on the history of SQL took, ignoring the NLS settings that I put in my preferences (which were not those default to my territory and language, incidentally).

    I migrated all my settings from the previous installation, I had... .sqldev4 ea3.  previous migrations from v3 to v4 ea1 to v4 ai2 to v4 ea3 ever disturbed my history of SQL.

    Now my recent entries are buried in the history of SQL and show no longer on top, and sorting by date seems erratic, it is impossible to see a chronological order of the executed SQLs before and after migration.

    Y at - it shaped a command to put the SQL history timestamps or I have to go spelunking in the xml files to change a setting?

    Curiously,.

    Steve

    Toolmakers were the question ID and he set our next update.

  • Shows SQL ID, OEM, but says: * SQL text not available *.

    I'm a bit confused on this and was hoping that someone can help you.

    I use DBConsole to an Oracle 11.2 (on Solaris 10) database.

    I see really high momentary ' * + tips + * ' in an activity greater than about 20 to 30 minute intervals.
    When I try to understand which SQL is causing the Spike, I drag the section shaded the area containing the Spike and look at all the SQL statements during this period.
    I first try to look the SQL statements by highlighting, or by clicking on the entries in the column of ID of SQL in SQL from the top (bottom left of the page).
    Then I copy and paste the statements in my sqlplus session and see if it causes any sort of spike that I followed in another window OEM looking at key activities.
    Usually, I don't not even a blip on the radar, so I'm not find the SQL statement that causes the spikes.
    Sometimes, however, when I hover over an ID of SQL, it does not show the SQL statement and instead of it shows just the words: [SQL ID].

    Then, I run a report of ASH for the 5 minute window of the shaded area containing the Spike.
    When I look at the "full list of SQL text" ASH report, I found an entry or the Scriptures have to say: * SQL text not available *.

    So then I try to select sql_text from v$ sqlarea where sql_id = «...» "(whatever this sql_id is), and I get no rows found.
    for example,.
    SQL> select sql_text from v$sqlarea where sql_id = '99mjdv0hkh5km';
    
    no rows selected
    In fact, when I try other sql_id, I don't get them either and I guess that's because they are already old v $ sqlarea.
    If I check the v$ sqlarea for up-to-date notifications, they work fine.
    So, the first thing, what controls the duration of v$ sqlarea (pool size)?

    Then I chose to DBA_HIST_ACTIVE_SESS_HISTORY and it displays the information related to the ID of SQL, but of course, it does not show the sql text.
      1* select * from DBA_HIST_ACTIVE_SESS_HISTORY where sql_id = '99mjdv0hkh5km'
    SQL> /
    
    ---------------------------------------------------------------------------------------------------------------------------------------------------
         19242 1311231241               1   68759345
    21-MAR-13 07.24.50.524 AM                                                          394            2337 FOREGROUND
            16         65 99mjdv0hkh5km Y                0          3
    SELECT                                                                         6.2052E+18 99mjdv0hkh5km
                       3          2792326754                4
    TABLE ACCESS
    FULL                                                                16777216 21-MAR-2013 07:24
    Note above FULL TABLE SCAN. That's what I'm trying to dig into who I think is the culprit causing the spikes.

    If your application uses literals, SQL is simply disappeared from sqlarea until you know.

    Although it will certainly be when it is running, then maybe you should look at the right time :)

    the alternative is a 10046 trace to capture the SQL...

  • I need to transfer my history of the text and images from my old iPhone to my new iPhone, but have already moved all other data to my new phone via iTunes and spent time to organize.  How do I reset this transfer without any?

    I need to transfer my history of the text and images from my old iPhone to my new iPhone, but have already moved all other data to my new phone via iTunes and spent time to organize.  How do I reset this transfer without any?  I transfer a 5s to itself.

    For your photos, try importing them to your computer and their synchronization then back to the SE.

    Import photos and videos from your iPhone, iPad or iPod touch - Apple Support

    For your texts, they moved with the backup restore?

  • OracleException "ORA-01008: not all variables ' what SQL text contains both '-'and':'

    We have stumbled into what seems to be a similar bug as @user4111944 and Alex Keh - Product Manager-Oracle in ManagedDataAccess - bug in the drive when you use '-'and':' SQL text .


    We use Oracle.ManagedDataAccess v. 12.1.2400 (last NuGet package) and get an OracleException with the message


    ORA-01008: not all variables


    When we try to run the following code:


    var l_connectionString = "a connection string.

    var l_commandText = "UPDATE table_test SET col_description = '-test', col_time =: param WHERE col_id = 42 ';

    using (IDbConnection l_connection = new Oracle.ManagedDataAccess.Client.OracleConnection(l_connectionString))

    {

    l_connection. Open();

    var l_command is l_connection. CreateCommand();

    l_command.CommandText = l_commandText;

    var l_parameter is l_command. CreateParameter();

    l_parameter. ParameterName = "param";

    l_parameter. Value = DateTime.Now;

    l_command. Parameters.Add (l_parameter);

    l_command. ExecuteNonQuery());

    }

    The code runs perfectly if the omission of the '-' OR the side of a parameter value assignment (i.e. omitting ', col_time =: param').

    The stack for the OracleException trace is as follows:

    at OracleInternal.ServiceObjects.OracleCommandImpl.VerifyExecution (OracleConnectionImpl connectionImpl, Int32 & cursorId, bThrowArrayBindRelatedErrors Boolean, OracleException & exceptionForArrayBindDML, Boolean hasMoreRowsInDB, Boolean bFirstIterationDone)

    at OracleInternal.ServiceObjects.OracleCommandImpl.VerifyExecution (OracleConnectionImpl connectionImpl, Int32 & cursorId, bThrowArrayBindRelatedErrors Boolean, OracleException & exceptionForArrayBindDML, Boolean bFirstIterationDone)

    at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery (String queryString, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, longFetchSize of Int32, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64 [] scnFromExecution, OracleParameterCollection & bindByPositionParamColl, Boolean bBindParamPresent, OracleException & exceptionForArrayBindDML, Boolean isFromEF)

    at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery)

    UPDATE 1:

    Now, I have tested with older versions of Oracle.ManagedDataAccess.dll thus:

    • ODAC 12 c Release 4 (12.1.0.2.4 - released October 5, 2015) -fails with ORA-01008: not all variables
    • ODAC Release 3 (12.1.0.2.1 - published December 23, 2014) 12 c - fails with ORA-01008: not all variables
    • ODAC 12 c Release 2 (12.1.0.1.2 - released on December 20, 2013) - successful!

    Therefore, changes in driver management Oracle introduced between December 20, 2013 and December 23, 2014 has caused this problem.

    UPDATE 2:

    I dug some more in the question and after decompilation December 2013 and December 2014 versions, I found the piece interesting next to the code in the implementation of the ExecuteNonQuery()) method in the inner class OracleInternal.ServiceObjects.OracleCommandImpl. The code in red was added in the version of December 2014:

    ...

    else if (commandType! = CommandType.TableDirect)

    {

    OracleCommandImpl.TrimCommentsFromSQL (ref str);

    this.m_sqlStatementType = OracleCommandImpl.GetSqlStatementType (str);

    this.m_bHasReturningClause = OracleCommandImpl.HasReturningClause (str, this.m_sqlStatementType);

    }

    ...

    Take OracleCommandImpl.TrimCommentsFromSQL () method for a test ride easily reveal its weaknesses. It does not take into account the sequence '-' may appear in a quoted string, treating them as a comment and deletes the rest of the line...

    Could you please address this issue?

    Best regards

    Bernt

    Yes, the cause seems exactly the same thing as Bug 22308527. Once fix us this bug, please fix your problem as well.

  • Why I can not suddenly see my selections of text?

    Why I can not suddenly see my selections of text?

    What is "selection"? This right:

    Screenshot_222.jpg

    If we know what it is, we can

    Your video takes forever to load. Please can you describe what is happening?

    Maybe just display > show edges?

  • How to extract the sql text with SID and SERIAL No.

    Hello

    I am new to oracle database and recently I started my journey in the optimization of the performance.
    I need to retrieve the sql text that is triggered by the user in function were SID and SERIAL No.

    Thanks in advance...
    Prabha

    Select
    a.SID,
    a.Serial #.
    b.sql_text
    Of
    session v$ a.
    v$ sqlarea b
    where
    a.sql_address = b.Address
    and
    SID = 43;

  • ORA-13786: lack of SQL text

    Hello
    11g R2, connected sysdba, I got the following errors. Any idea? Any help? Thanks before.
    SQL> select sql_id, sql_text from v$sql where sql_text like '%SELECT A.BUSINESS_UNIT, D.DESCR FROM PS_SP_RECV1_NONVW%' and sql_text not like '%v$sq
    ;
    
    SQL_ID
    -------------
    
    6d66jzkkyg2sw
    SQL_TEXT
    --------------------------------------------------------------------------------
    SELECT A.BUSINESS_UNIT, D.DESCR FROM PS_SP_RECV1_NONVW A, PS_SP_RCV1_NONVWLN D W
    
    
    
    HERE D.BUSINESS_UNIT LIKE 'IFP%' AND D.BUSINESS_UNIT=A.BUSINESS_UNIT AND D.LANGU
    AGE_CD='FRA' UNION SELECT  BUSINESS_UNIT, DESCR FROM PS_SP_RECV1_NONVW A WHERE B
    USINESS_UNIT LIKE 'IFP%' AND NOT EXISTS (SELECT 'X' FROM PS_SP_RCV1_NONVWLN D WH
    ERE  D.BUSINESS_UNIT=A.BUSINESS_UNIT AND D.LANGUAGE_CD='FRA') ORDER BY 1
    
    
    SQL> variable stmt_task VARCHAR2(64);
    SQL>
    SQL> EXEC :stmt_task := DBMS_SQLTUNE.CREATE_TUNING_TASK(sql_id => '6d66jzkkyg2sw');
    
    PL/SQL procedure successfully completed.
    
    SQL>
    SQL> EXEC DBMS_SQLTUNE.EXECUTE_TUNING_TASK(:stmt_task);
    
    PL/SQL procedure successfully completed.
    
    SQL> EXEC dbms_sqltune.accept_sql_profile(:stmt_task);
    BEGIN dbms_sqltune.accept_sql_profile(:stmt_task); END;
    
    *
    ERROR at line 1:
    ORA-13786: missing SQL text of statement object "1" for tuning task "TASK_2767"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 16442
    ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 31
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 7544
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 7568
    ORA-06512: at line 1
    SQL> DECLARE
      2    l_sql_tune_task_id  VARCHAR2(200);
      3  BEGIN
      4    l_sql_tune_task_id := DBMS_SQLTUNE.accept_sql_profile (
      5                            task_name => ':stmt_task',
      6                            name      => 'TEST_PROFILE',
      7                            force_match  => TRUE,
      8                            profile_type => DBMS_SQLTUNE.PX_PROFILE);
      9  END;
     10  /
    DECLARE
    *
    ERROR at line 1:
    ORA-13605: The specified task or object :stmt_task does not exist for the
    current user.
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
    ORA-06512: at "SYS.PRVT_ADVISOR", line 5878
    ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 28
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 7544
    ORA-06512: at line 4

    I think you forgot the taskname-online setting "TaskName":

    DECLARE
    stmt_task VARCHAR2 (64);
    BEGIN
    stmt_task: = dbms_sqltune.create_tuning_task (sql_id-online '6d66jzkkyg2sw', task_name-online 'task_name');
    END;
    /

    SQL > EXEC dbms_sqltune.accept_sql_profile ('task_name');

  • How to see what was the text after I changed it to outlines?

    How to see what was the text after I changed it to outlines?

    Hamish,

    You should always keep (a copy of) the work, you are about to destroy it. You can duplicate the layer with the direct Type and do what you have to do (after hiding the original).

    And you need to keep previous versions as backup.

    With only the type indicated, he is lost.

  • How can I copy and paste a pdf form on my Clipboard Mavericks. I see that word wrapped text.

    How can I copy and paste a pdf file in my Clipboard Mavericks. I see that word wrapped text.

    If the form is saved in PDF format, can not you just place the PDF file in the other application?

  • SQL text of session by username wise prompt sql in Oracle RAC?

    Hello Oracle gurus

    one had idea or no matter what sql query that provide this information from the sql prompt

    We have R2 Oracle10g RAC with 2 Sites node on the Solaris platform

    We want to control the entire session sql text specified by username wise sql command prompt

    Thanks in advance

    Concerning
    Hitgon

    Hello

    Select b.SQL_FULLTEXT, a.sid, a.serial #, a.username, a.logon_time, a.osuser, a.program, a.process, a.blocking_session, a.state, a.service_name, a.type, other, a.lockwait, a.CLIENT_IDENTIFIER
    GV $ session has, gv$ sqlarea b where a.sid = & sid = b.ADDRESS a.SQL_ADDRESS

    This application receive the SID and get the SQL_TEXT and some other information about the user.

    Hope that helps.

    Concerning

  • How to see the generated sql code

    Hello

    With the help of obiee 10g, I would like to see the generated sql code.
    I logged in as administrator
    Following manage-> sessions-> view log

    But when I click on connect gives this error ii do me "no logs found.

    The RPD administrator is a user with the recording as a 2 level.

    Thank you

    BI_ORACLE_HOME/server/log/nqquery.log

    to learn more:

    http://gerardnico.com/wiki/dat/OBIEE/nqquery.log

    Another method

    http://varanasisaichand.blogspot.com/2010/04/how-to-set-logging-level-for-users-in.html

    Thank you

    Deva

    Published by: Devarasu on December 6, 2011 17:26

  • Ai2/EA1 2.1: a few bugs on the history of SQL

    Hello

    Against Oracle 10 g 2 databases.
    History of SQL is buggy on some statements.
    It is saved two times and the number of execution has increased by 2 each time executed following instructions:
    1. DML (INSERT, UPDATE, DELETE) statement
    2. the DDL statement (i.e. CREATE, ALTER, TRUNCATE TABLE)
    3 DCL (commit and rollback)

    It works very well only for SELECT statements.

    Kind regards

    Buntoro

    Connected
    Bug 9009500 - 2.1: EA1: RUNNER STATEMENT CONNECTING the STORY TWICE

    -Rambeau

  • 2.1 EA1 - capitalizing SQL text in the worksheet

    Whenever I have enter some commands SQL worksheet window and press ENTER after the semicolon, it re - formats the text and capitalizes all the keywords. So what follows:

    Select * twice;

    becomes

    Select * From Dual;

    Which is quite annoying, because the SQL Developer doesn't have to mess with my code unless I ask him to. I know there are right click-> Format (CTRL + F7), who did a great job messy fixing SQL and I love this feature, but it is never used to edit the text. It does in v2.1 EA, and it uses a system of different capitalization than the spreadsheet, which translates as:

    SELECT * FROM dual;

    Personally, I would prefer that he behaves this way:

    1. don't mess with ANY text in the SQL worksheet, unless specifically requested to do so
    2. in SQL with "Format" formatting, do not change the case of any text
    3. do you have another option (or an extension to the 'Format') will change the case of text to fit a configurable standard
    4. If a text block is selected when is called "Format", then only format this block, instead of the entire spreadsheet window

    Published by: gclough on October 6, 2009 11:09

    In the SQL worksheet, there is an icon Aa you clicked over there, look at the bottom line message of left hand in the window and you will see that scrolls a number of options/configurations of the case. You can choose the configuration you want, and then type your code, it will automatically format to this request.

    You can choose NONE, in this case, no formatting occurs while you type.

    Sue

Maybe you are looking for

  • How do I enter the BIOS in Satellite C50-A006

    Hello! I wanted to get into the BIOS to select the boot sequence in Satellite C50-A006 running with Win8, but I was unsuccessful. I tried pressing F2, F8, F12, ESC and DEL but no luck. Also tried Googling, also no luck.Help, please. Thank you!

  • Windows XP Mode and regular updates?

    Is there a reason to run windows update (update the operating system software) while running in windows xp mode. I hope I made that clear, let me explain more. I am running win 7 pro 64-bit. I've updated regularly. I run also some programs in win xp

  • HP pavilion dv6529em (install HP TOOLS partition)

    The hp pavilion dv6529em was fully functional and load.  Laptop has been moved and the plug of the charger is removed unintentionally.  Laptop was turned off, charger off the power and then reconnected to the laptop.  Now, laptop is recycled during t

  • Ports under Device Manager is not available

    I have an application that requires frequent updates of the port "com."  Usually I go in Control Panel-> system-> hardware-> device-> Ports (COM & LPT) Manager to find out which port is used for the connection.  Don't know how but my Ports (COM & LPT

  • Questions, I am a beginner

    1. what the RegCleanPro Windows registry cleaners? Do I need this? It is $ 30.00! Said it will speed up my performance and my performance is ugly! I ran scans, disk defragmentation, Mr. Fix-it's pretty much all I know to speed it up and keep it from