How to find sql query history

hi friends ,
am using orcl 10g in my oracle enterprise server, we use this interface to connect the database Sql Developer Ver 1.1.3,
how to find the sql history, now i need to check 3 to 4 months back what are the update statement that has been queried and how to check the logs,
though i have checked lots of views such as v$sqlarea ... etc i couldnot find any queries, and why i couldnot open redo logs.
plz tell me is there any option to restrict update command in the future,
also help me how to find the history , or what i should do further ,
Waiting for ur results

Use this query to get last 3 month queries order by execution.
Query:
select * from (select module,sql_id,round(sum(CPU_TIME_DELTA)/1000000) "CPUTIME(S)",round(sum(ELAPSED_TIME_DELTA)/1000000) "E
LPSED(S)",round(sum(EXECUTIONS_DELTA)) "NUMOFEXEC",round(round(sum(ELAPSED_TIME_DELTA))/1000000)/(round(sum(EXECUTIONS_DELTA))) "Per Execution",sum(ROWS_PROCESSED_DELTA) "NUMOFROW",sum(DISK_READS_DELTA)/1024/1024 "DISK
READ(MB)",sum(BUFFER_GETS_DELTA)/1024/1024 "BUFFERREAD(MB)" from dba_hist_sqlstat where (snap_id between (select min(snap_id)
from dba_hist_snapshot where trunc(begin_interval_time)=trunc(sysdate-92 )) and (select max(snap_id) from dba_hist_snapshot
where trunc(begin_interval_time)=trunc(sysdate ))) and EXECUTIONS_DELTA>10 group by module,sql_id order by "NUMOFEXEC" desc
) where rownum < 51;

