SQL Developer get time when query is run - oracle

I am using sql developer to fire some queries. I want to know the time when query has run. I see that when you fire sql query, you can see "Task completed in x seconds". But here I want to see the time when query got execute. Is there a way like showtimestamp or something?

Add select to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') from dual; if the scripts can be modified.
If that's not an option then right-click on the Worksheet and select SQL History:

Related

query ORACLE database during springboot application no response

A sql like "SELECT COUNT(1) FROM tablename..." was executed by my springboot application with mybatis,but no response during a long time.
But when I executed the same sql directly in ORACLE,it worked and returned the response.
With executing these sql:
select event,count(*) from v$session_wait group by event order by 2 desc;
I found the 'latch:cache buffers chains' event.
I asked my frined and he told me that I can execute analyze table tablename compute statistics.
After executed the sql,the problem resolved,the select count sql executed by springboot application worked !
I feel puzzled,why the analyze sql worked?
Thank you.

Restrict sql execution for multiple users in oracle

I am new to oracle. I am using oracle database 19c. I need to restrict the query execution in such a way that if a query is executed once, concurrent execution should get warning or wait until the first query is complete.
Example:
--First time execution
select count(*) from table;
--At the same time, another user execute the query
select count(*) from table; <<== Either wait or get a warning
Thanks in advance !

Error with Report Page in Oracle Application Express

I have a report based on a SQL Query, the report has 3 columns from v$session.
select distinct to_char(SQL_EXEC_START, 'DD/MM/YYYY HH24:MI') TIME_STARTED, module REPORT_NAME, action CURRENT_STEP from v$session where module like '%BOB%'
In SQL Developer, the query brings up what you would expect. However in the APEX report page, no matter what is in v$session, I always get (in addition) the following displayed at the top of the report page, in the actual report columns:
<DATE> Processes - point: BEFORE_BOX_BODY BOB01/APEX:APP 104:7
Can anyone tell me how to get rid of it, and simply output the query results into the report page, and nothing else?
It seems that it displays current report as well. So - remove it, e.g.
select distinct
to_char(SQL_EXEC_START, 'DD/MM/YYYY HH24:MI') TIME_STARTED,
module REPORT_NAME,
action CURRENT_STEP
from v$session
where module like '%BOB%'
-- add this
and module not like '%104:7%'
and current_step not like '%BEFORE_BOX_BODY%'

Recover SQL query results in SQL Developer?

So I worked on a bunch of queries yesterday, and before I could get to exporting the results to an external file, my database went down. Is there any way to see the results of your past few queries in SQL Developer? I know there are ways to see your past queries, but I am looking for the results of my queries. Finding them would save me and my team a lot of rework.
Any help would be much appreciated. Thanks!
Edit: I am asking how to find the results of the SQL queries I ran yesterday. Not the queries themselves.
Use a SELECT statement with an AS OF clause. This retrieves data as it existed at some point in the past.
For example, this query returns the record from current state for Chung.
SELECT * FROM employees
WHERE last_name = 'Chung';
And below query retrieves the state of the record for Chung at 9:30AM, April 4, 2004:
SELECT * FROM employees
AS OF TIMESTAMP
TO_TIMESTAMP('2004-04-04 09:30:00', 'YYYY-MM-DD HH:MI:SS')
WHERE last_name = 'Chung';
You can also restore like this:
INSERT INTO employees
(SELECT * FROM employees
AS OF TIMESTAMP
TO_TIMESTAMP('2004-04-04 09:30:00', 'YYYY-MM-DD HH:MI:SS')
WHERE last_name = 'Chung');
Drag the queries from SQL history to worksheet and modify with AS OF clause.
Refer to the source of this answer for more info:
https://docs.oracle.com/cd/B28359_01/appdev.111/b28424/adfns_flashback.htm#g1025568

How to get last compiled stage Procedure code in oracle?

Unfortunately i compiled my procedure with wrong code. is't possible
to get old compiled code in oracle.
I'm not sure, but if you are DBA and your server configured to using flashback queries you can try this:
select *
from dba_source AS OF TIMESTAMP
TO_TIMESTAMP('2016-12-14 09:30:00', 'YYYY-MM-DD HH:MI:SS')
where upper(text) like '%PROCEDURE_YOU_LOOKING_FOR%'
And of course you choose timestamp you need

Resources