How could I extract past executed SQL statement from dictionary ?

We use oracle11gR2 on win2008R2.
How could I extract the past executed SQL statement from dictionary ? (Is it possible from V$SQLTEXT or other dictionary table ?)

IvicaArsov wrote:
Hi,
You can find executed SQL in V$SQLAREA view (if it's still in memory). If it does'n't exist and you have AWR enabled you can query DBA_HIST_SQLTEXT table, but remember that the statistic information in AWR tables is filtered (1 out of 10).
I.Arsov
As you know when taking snapshot oracle will capture only top sql statements and stored in AWR.
But can you please link(source) dba_hist_sqltext contain only 1 out of 10 filtered data?. In dba_hist_active_sess_history yes it contain 1 out of 10 sampled data.

Similar Messages

  • How To Execute SQL Statements From Shell Scripts?

    I need to extecute some SELECT statements from a shell scripts. Could anybody kindly tell me how to do that, or which document i should refer to ? Thank you very much!

    You can execute SQLPlus with the SQL in a file (sqlplus -s @<sql-script>).

  • Exec SQL statement from BW to MS SQL

    Hi Experts,
    I need to execute sql statement from BW on MS SQL Server.
    I want to do it in process chain. There is a so called ABAP Program Component.
    How to implement such a program or function module that will execute on MS SQL Server an sql statement such as for instance:
    "Create view SOME_VIEW as select * from XTABLE".
    I have already configured database connection using DBCO transaction.
    Waiting for response.
    Krzysztof

    Thanks, but that is not what I was asking for.
    I just need to send some SQL statement from BW to MS SQL Server using ABAP program (exec sql or something like this).
    Could you provide me a pattern of such an ABAP program?
    The sql statement is not importent here, I have already extracted data from MS SQL to BW, I have configured dataflow, process chains and so on.
    No I need to determine DELTA on MS SQL Server. I've got some ideas but I need to know how to send SQL statement from BW to MS SQL Server using ABAP program.
    Please any help will be appreciated

  • How to export the result from executing sql statement to excel file ?

    HI all,
    Great with Oracle SQL Developer, but I have have a trouble as follwing :
    I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
    anyone can help me to do that ? Thanks so much
    Sigmasvn

    Hello Sue,
    I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
    open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
    When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
    Regards
    Marcus

  • How could I investigate SQL statement from standard audit record ?

    We use Oracle 11gR2.
    We use standard audit , audit_trail=DB.
    We found suspicious audit record but that  SQL_BIND,SQL_TEXT colums were NULL.
    How could I investigate that SQL statement from standard audit record ?

    Only "DB, EXTENDED" would cause the SQL statement to be captured.
    If you have the Diagnostics Pack licence you could try querying DBA_HIST_SQLTEXT (joined to DBA_HIST_SNAPSHOT) -- but this would only list SQLs captured by AWR (i.e. the "Top 'N'" SQLs in that snapshot).
    Hemant K Chitale

  • How to execute sql statement under bat file?

    I want to execute following statement
    C:\>sqlplus /nolog
    SQL> conn scott/tiger
    SQL> select * from tab;
    I know I can realize it as following test.bat and testdb.sql file
    test.bat is follows:
    sqlplus /nolog @testdb.sql
    testdb.sql is follows:
    conn scott/tiger
    select * from tab;
    Now I don't want to use sql file,I only want to use bat file,like follows:
    test.bat is follows:
    sqlplus /nolog
    conn scott/tiger
    select * from tab;
    when I run test.bat,I find only sqlplus /nolog statement execute,the other statements don't execute.
    1)I want to know whether there is a method to execute sql statement only by bat file without a sql file? How to realize it?
    2)If I call sql file,how to hide passord of user? Because I don't want to other persons know scott password,if I use conn scott/tiger in testdb.sql,other person can see testdb.sql and know the password. Is there a good method to avoid?
    Thanks!

    I'm running *NIX, but works the same on Windows
    bcm@bcm-laptop:~$ cat here.sh
    sqlplus dbadmin/admindb << EOF
    select count(*) from user_objects;
    exit
    EOF
    bcm@bcm-laptop:~$ sh here.sh
    SQL*Plus: Release 11.2.0.1.0 Production on Mon May 17 18:14:09 2010
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
      COUNT(*)
          9
    SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    bcm@bcm-laptop:~$ Edited by: sb92075 on May 17, 2010 6:15 PM

  • Extracting SQL statement from a Webi document's data provider using SDK.

    Hi all,
    Is it possible to extract the SQL statement from an existing Webi document's data provider using BO SDK?  I've searched through the class library but haven't found any information on this yet.  If you have done it, could you provide some guidance.  Many thanks.

    I found the following Java code that might be of some help to you. I realize you are using .NET but this might push you down the right path.
    The trick here is to use the Report Engine SDK to get the DataProvider of the DocumentInstance. Then, look at the SQLDataProvider to get your SQLContainer.
    My apologies for the poor formatting. This didn't copy and paste over to the forums very well. I've cleaned up as much as I could.
    <%@ page import="com.crystaldecisions.sdk.framework.*" %>
    <%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
    <%@ page import="com.crystaldecisions.sdk.occa.infostore.*" %>
    <%@ page import="com.businessobjects.rebean.wi.*" %>
    <%
    boolean loginSuccessful = false;
    IEnterpriseSession oEnterpriseSession = null;
    String username = "username";
    String password = "password";
    String cmsname  = "cms_name";
    String authenticationType = "secEnterprise";
    try
    //Log in. oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsname, authenticationType);
    if (oEnterpriseSession == null)
    out.print("<FONT COLOR=RED><B>Unable to login.</B></FONT>");
    else
    {  loginSuccessful = true;
    catch (SDKException sdkEx)
    { out.print("<FONT COLOR=RED><B>ERROR ENCOUNTERED</B><BR>" + sdkEx + "</FONT>");}
    if (loginSuccessful) { IInfoObject oInfoObject = null;
    String docname = "WebI document name";
    //Grab the InfoStore from the httpsession IInfoStore oInfoStore = (IInfoStore) oEnterpriseSession.getService("", "InfoStore");  //Query for the report object in the CMS.  See the Developer Reference guide for more information the query language.   String query = "SELECT TOP 1 * " +        "FROM CI_INFOOBJECTS " +        "WHERE SI_INSTANCE = 0 And SI_Kind = 'Webi' " +        "AND SI_NAME='" + docname + "'";
    IInfoObjects oInfoObjects = (IInfoObjects) oInfoStore.query(query);
    if (oInfoObjects.size() > 0)
    //Retrieve the latest instance of the report  oInfoObject = (IInfoObject) oInfoObjects.get(0);
      // Initialize the Report Engine  ReportEngines oReportEngines = (ReportEngines)
    oEnterpriseSession.getService("ReportEngines"); 
    ReportEngine oReportEngine = (ReportEngine) oReportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
      // Openning the document  DocumentInstance oDocumentInstance = oReportEngine.openDocument(oInfoObject.getID());   
    DataProvider oDataProvider = null; 
    SQLDataProvider oSQLDataProvider = null; 
    SQLContainer oSQLContainer_root = null; 
    SQLNode oSQLNode = null;
    SQLSelectStatement oSQLSelectStatement = null; 
    String sqlStatement = null;
      out.print("<TABLE BORDER=1>");
    for (int i=0; i<oDocumentInstance.getDataProviders().getCount(); i++)
    oDataProvider = oDocumentInstance.getDataProviders().getItem(i);
      out.print("<TR><TD COLSPAN=2 BGCOLOR=KHAKI>Data Provider Name: " + oDataProvider.getName() + "</TD></TR>");
       if (oDataProvider instanceof SQLDataProvider)
    oSQLDataProvider = (SQLDataProvider) oDataProvider;
        oSQLContainer_root = oSQLDataProvider.getSQLContainer();
        if (oSQLContainer_root != null)
    for (int j=0; j<oSQLContainer_root.getChildCount(); j++)
    oSQLNode = (SQLNode) oSQLContainer_root.getChildAt(j);
          oSQLSelectStatement = (SQLSelectStatement) oSQLNode;             
    sqlStatement = oSQLSelectStatement.getSQL();     
    out.print("<TR><TD>" + (j+1) + "</TD><TD>" + sqlStatement + "</TD></TR>");   
    else
    out.print("<TR><TD COLSPAN=2>Data Provider is not a SQLDataProvider.  SQL Statement can not be retrieved.</TD></TR>");   }  }  out.print("</TABLE>");
      oDocumentInstance.closeDocument(); }
    oEnterpriseSession.logoff();}%>

  • How to store data into database by reading sql statements from text file

    how to write java program for storing data into database by reading sql statements from text file

    Step 1: Create a property file to add various queries.
    Step 2: Read the properties file using ResourceBundle
    Step 3: Use the jdbc to execute the query read from the property file.
    So in future if you need to change query no need do any modifications in java program. But depends on how you use the property file.

  • How to parsing xml data in sql statement??

    Hi friends, I have a table which contain column as clob ,stores in xml format, for example my column contain xml data like this
    <Employees xmlns="http://TargetNamespace.com/read_emp">
       <C1>106</C1>
       <C2>Harish</C2>
       <C3>1998-05-12</C3>
       <C4>HR</C4>
       <C5>1600</C5>
       <C6>10</C6>
    </Employees>
      Then how to extract the data in above xml column data using SQL statement...

    Duplicate post
    How to parsing xml data in sql statement??

  • Patterns to execute a SQL Statement from a Droplet (select)

    Hi,
    I need to perform a query on a table, Example: select * from ARF_QUERY "the database used is Oracle. I would like to know if the atg has some
    standard method to perform this database connection and execute the SQL statement from a Droplet (select).
    Thank.

    I dont think there is any generic droplet to run a select query directly against a table.
    However, there are various lookup droplets available that run on the repositories.
    Like /atg/targeting/RepositoryLookup droplet. you can run it for specific id or for all.
    You might want to have a look at it in documentation of how exactly to use it.
    Thanks

  • Batch executing SQL Statements stored in a file in SAP DB

    hi,
    I am using SAP DB as database in my j2ee application. As a part of the application purpose, i need to insert a large no. of records in to the database directly. I have created the SQL file which contains the insert statements for the records
    Now i need to execute this file sothat the insert statement which are inside the file get executed. I am using SQL Studio to access to the Database.
    I would like to know whether any options are available in SQL Studio to for executing a SQL File.
    Kindly help
    Best regards,
    Sudheesh...

    Hi,
    I believe that the solution to your problem lies in creating sql studio objects.Please refer to the link below.Select the link "sql dialog" on the page.
    The following options are available for sql dialog.
    The following options are available in the SQL dialog:
    ·        Creating and executing SQL statements
    ·        Setting parameters for SQL statements
    ·        Importing and exporting SQL statements
    Select the "Importing and exporting sql statements" link on this page to know more about it.This will tell you how to import sql statements from ascii files.
    Basically,what you need to do is From the context menu for the SQL dialog, choose Import File or Export File.
    The link I have provided,gives a lot of other information as well.
    http://help.sap.com/saphelp_nw04s/helpdata/en/ee/1c5bdfeba711d4aa2800a0c9430730/frameset.htm
    Hope this helps.
    Regards,
    Harish
    (Please award points for helpful answers)
    Message was edited by: HARISH SUBRAMANIAN

  • [0098]SQL*Plus encountered oracle error 100 while executing SQL Statement

    Hi,
    i'm trying to delete duplicate records from a table and running following script. this script is triggered from a unix script. it successfully deletes the records but in the last throws following error message,
    :[0098]SQL*Plus encountered oracle error 100 while executing SQL Statement:2:Investigation required:
    can anybody please help? below is the script.
    DECLARE
    --CURSOR FOR DUPLICATE ROWS
    CURSOR CUR_DUPLICATE_ROWS IS
    Select RMS_NOTE_ID, RMS_SUMMARY_NOTE_ID, count(*) cnt from PARTY_NOTE
    group by RMS_NOTE_ID,RMS_SUMMARY_NOTE_ID having count(*) > 1;
    var_date PARTY_NOTE.PARTY_NOTE_CREATED_DATE%TYPE;
    BEGIN
    FOR DUPLICATE_ROWS_REC IN CUR_DUPLICATE_ROWS
    LOOP
    delete from party_note
    where RMS_NOTE_ID= DUPLICATE_ROWS_REC.RMS_NOTE_ID
    and RMS_SUMMARY_NOTE_ID= DUPLICATE_ROWS_REC.RMS_SUMMARY_NOTE_ID
    and rowid not in (select max(rowid) from party_note
    where RMS_NOTE_ID= DUPLICATE_ROWS_REC.RMS_NOTE_ID and RMS_SUMMARY_NOTE_ID= DUPLICATE_ROWS_REC.RMS_SUMMARY_NOTE_ID);
    commit;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLERRM);
    ROLLBACK;
    END;

    Try this:
    delete party_note
    where  rowid not in (select max(rowid)
                         from   party_note
                         group  by rms_note_id, rms_summary_note_id
    commit;No need for cursors and loops.
    And when that's completed, consider ALTERing the table to add a unique index (or even a primary key) so you'll never need to do this again.

  • The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can be used to execute SQL statements.

    Hello All,
    I am getting below error can you please help me
    Error:-
    The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can be used to execute SQL statements.

    Perhaps this thread will help you out
    http://stackoverflow.com/questions/11453066/error-the-transaction-associated-with-the-current-connection-has-completed-but
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Error executing SQL statement

    Hi,
    Can anyone see why I am getting this error message for my SQL query?
    WITH SKU_DATA AS (
    SELECT /*+ MATERIALIZE */ DISTINCT FROM_LOC_ID,
               SKU_ID,
               DESCRIPTION,
               UPDATE_QTY,
            ORDER_ID,
            CONSIGNMENT,
               WEIGHT,
            PALLET_ID,
            CASE 
        WHEN Upd_Qty_Ratio < 1
        THEN TO_CHAR(UPDATE_QTY) || 'U'
        WHEN TRUNC(Upd_Qty_Ratio) = Upd_Qty_Ratio
        THEN TO_CHAR(Upd_Qty_Ratio) || 'C'
        ELSE TO_CHAR(TRUNC(UPDATE_QTY)) || 'C' || ' ' || TO_CHAR(ROUND(MOD(Upd_Qty_Ratio, 1) *  USER_DEF_NUM_3, 6)) || 'U'
        END CU_Sum
        FROM (
      SELECT DISTINCT
             FROM_LOC_ID,
          S.SKU_ID,
             S.DESCRIPTION,
             ITL.UPDATE_QTY,
             S.USER_DEF_NUM_3,
          OH.ORDER_ID,
          ITL.CONSIGNMENT,
          ITL.PALLET_ID,
             NVL(ITL.UPDATE_QTY,0)*NVL(S.EACH_WEIGHT,0) Weight,
             ITL.UPDATE_QTY/(CASE S.USER_DEF_NUM_3 WHEN 0 THEN 1 ELSE S.USER_DEF_NUM_3 END) Upd_Qty_Ratio
        FROM INVENTORY_TRANSACTION ITL, SKU S, LOCATION L, ORDER_HEADER OH
        WHERE ITL.SKU_ID = S.SKU_ID
        AND ITL.CODE = 'Pick'
        AND ITL.CONSIGNMENT = $P{Consignment}
        AND OH.ORDER_DATE = TO_CHAR($P{Date}, 'DD-Mon-YYYY')
        AND OH.ORDER_ID = ITL.REFERENCE_ID
        AND ITL.TO_LOC_ID = 'CONTAINER'))
    SELECT DISTINCT ORDER_ID, CONSIGNMENT, WEIGHT, PALLET_ID, CU_Sum,
    (SELECT NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'U') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'C',NULL) END)),'0') ||'C' || ' ' || NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'C') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'U',NULL) END)),'0') ||'U' FROM SKU_DATA) AS Total_Cu_Sum
    FROM SKU_DATAThanks in advance.
    SM.

    Hi Sean,
    It is saying error executing SQL statement, but with no "ORA error" so maybe its a Jasper Reports error i'm not too sure.
    And this is a different version of the one we done together, that one is running fine just having problems putting the jasper file on to the server. I'm just using the main bits from the original SQL.
    SM

  • How Can I Retrieve SQL Statement From The User ?

    Hi
    I want to know, how can I make the user can enter the SQL statement from himself ?? in this code he can't enter it. Only he can display the SQL that i wrote it...
    this is my Code:
    import java.sql.*;
    public class db_testing {
         static final String DRIVER = "com.mysql.jdbc.Driver";            
         static final String DATABASE_URL = "jdbc:mysql://localhost/S204111933";
         public static void main(String[] args) {
              Connection cn=null;
              Statement st= null;
              ResultSet rset=null;
              try{
                   Class.forName(DRIVER);
                   cn=DriverManager.getConnection(DATABASE_URL, "root", "admin");
                   st=cn.createStatement();
                   rset=st.executeQuery("select * from employee");
                   ResultSetMetaData metadata=rset.getMetaData();
                   System.out.println("The begining: ");
                   for(int i=1;i<=metadata.getColumnCount();i++)
                   System.out.print(metadata.getColumnName(i)+"\t");
                   System.out.println();
                   System.out.println();
                   while(rset.next()){
                   for(int i=1;i<=metadata.getColumnCount();i++)
                   System.out.print(rset.getObject(i)+"\t\t");
                   System.out.println();}
              catch(Exception e){
                   e.printStackTrace();
              finally{
                   try{
                   cn.close();
                   st.close();
                   rset.close();
                   catch(Exception e1){
                        e1.printStackTrace();
    }

    The following changes in the code will make the user to give the input
    import java.sql.*;
    public class db_testing {
    static final String DRIVER = "com.mysql.jdbc.Driver";
    static final String DATABASE_URL = "jdbc:mysql://localhost/S204111933";
    public static void main(String[] args) {
    Connection cn=null;
    Statement st= null;
    ResultSet rset=null;
    try{
    Class.forName(DRIVER);
    cn=DriverManager.getConnection(DATABASE_URL, "root", "admin");
    // st=cn.createStatement();
    // rset=st.executeQuery("select * from employee");
    PreparedStatement pstmt=null;
    pstmt=cn.prepareStatement("select * from employee where id=?");
    pstmt.setInt(1,Integer.parseInt(args[0]));
    rset=pstmt.executeQuery();
    ResultSetMetaData metadata=rset.getMetaData();
    System.out.println("The begining: ");
    for(int i=1;i<=metadata.getColumnCount();i++)
    System.out.print(metadata.getColumnName(i)+"\t");
    System.out.println();
    System.out.println();
    while(rset.next()){
    for(int i=1;i<=metadata.getColumnCount();i++)
    System.out.print(rset.getObject(i)+"\t\t");
    System.out.println();}
    catch(Exception e){
    e.printStackTrace();
    finally{
    try{
    cn.close();
    st.close();
    rset.close();
    catch(Exception e1){
    e1.printStackTrace();
    }

Maybe you are looking for