Similar Messages

  • How to find sql query using sqlid

    Hi
    I am not aware of that sqlid .DBA is saying a particular sqlid is making problem .how to find the particular sql query using sql_id ?

    Are you aware of modplsql when i executed the query the result is like
    DECLARE
       rc__             NUMBER;
       simple_list__    OWA_UTIL.vc_arr;
       complex_list__   OWA_UTIL.vc_arr;
    BEGIN
       OWA.init_cgi_env (:n__, :nm__, :v__);
       HTP.htbuf_len := 84;
       NULL;
       NULL;
       simple_list__ (1) := 'sys.%';
       simple_list__ (2) := 'dbms\_%';
       simple_list__ (3) := 'utl\_%';
       simple_list__ (4) := 'owa\_%';
       simple_list__ (5) := 'owa.%';
       simple_list__ (6) := 'htp.%';
       simple_list__ (7) := 'htf.%';
       simple_list__ (8) := 'wpg_docload.%';
       IF ((owa_match.match_pattern ('Oly_browse.oly_pattern ',
                                     simple_list__,
                                     complex_list__,
                                     TRUE
       THEN
          rc__ := 2;
       ELSE
          NULL;
          NULL;
         oly_browse.oly_pattern (search_phrase      => :search_phrase,           --Oly_browse.oly_pattern is package name
                                btn                => :btn,
                                p_qual             => :p_qual,
                                p_bcat             => :p_bcat,
                                p_stdy             => :p_stdy,
                                p_bloc             => :p_bloc,
                                z                  => :z
          IF (WPG_DOCLOAD.is_file_download)
          THEN
             rc__ := 1;
             WPG_DOCLOAD.get_download_file (:doc_info);
             NULL;
             NULL;
             NULL;
             COMMIT;
          ELSE
             rc__ := 0;
             NULL;
             NULL;
             NULL;
             COMMIT;
             OWA.get_page (:data__, :ndata__);
          END IF;
       END IF;
       :rc__ := rc__;
    END; Edited by: vishnu prakash on Sep 8, 2010 10:16 PM

  • How to find sql query using hash value

    Hi,
    DBVERSION: 9.2.0.8
    I generated statspack report and i want to see total query and i have hash_value here.
    in v$sql am not able to see all the querys ...pls suggest me other ways..
    Thanks,
    Srini...

    Srini wrote:
    Thanks Nikolay,
    But that views are not available in 9i , my DB is in 9.2.0.8...Use v$SQLAREA
    SQL> desc v$sqlarea
    Name                                      Null?    Type
    SQL_TEXT                                           VARCHAR2(1000)
    SQL_FULLTEXT                                       CLOB
    SQL_ID                                             VARCHAR2(13)
    SHARABLE_MEM                                       NUMBER
    PERSISTENT_MEM                                     NUMBER
    RUNTIME_MEM                                        NUMBER
    SORTS                                              NUMBER
    VERSION_COUNT                                      NUMBER
    LOADED_VERSIONS                                    NUMBER
    OPEN_VERSIONS                                      NUMBER
    USERS_OPENING                                      NUMBER
    FETCHES                                            NUMBER
    EXECUTIONS                                         NUMBER
    PX_SERVERS_EXECUTIONS                              NUMBER
    END_OF_FETCH_COUNT                                 NUMBER
    USERS_EXECUTING                                    NUMBER
    LOADS                                              NUMBER
    FIRST_LOAD_TIME                                    VARCHAR2(19)
    INVALIDATIONS                                      NUMBER
    PARSE_CALLS                                        NUMBER
    DISK_READS                                         NUMBER
    DIRECT_WRITES                                      NUMBER
    BUFFER_GETS                                        NUMBER
    APPLICATION_WAIT_TIME                              NUMBER
    CONCURRENCY_WAIT_TIME                              NUMBER
    CLUSTER_WAIT_TIME                                  NUMBER
    USER_IO_WAIT_TIME                                  NUMBER
    PLSQL_EXEC_TIME                                    NUMBER
    JAVA_EXEC_TIME                                     NUMBER
    ROWS_PROCESSED                                     NUMBER
    COMMAND_TYPE                                       NUMBER
    OPTIMIZER_MODE                                     VARCHAR2(10)
    OPTIMIZER_COST                                     NUMBER
    OPTIMIZER_ENV                                      RAW(2000)
    OPTIMIZER_ENV_HASH_VALUE                           NUMBER
    PARSING_USER_ID                                    NUMBER
    PARSING_SCHEMA_ID                                  NUMBER
    PARSING_SCHEMA_NAME                                VARCHAR2(30)
    KEPT_VERSIONS                                      NUMBER
    ADDRESS                                            RAW(4)
    HASH_VALUE                                         NUMBER
    OLD_HASH_VALUE                                     NUMBER
    PLAN_HASH_VALUE                                    NUMBER
    MODULE                                             VARCHAR2(64)
    MODULE_HASH                                        NUMBER
    ACTION                                             VARCHAR2(64)
    ACTION_HASH                                        NUMBER
    SERIALIZABLE_ABORTS                                NUMBER
    OUTLINE_CATEGORY                                   VARCHAR2(64)
    CPU_TIME                                           NUMBER
    ELAPSED_TIME                                       NUMBER
    OUTLINE_SID                                        VARCHAR2(40)
    LAST_ACTIVE_CHILD_ADDRESS                          RAW(4)
    REMOTE                                             VARCHAR2(1)
    OBJECT_STATUS                                      VARCHAR2(19)
    LITERAL_HASH_VALUE                                 NUMBER
    LAST_LOAD_TIME                                     DATE
    IS_OBSOLETE                                        VARCHAR2(1)
    IS_BIND_SENSITIVE                                  VARCHAR2(1)
    IS_BIND_AWARE                                      VARCHAR2(1)
    CHILD_LATCH                                        NUMBER
    SQL_PROFILE                                        VARCHAR2(64)
    SQL_PATCH                                          VARCHAR2(30)
    SQL_PLAN_BASELINE                                  VARCHAR2(30)
    PROGRAM_ID                                         NUMBER
    PROGRAM_LINE#                                      NUMBER
    EXACT_MATCHING_SIGNATURE                           NUMBER
    FORCE_MATCHING_SIGNATURE                           NUMBER
    LAST_ACTIVE_TIME                                   DATE
    BIND_DATA                                          RAW(2000)
    TYPECHECK_MEM                                      NUMBER
    IO_CELL_OFFLOAD_ELIGIBLE_BYTES                     NUMBER
    IO_INTERCONNECT_BYTES                              NUMBER
    PHYSICAL_READ_REQUESTS                             NUMBER
    PHYSICAL_READ_BYTES                                NUMBER
    PHYSICAL_WRITE_REQUESTS                            NUMBER
    PHYSICAL_WRITE_BYTES                               NUMBER
    OPTIMIZED_PHY_READ_REQUESTS                        NUMBER
    LOCKED_TOTAL                                       NUMBER
    PINNED_TOTAL                                       NUMBER
    IO_CELL_UNCOMPRESSED_BYTES                         NUMBER
    IO_CELL_OFFLOAD_RETURNED_BYTES                     NUMBERYou have HASH_VALUE and SQL_FULLTEXT to identify your query. Remember if query is long then you needt to set proper parameters like
    set long 80000
    set pagesize 200
    set linessize 200
    Was that helpful?

  • How Can I find SQL Query in Database

    Dear Experts,
    How Can I find SQL Query in Database.

    Hi,
    U mena what query got executed in db? u can try V$SQL for it.
    Regards
    Bharath

  • How to find database query

    Hi all,
    how to find physical query from report here m checking like Administrator->manage session--> report-->view log
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- SQL Request:
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- General Query Info:
    Repository: Star, Subject Area: AAA, Presentation: AAA
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Cache Hit on query:
    Matching Query:     Created by:     Administrator
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Query Status: Successful Completion
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Physical Query Summary Stats: Number of physical queries 1, Cumulative time 0, DB-connect time 0 (seconds)
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Rows returned to Client 6
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Logical Query Summary Stats: Elapsed time 0, Response time 0, Compilation time 0 (seconds)
    but here m not able to find database query..how to find that query plz help
    Edited by: Sonal on Jan 3, 2011 5:29 AM
    Edited by: Sonal on Jan 3, 2011 5:30 AM
    Edited by: Sonal on Jan 3, 2011 5:30 AM

    Hi,
    as Daan said, set the variable in Advanced tab but not on loglevel..
    because, our problem is to bypass the bi-server cache.
    Do this:
    1. Go to Advanced tab.
    2. In Prefix field(scroll down to see this field) , enter this:
    SET DISABLE_CACHE_HIT = 1;
    Note: Make sure that you're ended up above statement with semicolon and do not click on Set SQL option...
    3. Save report, then run it..
    4. After you see the query, i recommend you to take take out that prefix tag then save it again..

  • How to Use SQL Query having IN Clause With DB Adapter

    Hi,
    I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
    Thanks

    invoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter

  • How to find which query taking more cpu

    Hi,
    How to find which query taking more CPU
    at a particular point of time .
    Chhers,

    Take a look at Server Standard Reports. It has a few CPU usage oriented reports.
    You can also track CPU usage by server-side tracing:
    http://www.sqlusa.com/bestpractices/createtrace/
    Glenn Berry's CPU usage query:
    SELECT TOP(25) p.name AS [SP Name], qs.total_worker_time AS [TotalWorkerTime],
    qs.total_worker_time/qs.execution_count AS [AvgWorkerTime], qs.execution_count,
    ISNULL(qs.execution_count/DATEDIFF(Second, qs.cached_time, GETDATE()), 0) AS [Calls/Second],
    qs.total_elapsed_time, qs.total_elapsed_time/qs.execution_count
    AS [avg_elapsed_time], qs.cached_time
    FROM sys.procedures AS p WITH (NOLOCK)
    INNER JOIN sys.dm_exec_procedure_stats AS qs WITH (NOLOCK)
    ON p.[object_id] = qs.[object_id]
    WHERE qs.database_id = DB_ID()
    ORDER BY qs.total_worker_time DESC OPTION (RECOMPILE);
    LINK:
    http://dba.stackexchange.com/questions/52216/sql-server-2008-high-cpu-historical-queries
    Query optimization:
    http://www.sqlusa.com/articles/query-optimization/
    Kalman Toth Database & OLAP Architect
    SELECT Video Tutorials 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to transport SQL Query from SQVI Tcode?

    Dear Friends,
    Can any one tell me how to transport SQL Query from <b>SQVI</b> Tcode.
    Full Points will be rewarded.
    Thanks & Reagrds
    Ravi

    go to sqvi tool .....
    select u r query name ......in the menubar ....quickview....> additianal functions.......>generate program
    after doing generate program ....go to again same menu path as i have mentioned above [quickview....> additianal functions.......>display report name it will give the report name of the select query ..........copy the report name and give it abap editor[se38] u will get u r query program......with all authority checks.....
    in start of selection event of u r program u will find u r select query.
    reward points if helpful

  • How does a SQL query work

    Hi all...
    How does a SQL query basically work? Is there any pseudocode for it?
    How ro calculate the cost of query?
    Can we find out what would be the execution time for a query before it is executed?
    Thanks in advance.
    Ameya

    Hi Avinash,
    Look closely mate!!!
    You have done set autotrace on... meaning you are executing the statement while i am doing set autotrace traceonly explain meaning the statement would never get executed actually.. oracle optimizer will just select the desired plan and will show the output..
    You can even ESTIMATE how many rows the qeury will return before even executing the statement using the same above tech.. i will show you how:
    The explain plan gives this -- as long as you are using the CBO (cost based
    optimizer). Doesn't matter if you have 1 or 50 tables. The last part of the
    plan is the estimate output.
    consider:
    SQL> set autotrace traceonly explain
    SQL> select e1.*, e2.* from emp e1, emp e2;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=15 Card=196 Bytes=12544)
    1 0 MERGE JOIN (CARTESIAN) (Cost=15 Card=196 Bytes=12544)
    2 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=448)
    3 1 SORT (JOIN) (Cost=14 Card=14 Bytes=448)
    4 3 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=448)
    196 = 14 * 14 -- thats right....
    SQL> select emp.ename, mgr.ename from
    2 emp, emp mgr
    3 where emp.mgr = mgr.empno;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=13 Bytes=208)
    1 0 MERGE JOIN (Cost=5 Card=13 Bytes=208)
    2 1 SORT (JOIN) (Cost=3 Card=14 Bytes=112)
    3 2 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=112)
    4 1 SORT (JOIN) (Cost=3 Card=14 Bytes=112)
    5 4 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=112)
    Here is estimated that about 13 rows would be returned...
    SQL> select count(*) from emp;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1)
    1 0 SORT (AGGREGATE)
    2 1 INDEX (FULL SCAN) OF 'EMP_PK' (UNIQUE) (Cost=1 Card=14)
    one row...
    SQL> select ename, dname
    2 from emp, dept where emp.deptno = dept.deptno;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=14 Bytes=252)
    1 0 NESTED LOOPS (Cost=5 Card=14 Bytes=252)
    2 1 TABLE ACCESS (FULL) OF 'DEPT' (Cost=1 Card=4 Bytes=44)
    3 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=98)
    14 rows...
    1 select ename, dname
    2* from emp, dept where emp.deptno = dept.deptno and emp.ename like '%A%'
    SQL> /
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=18)
    1 0 NESTED LOOPS (Cost=2 Card=1 Bytes=18)
    2 1 TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=1 Bytes=7)
    3 1 TABLE ACCESS (BY INDEX ROWID) OF 'DEPT' (Cost=1 Card=4 Bytes=44)
    4 3 INDEX (RANGE SCAN) OF 'DEPT_IDX' (NON-UNIQUE)
    1 rows.....
    and this was all done without executing the query. See EXPLAIN plan and the
    PLAN_TABLE.

  • How to find a query name from report name

    I have a report in my system with the name AQICMM==========P2============ . I believe this was created from a query. How to find the query corresponding to this report ? I need to change the logic for certain columns of the report. How to know if this was created from SQVI or SQ01 or any other transaction.
    THanks.

    Found it..Query name is P2. It was in a different query area..Standard area and not custom area where I was initially looking at.
    Edited by: Shareen Hegde on Aug 22, 2008 5:14 PM

  • Hi.. I have a new apple computer and have no idea how to find stuff on here... Can someone tell me how to find my search history? Thanks

    Hi.. I have a new apple computer and have no idea how to find stuff on here... Can someone tell me how to find my search history? Thanks

    In addition to Japib's suggestion check out
    OS X Yosemite: See your files in the Finder
    OS X Yosemite: Finder preferences
    OS X Yosemite: Ways to quickly see and open items
    OS X Yosemite: Search with Spotlight
    OS X Yosemite: Rename files, folders, and disks
    OS X Yosemite: Folder basics
    OS X Yosemite: Ways to organize files on your desktop
    One more thing:
    Search history is a term generally referring to what sites you have visited via your browser (e.g. Safari)
    To see your Safari search history just open Safari and go to the top menu and select from Show History from the History
    See two pics below

  • How to use sql query in java ?

    i don't know how to use sql query in java code.
    who can give me some advice?
    thanks

    http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/

  • How to find out query name using Elements of the query builder.

    Hi SDNers,
    how to find out query name using Elements of the query .
    thanks,
    satyaa

    Hi,
    For having a look at the relation between BEx tables,check the link below:
    http://wiki.sdn.sap.com/wiki/display/BI/ExploretherelationbetweenBEx+Tables
    -Vikram

  • How to find sql statement with Unix process pid

    Hi
    how to find sql statement with Unix process pid
    is there any view to find that.
    please if so let me know
    Thanks in advance

    this is how I am doing this:
    oracle 7352340 7459066 0 07:47:10 - 0:00 oracleJDERED (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
    oracle 7459066 5386396 2 07:47:10 pts/1 0:01 sqlplus
    select sid,serial# from v$session where process='7459066';
    SID SERIAL#
    2178 6067
    select sql_text
    from
    v$sqlarea a,
    v$session b
    where a.hash_value = b.sql_hash_value
    and b.sid = 2178
    ;

  • How to execute SQL Query in Code behind Using infopath 2010?

    Hi,
    I've repeatable on infopath form, and want bind it throuth code behind from SQL table. My question is that how to execute SQL Query in code behind from infopath as well as how would get Query result to bind repeatable control?
    Thanks In Advance
    Shoeb Ahmad

    Hello,
    You first need to add new SQL DB connection then you need execute connection from code behind.
    See below link to create new connection
    http://office.microsoft.com/en-in/infopath-help/add-a-data-connection-to-a-microsoft-sql-server-database-HP010092823.aspx:
    http://www.bizsupportonline.net/infopath2010/connect-infopath-2010-sql-server-2008-table.htm
    Then use below code to execute this connection:
    AdoQueryConnection conn = (AdoQueryConnection)(this.DataConnections["Data connection name"]);
    string origCommand = Select * from tablename;
    conn.Command = origCommand;
    conn.Execute();
    Finally bind your table:
    http://www.bizsupportonline.net/infopath2007/4-way-programmatically-add-row-repeating-table.htm
    http://stevemannspath.blogspot.in/2010/09/infopath-20072010-populate-repeating.html
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

Maybe you are looking for

  • Expanding Text Box

    Good afternoon, I've recently converted an old Wordperfect document to PDF.  The form has many fillable fields, which have been setup and are working fine.  In the middle of the page, however, there is a place for the person to put in a narrative.  T

  • Getting a error while running creating a sample page on sharepoint 2013 and visual studio 2013

    hi,    When i trying to create a sample web service for create page dynamically to sharepoint 2013 using visualstudio 2013 getting a error message while consume  the web service browser itself. so i have tried to change the target platform but to 32

  • I wiped my computer, and now iTunes doesn't work. Does iTunes no longer work with Leopard, or did I do something wrong?

    I wiped the computer using the original OS disk so I could give it to my mom in July. iTunes worked when I did it. I just updated the system and tried logging onto iTunes for the first time since I wiped the memory. I can log on, but nothing appears

  • Touchsmart series and lack of hdmi in/out

    I signed up to this forum after searching around for info on hdmi in/out. I have not purchased an HP in about 5 years, I saw a touchsmart at costco and thought very nice. HOWEVER, as I google around there seems to be a general lack of HDMI support :

  • Safari and forms

    Hi Everyone! I couldn't post this in the Safari forums. I kept getting an error message I was just wondering. Why is Safari still so bad with sites that have forms to fill in? I go to a lot of different sites where there might be an online form and S