How to pull history SQL queries before 18 day's

Hi,
I tried to pull the Awr report for the SQL history queries. Unfortunately it is saved only for 7 days. There is any way I can retrieve the history SQL from dictionary tables. I have access to all the DBA views. Please let me know if you need any further information.
Thanks,
Swagath

swagath, as already stated as a general rule Oracle does not retain the information you are asking for. Even the AWR information consists of samples so it is not complete.
Keeping a record of all the queries ran would take a fair amount of space on any active system and really what practical use if this information.
If you need to know who accessed what then you need auditing configured and if you need to hold onto the data for more than a short period of time you likely need to be dumping the audit trail external to the database.
IMHO -- Mark D Powell --

Similar Messages

  • Can we capture SQL Queries before execution?

    Hi Everyone,
    I would like to know that is there any way to capture SQL queries before execution?
    please advise.
    thanks
    kv

    Hi!
    You could capture the querys and use them as a payload for the "Database Engine Tuning Advisor".
    Maybe it gives you some indexes which raise the performance.
    But:
    I only would add indexes to user tables.
    Cheers,
    Roland
    PS.:
    Indexes which are created directly through SQL could be lost after a B1 Upgrade. So saving the creation-statements in a warm and secure place is recommended
    PPS.:
    ...and maybe such indexes are not supported by SAP...
    Edited by: Roland Toschek on Dec 1, 2008 6:23 PM

  • 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!

  • How to see what SQL queries are made to my Database Server?

    Hi all,
    I'm a newbie. I'd like to know if there's a way to find out what SQL queries are being made to my Database server at the server end.
    Is it possible that Oracle Database Manager logs this information (including the exact query/SQL)somewhere in its logs? How to enable such an option and/or view the recent SQL queries made ?
    Please enlighten me. Thanks in advance.
    Thanks and Regards
    Sharat

    "I checked the V$SQLTEXT view too. It has only 64 characters for SQL_TEXT field." Yes yes but you might have noticed that it also has the column called piece. The view shows the full SQL statement broken up into little pieces. Use ADDRESS and HASH_VALUE to link to v$sql. There is also a view V$SQLTEXT_WITH_NEWLINES that throws in some line separators to make it "easier" to read.
    Example below shows full text of SQL statements currently executing.
    SQL> column address noprint
    SQL> column hash_value noprint
    SQL> break on hash_value skip 1
    SQL> select
      2     a.address, a.hash_value, b.sql_text
      3  from
      4     v$sql a, v$sqltext b
      5  where
      6     a.users_executing > 0
      7     and b.address = a.address
      8     and b.hash_value = a.hash_value
      9  order by
    10     a.address, a.hash_value, b.piece ;
    SQL_TEXT
    select    a.address, a.hash_value, b.sql_text from    v$sql a, v
    $sqltext b where    a.users_executing > 0    and b.address = a.a
    ddress    and b.hash_value = a.hash_value order by    a.address,
    a.hash_value, b.piece
    begin quest_exec.get_message(:cmd, :peer, :owner, :folder, :scri
    pt, :delay); end;
    6 ligne(s) sélectionnée(s).
    SQL> select
      2     a.address, a.hash_value, b.sql_text
      3  from
      4     v$sql a, v$sqltext_with_newlines b
      5  where
      6     a.users_executing > 0
      7     and b.address = a.address
      8     and b.hash_value = a.hash_value
      9  order by
    10     a.address, a.hash_value, b.piece ;
    SQL_TEXT
    select
       a.address, a.hash_value, b.sql_text
    from
       v$sql a, v
    $sqltext_with_newlines b
    where
       a.users_executing > 0
       and b
    .address = a.address
       and b.hash_value = a.hash_value
    order by
       a.address, a.hash_value, b.piece
    begin quest_exec.get_message(:cmd, :peer, :owner, :folder, :scri
    pt, :delay); end;
    6 ligne(s) sélectionnée(s).

  • How to test basic sql queries online(for Sql Server 2012 and up versions) ?

    Hi,
    I need to test basic sql queries using sql server without installing Sql Server on to the system.
    Do we have such readymade online help, which can solve such difficulties ?
    Please sugest some of url's.
    Thanks.

    Thanks for reply.
    I am looking specific Sql Server.
    Hi Maggy,
    I strongly recommend you install SQL Server 2012 express edit and test your T-SQL queries. We can download it from the following site:
    Microsoft® SQL Server® 2012 Express:
    http://www.microsoft.com/en-hk/download/details.aspx?id=29062
    Regards,
    Elvis Long
    TechNet Community Support

  • How to determine estimated cost of dynamic SQL queries before execution?

    Hi Performance Gurus,
    Does anybody need know of a function module or program which can give me an estimated cost for a given SQL query. SQL query is a dynamic query and we need to know the estimated cost before we execute it.
    Cheers
    Jiby
    Moderator message: subject corrected, in the future please use one that describes your problem better.
    Edited by: Thomas Zloch on Aug 24, 2010 12:56 PM

    Hi,
    The mentioned function module does not give you the cost but the plan.
    On DB2 e.g.
    U Explanation of query block number: 1   step: 1
    D Query block type is SELECT
    S Performance appears to be bad
    S No index is used. Sequential tablespace scan
    E Method:
    D           access new table.
    D           data pages are read in advance
    D           pure sequential prefetch is used
    D           new table:
    D                       SAPD8M.DD02L
    D                       table space locked in mode:  N
    D           Accesstype: sequential tablespace scan.
    I think there is some information that could be used as well (cost figure transformed to text)
    S Performance appears to be bad
    S No index is used. Sequential tablespace scan
    But as already said: the whole requirement is quite strange...
    I'm not aware of any other options, sorry.
    Kind regards,
    Hermann

  • How to embed PL/SQL queries in HTML in Database App Development VM?

    I'm reading "Learning Oracle PL/SQL" and this book tells me that if I can install apache httpd and modplsql I can embed queries in HTML.
    How do I do this in Database App Development VM?
    Do I already have apache httpd installed? Is it already started?
    If not, how do I start it?
    What am I getting when I point my firefox browser to http://localhost:1158/em? I'm getting a nice web page that is prompting for username and password. What username and password do I use? oracle/oracle did not work!
    What does this web site do? Administer the database server?
    I already tried to use "yum install emacs" as I mentioned in Re: How to Install emacs, openssh and start oracle database and get a connect? and it appears that the repository for "yum" is not correct.
    "yum install httpd" does not work either.
    When I tried "sudo yum install httpd" it says
    "Sorry, user oracle is not allowed to execute '/usr/bin/yum install httpd' as root on localhost.localdomain."
    I get the same message for "sudo yum isntall emacs".
    Thanks
    Siegfried

    user8816970 wrote:
    I'm reading "Learning Oracle PL/SQL" and this book tells me that if I can install apache httpd and modplsql I can embed queries in HTML.
    How do I do this in Database App Development VM?
    Do I already have apache httpd installed? Is it already started?
    If not, how do I start it?
    What am I getting when I point my firefox browser to http://localhost:1158/em? I'm getting a nice web page that is prompting for username and password. What username and password do I use? oracle/oracle did not work!
    What does this web site do? Administer the database server?
    I already tried to use "yum install emacs" as I mentioned in Re: How to Install emacs, openssh and start oracle database and get a connect? and it appears that the repository for "yum" is not correct.
    "yum install httpd" does not work either.
    When I tried "sudo yum install httpd" it says
    "Sorry, user oracle is not allowed to execute '/usr/bin/yum install httpd' as root on localhost.localdomain."
    I get the same message for "sudo yum isntall emacs".
    Thanks
    Siegfriedhttp://www.oracle.com/pls/db112/search?remark=quick_search&word=psp

  • Could  you please tell me how to write efficient SQL queries?

    Hi
    Could you please tell me how to tune or write an efficient SQL query?
    Regards,

    Hi user576726
    Pls study & try this ....
    When your query takes too long ...
    hope it helps....
    Regards,
    Abdetu...

  • How to view the sql queries generated by EJB (CMP)

    Hello,
    I'm using Oracle9iAS (9.0.2.1.0) Containers for J2EE (build 020827.1652) & Oracle 8.1.7 database.
    I have a CMP that has about 400 fields and the corrsoponding table has about 800 fields. I'm able to call create and add a row in database.
    Now when I call update method to set the remaining fields of this row (I get the proper instance by calling findByPrimaryKey()) I'm getting an exception ORA-00957 duplicate column name.
    I'm using reflection to set all the fields by passing my update method a HashMap and setting those fields that this HashMap contains. And as HashMap cannot contain duplicate keys the possiblility of having duplicates is eliminated.
    But why am I getting ORA-00957 duplicate column name.
    Is there a way I can configure somehow to view what sql query is being generated by the OC4j container when its firing this query to update the database table.
    Any help will be greatly appriciated.
    Vipin.

    Install IronTrack SQL as described in the following link
    http://www.irongrid.com/documentation/irontracksql/install.html#install_oracle9iAS

  • Developing portlets for dummies (sql queries)

    Hello, I've been trying to build a dynamic menu. First I went with just plain old plsql: i created a function in the portal schema that returns an unordered, nested list of the pages in my pagegroup and called that function in a regular pl/sql item on my portal page. I did this by querying the wwpob_page$ table and that went just great in my test&development setup (of which I am the admin of course :))
    Then I realized that since I'm not an administrator of the server hosting our portal and I only have very limited privileges (I am only a page group administrator) I will probably not be allowed to utilize this function nor will they agree to install it in the portal schema, and I decided I should build a portlet that does the same thing (so it can be registered and so on, and so it can use the synonyms and tools that are available to registered providers). There already is such a portlet (and provider) registered for use in the target portal, but I don't like it because i uses tables and hard-coded styles so I will cook my own, better version. :)
    So I downloaded an example portlet and am getting the hang of it, but now I just can't for the life of me figure out how to enable any sql-queries. I have run the provsyns-.sql script, logged in as test_provider/portal and installed my portlet-package as test_provider user. I can see the available pl/sql packages in Toad, but there are no tables or views for me to to see. That means I can't query the portal tables that I need to.
    edit: ok, stupid user error; I suck at using Toad, so I was looking at the wrong schema altogether :D So now i see the public views and packages, so forget that bit of the question.
    But still, I cannot see even wwsbr_all_folders -view, much less the wwpob_page$ -table. I cannot see any way to find the pages that are in my page group. Somehow it must be doable, right?
    Have I done something wrong, missed a step in enabling my test-provider / schema perhaps? I don't really know what I'm doing, but I followed instructions here: http://home.c2i.net/toreingolf/oracle/portal/my_first_plsql_portlet.htm (excellent instructions, thanks!)
    So should my portlet be able to access those tables or not? How the heck has the third partly portlet maker done it?
    i'm on OracleAS Portal 10g Release 2 (10.1.4)
    Edited by: Baguette on 23-Apr-2009 05:13
    Edited by: Baguette on 23-Apr-2009 05:32

    i see your perspective now. and let me give a perspective to my first reply too.
    what i proposed to you was the answer of what i quoted in the message. that is, why didn't you see those views in the new schema you created! and it is still ok but it is done in the portal schema for which you should have privielges too and i assumed you had. my mistake!
    now, i can relate your privacy concerns with your earlier message:
    Hello, I've been trying to build a dynamic menu. First I went with just plain old plsql: i created a function in the portal schema that returns an unordered, nested list of the pages in my pagegroup and called that function in a regular pl/sql item on my portal page. I did this by querying the wwpob_page$ table and that went just great in my test&development setup (of which I am the admin of course :))
    +Then I realized that since I'm not an administrator of the server hosting our portal and I only have very limited privileges (I am only a page group administrator) I will probably not be allowed to utilize this function nor will they agree to install it in the portal schema, and I decided I should build a portlet that does the same thing (so it can be registered and so on, and so it can use the synonyms and tools that are available to registered providers). There already is such a portlet (and provider) registered for use in the target portal, but I don't like it because i uses tables and hard-coded styles so I will cook my own, better version. :)+
    +So I downloaded an example portlet and am getting the hang of it, but now I just can't for the life of me figure out how to enable any sql-queries. I have run the provsyns-.sql script, logged in as test_provider/portal and installed my portlet-package as test_provider user. I can see the available pl/sql packages in Toad, but there are no tables or views for me to to see. That means I can't query the portal tables that I need to.+
    - by downloading an example portlet, you probably mean you created a new schema. because provsyns work on a schema.
    - if you are not the administrator of the portal, and may not be able to access some portions of the portal, it means that you do not use the portal user (the user which serves as the owner of the portal schema).
    - now, your plan to create a new schema and give those privielges would still not work. because, by creating a new schema you cannot sneak in to the oriignal portal schema if you do not have privileges to do it. obvious, right? otherwise, it would be a vulnerability of the software that you can see what you are not allowed to see by creating a new schema.
    - however, there is a bright side here. the views give records based on your privileges.
    - so if your administrators have generated them already or if they generate on the original portal schema, then you may see the pages and items that you have privileges to see and no more.
    so now, you may ask the administrators if they have already done it, and if not, then if they would be willing to do it.
    hope that helps!
    AMN

  • Execute multiple sql queries in plsql

    Hello All,
    I have two queries, How to execute multiple sql queries in plsql. Once the query completed in sql+ that report/output has to come in html.
    Please guide to how to do that.
    Thanks and Regards,
    Muthu
    [email protected]

    There are several ways to do what you are wanting, but you should consider posting your question in the correct forum (PL/SQL). This forum is for question about Oracle Forms! :)
    As to your question, take a look at this: How to output query results as HTML.
    Craig...

  • Information on how to run SQL queries on the CUCM itself please

    Good Day All,
    I need to run an sql query on the CUCM to list all of my directory numbers, their partition, and their external mask values.
    I came across this excerpt below earlier so I have a bit of an idea how to do it but iw would be great to see some other examples of sql queries.
    Any assistance is most appreciated.
    Also, is there a document somewhere to tell me how to run these queries?
    Thanks in advance
    Regards
    Amanda
    Currently Being Moderated
    05/04/2011 5:18 AM (in response to Joshua Royle)
    Re: Is there a way of pulling a report off CM showing all phones that have diverts on?
    Try if running this SQL query from the CLI helps you, it should list all DN's that have CFA enabled to VM or a DN:
    run sql select dnorpattern,cfadestination,cfavoicemailenabled from CallForwardDynamic c, numplan n where c.fknumplan = n.pkid and (cfadestination != '' or cfavoicemailenabled ='t')

    Hi Amanda
    Basically it's standard SQL, so it wouldn't hurt to google 'informix select statements' and do a little reading to get the basics. There are millions of permutations of queries so it's a matter of understanding the syntax, and then applying that to the database in question. The only difference when running commands from the CLI are that:
    - You prefix the standard informix SQL statement with 'run sql'
    - You don't get any help from CUCM with the syntax, so you might be well advised to use something that understands SQL a little and colorises it as you type, and then paste the resulting commands into the CUCM SSH window. I use a text editor named JEdit, if you create a text file and save it as a file ending in .sql it will highlight your syntax.
    - Other programs are available that do reasonable syntax highlighting (e.q. SquirrelSQL) that are designed for querying the DB directly, but you can't actually query directly against the DB for security reasons. You'd still have to copy/paste the commands.
    Now... to understand the DB you'll need a reference describing all the tables etc. This is here:
    http://www.cisco.com/en/US/products/sw/voicesw/ps556/products_programming_reference_guides_list.html
    Pick your version of CUCM and download the 'Data Definition' document.
    A few notes on the command:
    run sql : is just the CLI command that tells the shell to run the following text as SQL.
    select : the SQL command to retrieve data
    dnorpattern,cfadestination,cfavoicemailenabled : the column names to retrieve
    callforwarddynamic c, numplan n : the names of two tables, and the abbreviations you want to refer to them as
    where c.fknumplan = n.pkid : this tells SQL to return values from the two tables where these fields match up. In the data definition you'll see notes that c.fknumplan (i.e. the fknumplan column in the callforwarddynamic table, as noted by the c. prefix) refers to the PKID column in the numplan field. This is a very standard type of join in the CCM DB.
    and (cfadestination != '' or cfavoicemailenabled ='t') : another clause, basically in this query we want to see only rows where cfadestination isn't blank or cfavoicefmailenabled is set to 't' for true).
    Most tables are linked in one of two ways in this database:
    - a column prefixed 'fk' refers to the pkid field (there is always only one pkid field per table) in the table following the 'fk' prefix. E.g. above fknumplan refers to the numplan table, pkid field. fkdevice would refer to the device table, pkid field.
    - a column prefiex 'tk' refers usually to an enum table which is prefixed with 'type'. This is a table that maps the number value in the 'tk' field to a string. An example would be tkmodel - this represents the phone physical model type (e.g. 7962), and maps to a table called typemodel, and the 'enum' column in that table.
    Regards
    Aaron HarrisonPrincipal Engineer at Logicalis UK
    Please rate helpful posts...

  • How to undelete history for 1 day?

    I need to know how to undelete history for 1 day.

    You can try to restore the places.sqlite file via the Time Machine to a version from before deleting that history.
    *http://www.apple.com/support/timemachine/
    You can use this button to go to the Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)
    *https://support.mozilla.org/kb/Recovering+important+data+from+an+old+profile
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • How to see history in Oracle SQL

    how to see history in Oracle SQL
    i.e
    create table.....
    select * from tablename....
    delete tablename;
    Now i want to see how many command run after login.......please tell me the command...

    user12261139 wrote:
    how to see history in Oracle SQL
    i.e
    create table.....
    select * from tablename....
    delete tablename;
    Now i want to see how many command run after login.......please tell me the command...I'm not aware of an easy way to see how many commands were run after logging on. Different tools have different capabilities, though.
    The ms-dos version of SQL*PLUS offers a Doskey option to use the up and down arrows to recover recently executed commands.
    The SQL Workshop in Apex has a command history. Some of the GUI tools might offer similar functionality.

  • How to pull Data from SQL server in FDM

    Hi Experts
    How to pull the HFM data from One SQL server to Another SQL Server using integration scripts in FDQM?
    regards
    Dev

    Could you clarify why you want to do this?
    If you are trying to synchronize two databases (apps) to have a backup or something running in a development environment, I would suggest configuring replication between the two databases. It would be much more efficient to do this at the SQL Server level than through the FDM application, IMHO.
    Charles

Maybe you are looking for