col long_opname head OPNAME for a40 col long_target head TARGET for a40 col long_units head UNITS for a10 prompt Show session long operations from v$session_longops for sid &1 select sid, serial#, opname long_opname, target long_target, sofar, totalwork, units long_units, time_remaining, start_time, elapsed_seconds /*, target_desc, last_update_time, username, sql_address, sql_hash_value */ from v$session_longops where sid in (&1) and sofar != totalwork /
Showing posts with label Oracle DBA query collection. Show all posts
Showing posts with label Oracle DBA query collection. Show all posts
Saturday, June 21, 2014
Oracle - Long running SQL
Sunday, June 8, 2014
Script to find redo generated by current sessions
#################################################
Redo generated by current sessions
#################################################
select v$session.sid, username, value redo_size
from v$sesstat, v$statname, v$session
where v$sesstat.STATISTIC# = v$statname.STATISTIC#
and v$session.sid = v$sesstat.sid
and name = ‘redo size’
and value > 0
and username is not null
order by value
/
Labels:
Interview questions,
Migration,
MySQL,
Oracle backups,
Oracle Block Corruption,
Oracle database Switch over procedure,
Oracle Datagaurd- Standby database,
Oracle DBA query collection,
Oracle errors and solutions,
Oracle Golden gate,
Oracle Listener,
Oracle Materialized view queries,
Oracle OraInventory,
Oracle Performance tuning,
Oracle queries,
Oracle Row chaining,
Oracle sessions related,
Unix/Linux Related
To check INACTIVE sessions with HIGH DISK IO
To check INACTIVE sessions with HIGH DISK IO
=============================================
select p.spid,s.username, s.sid,s.status,t.disk_reads, s.last_call_et/3600 last_call_et_Hrs,
s.action,s.program,s.machine cli_mach,s.process cli_process,lpad(t.sql_text,30) “Last SQL”
from gv$session s, gv$sqlarea t,v$process p
where s.sql_address =t.address and
s.sql_hash_value =t.hash_value and
p.addr=s.paddr and
t.disk_reads > 5000
and s.status=’INACTIVE’
and s.process=’1234′
order by S.PROGRAM;
s.action,s.program,s.machine cli_mach,s.process cli_process,lpad(t.sql_text,30) “Last SQL”
from gv$session s, gv$sqlarea t,v$process p
where s.sql_address =t.address and
s.sql_hash_value =t.hash_value and
p.addr=s.paddr and
t.disk_reads > 5000
and s.status=’INACTIVE’
and s.process=’1234′
order by S.PROGRAM;
=================================================================
Labels:
Interview questions,
Migration,
MySQL,
Oracle backups,
Oracle Block Corruption,
Oracle database Switch over procedure,
Oracle Datagaurd- Standby database,
Oracle DBA query collection,
Oracle errors and solutions,
Oracle Golden gate,
Oracle Listener,
Oracle Materialized view queries,
Oracle OraInventory,
Oracle Performance tuning,
Oracle queries,
Oracle Row chaining,
Oracle sessions related,
Unix/Linux Related
To Check the sessions having high DISK I/o’s
To Check the sessions having the DISK I/o’s
==========================
prompt SESSIONS PERFORMING HIGH I/O > 50000
select p.spid, s.sid,s.process cli_process, s.status,t.disk_reads, s.last_call_et/3600 last_call_et_Hrs,
s.action,s.program,lpad(t.sql_text,30) “Last SQL”
from v$session s, v$sqlarea t,v$process p
where s.sql_address =t.address and
s.sql_hash_value =t.hash_value and
p.addr=s.paddr and
t.disk_reads > 10000
order by t.disk_reads desc;
s.action,s.program,lpad(t.sql_text,30) “Last SQL”
from v$session s, v$sqlarea t,v$process p
where s.sql_address =t.address and
s.sql_hash_value =t.hash_value and
p.addr=s.paddr and
t.disk_reads > 10000
order by t.disk_reads desc;
=============================================
Saturday, May 3, 2014
Check long running queries - check time remaining
Check the time remaining :
SELECT
opname,
target,
ROUND((sofar/totalwork),4)*100 Percentage_Complete,
start_time,
CEIL(time_remaining/60) Max_Time_Remaining_In_Min,
FLOOR(elapsed_seconds/60) Time_Spent_In_Min
FROM v$session_longops
WHERE sofar != totalwork;
Friday, May 2, 2014
Import job progress query
Import job progress query
select substr(sql_text,instr(sql_text,'INTO "'),30) table_name,
rows_processed,
round((sysdate-to_date(first_load_time,'yyyy-mm-dd hh24:mi:ss'))*24*60,1) minutes,
trunc(rows_processed/((sysdate-to_date(first_load_time,'yyyy-mm-dd hh24:mi:ss'))*24*60)) rows_per_min
from sys.v_$sqlarea
where sql_text like 'INSERT %INTO "%'
and command_type = 2
and open_versions > 0;
select substr(sql_text,instr(sql_text,'INTO "'),30) table_name,
rows_processed,
round((sysdate-to_date(first_load_time,'yyyy-mm-dd hh24:mi:ss'))*24*60,1) minutes,
trunc(rows_processed/((sysdate-to_date(first_load_time,'yyyy-mm-dd hh24:mi:ss'))*24*60)) rows_per_min
from sys.v_$sqlarea
where sql_text like 'INSERT %INTO "%'
and command_type = 2
and open_versions > 0;
Monday, April 14, 2014
Performance tuning links
http://www.oracle.com/technetwork/issue-archive/2012/12-nov/o62dba-1741123.html
http://docs.oracle.com/cd/E11882_01/server.112/e10822/toc.htm
http://docs.oracle.com/cd/E11882_01/server.112/e10822/toc.htm
Labels:
Interview questions,
Migration,
MySQL,
Oracle backups,
Oracle Block Corruption,
Oracle Datagaurd- Standby database,
Oracle DBA query collection,
Oracle Golden gate,
Oracle Listener,
Oracle Materialized view queries,
Oracle OraInventory,
Oracle Performance tuning,
Oracle queries,
Oracle Row chaining,
Oracle sessions related,
Unix/Linux Related
Thursday, April 10, 2014
Query to find pid of lgwr
SQL> select pid, program from v$process where program like '%LGWR%';
----------------------------------------------------------------------------------------
SQL> SELECT p.spid, s.program
2 FROM v$session s, v$process p
3 WHERE s.paddr=p.addr
4 AND s.program LIKE '%LGWR%';
2 FROM v$session s, v$process p
3 WHERE s.paddr=p.addr
4 AND s.program LIKE '%LGWR%';
------------------------ ------------------------------------------------
26803 oracle@orcl11gR2.us.oracle.com (LGWR)
ps -ef | grep 26803 | grep -v grep
oracle 26803 1 0 Jan 14 ? 2:11 ora_lgwr_ORCL11GR2
oracle 26803 1 0 Jan 14 ? 2:11 ora_lgwr_ORCL11GR2
Monday, March 24, 2014
Command to list larger files in Unix
Command to list larger files in Unix
du -sh * |sort -n -r |head -10
du -sh * |sort -n -r |head -10
Labels:
Interview questions,
Migration,
MySQL,
Oracle backups,
Oracle Datagaurd- Standby database,
Oracle DBA query collection,
Oracle Golden gate,
Oracle Materialized view queries,
Oracle Performance tuning,
Oracle queries,
Oracle Row chaining,
Unix/Linux Related
Thursday, January 16, 2014
Determining the Job ID for Each Refresh Job at a Materialized View Site
Determining the Job ID for Each Refresh Job at a Materialized View Site
You can use the query in this section to list the following information about the refresh jobs at a materialized view site:
- The job identification number of each refresh job. Each job created by the
DBMS_JOBpackage is assigned a unique identification number. - The privilege schema, which is the schema whose default privileges apply to the job.
- The schema that owns each refresh job. Typically, the materialized view administrator owns a refresh job. A common username for the materialized view administrator is
mviewadmin. - The name of the refresh group that the job refreshes.
- The status of the refresh job, either normal or broken.
The following query displays this information:
COLUMN JOB HEADING 'Job ID' FORMAT 999999
COLUMN PRIV_USER HEADING 'Privilege|Schema' FORMAT A10
COLUMN RNAME HEADING 'Refresh|Group|Name' FORMAT A10
COLUMN ROWNER HEADING 'Refresh|Group|Owner' FORMAT A10
COLUMN BROKEN HEADING 'Broken?' FORMAT A7
SELECT J.JOB,
J.PRIV_USER,
R.ROWNER,
R.RNAME,
J.BROKEN
FROM DBA_REFRESH R, DBA_JOBS J
WHERE R.JOB = J.JOB
ORDER BY 1;
Your output looks similar to the following:
Refresh Refresh
Privilege Group Group
Job ID Schema Owner Name Broken?
------- ---------- ---------- ---------- -------
21 MVIEWADMIN MVIEWADMIN HR_REFG N
The
N in the Broken? column means that the job is not broken. Therefore, the job will run at the next start time. A Y in this column means that the job is broken.Listing Information About the Refresh Groups at a Materialized View Site
Listing Information About the Refresh Groups at a Materialized View Site
Each refresh group at a materialized view site is associated with a refresh job that refreshes the materialized views in the refresh group at a set interval. You can query the
DBA_REFRESH data dictionary view to list the following information about the refresh jobs at a materialized view site:- The name of the refresh group.
- The owner of the refresh group.
- Whether the refresh job is broken.
- The next date and time when the refresh job will run.
- The current interval setting for the refresh job. The interval setting specifies the amount of time between the start of a job and the next start of the same job.
The following query displays this information:
COLUMN RNAME HEADING 'Refresh|Group|Name' FORMAT A10
COLUMN ROWNER HEADING 'Refresh|Group|Owner' FORMAT A10
COLUMN BROKEN HEADING 'Broken?' FORMAT A7
COLUMN next_refresh HEADING 'Next Refresh'
COLUMN INTERVAL HEADING 'Interval' FORMAT A20
SELECT RNAME,
ROWNER,
BROKEN,
TO_CHAR(NEXT_DATE, 'DD-MON-YYYY HH:MI:SS AM') next_refresh,
INTERVAL
FROM DBA_REFRESH
ORDER BY 1;
Your output looks similar to the following:
Refresh Refresh Group Group Name Owner Broken? Next Refresh Interval ---------- ---------- ------- ----------------------- -------------------- HR_REFG MVIEWADMIN N 24-OCT-2003 07:18:44 AM SYSDATE + 1/24
The
N in the Broken? column means that the job is not broken. Therefore, the refresh job will run at the next start time. A Y in this column means that the job is broken.Listing the Properties of Materialized Views
Listing the Properties of Materialized Views
You can use the query in this section to list the following information about the materialized views at the current replication site:
- The name of each materialized view
- The owner of each materialized view
- The refresh method used by each materialized view:
COMPLETE,FORCE,FAST, orNEVER - Whether a materialized view is updatable
- The last date on which each materialized view was refreshed
Run the following query to list this information:
COLUMN MVIEW_NAME HEADING 'Materialized|View Name' FORMAT A15
COLUMN OWNER HEADING 'Owner' FORMAT A10
COLUMN REFRESH_METHOD HEADING 'Refresh|Method' FORMAT A10
COLUMN UPDATABLE HEADING 'Updatable?' FORMAT A10
COLUMN LAST_REFRESH_DATE HEADING 'Last|Refresh|Date'
COLUMN LAST_REFRESH_TYPE HEADING 'Last|Refresh|Type' FORMAT A15
SELECT MVIEW_NAME,
OWNER,
REFRESH_METHOD,
UPDATABLE,
LAST_REFRESH_DATE,
LAST_REFRESH_TYPE
FROM DBA_MVIEWS;
Your output looks similar to the following:
Last Last Materialized Refresh Refresh Refresh View Name Owner Method Updatable? Date Type --------------- ---------- ---------- ---------- --------- --------------- COUNTRIES_MV1 HR FAST Y 21-OCT-03 FAST DEPARTMENTS_MV1 HR FAST Y 21-OCT-03 FAST EMPLOYEES_MV1 HR FAST Y 21-OCT-03 FAST JOBS_MV1 HR FAST Y 21-OCT-03 FAST JOB_HISTORY_MV1 HR FAST Y 21-OCT-03 FAST LOCATIONS_MV1 HR FAST Y 21-OCT-03 FAST REGIONS_MV1 HR FAST Y 21-OCT-03 FAST
Listing Master Information For Materialized Views
Listing Information About Materialized Views
This section contains queries that you can run to display information about the materialized views at a replication site.
Listing Master Information For Materialized Views
The following query shows the master for each materialized view at a replication site and whether the materialized view can be fast refreshed:
COLUMN MVIEW_NAME HEADING 'Materialized|View Name' FORMAT A15
COLUMN OWNER HEADING 'Owner' FORMAT A10
COLUMN MASTER_LINK HEADING 'Master Link' FORMAT A30
COLUMN Fast_Refresh HEADING 'Fast|Refreshable?' FORMAT A16
SELECT MVIEW_NAME,
OWNER,
MASTER_LINK,
DECODE(FAST_REFRESHABLE,
'NO', 'NO',
'DML', 'YES',
'DIRLOAD', 'DIRECT LOAD ONLY',
'DIRLOAD_DML', 'YES',
'DIRLOAD_LIMITEDDML', 'LIMITED') Fast_Refresh
FROM DBA_MVIEWS;
Your output looks similar to the following:
Materialized Fast View Name Owner Master Link Refreshable? --------------- ---------- ------------------------------ ---------------- COUNTRIES_MV1 HR @ORC1.WORLD YES DEPARTMENTS_MV1 HR @ORC1.WORLD YES EMPLOYEES_MV1 HR @ORC1.WORLD YES JOBS_MV1 HR @ORC1.WORLD YES JOB_HISTORY_MV1 HR @ORC1.WORLD YES LOCATIONS_MV1 HR @ORC1.WORLD YES REGIONS_MV1 HR @ORC1.WORLD YES
Listing General Information About Materialized View Groups
Listing General Information About Materialized View Groups
You can use the query in this section to list the following general information about the materialized view groups at the current materialized view site:
- The name of each materialized view group
- The master of each materialized view group
- The method of propagation to a materialized view group
's master, either asynchronous or synchronous - The comment associated with each materialized view group
Run the following query to list this information:
COLUMN GNAME HEADING 'Group Name' FORMAT A10
COLUMN DBLINK HEADING 'Master' FORMAT A25
COLUMN Propagation HEADING 'Propagation|Method' FORMAT A12
COLUMN SCHEMA_COMMENT HEADING 'Comment' FORMAT A30
SELECT S.GNAME,
S.DBLINK,
DECODE(S.PROP_UPDATES,
0, 'ASYNCHRONOUS',
1, 'SYNCHRONOUS') Propagation,
G.SCHEMA_COMMENT
FROM DBA_REPSITES S, DBA_REPGROUP G
WHERE S.GNAME = G.GNAME
AND S.SNAPMASTER = 'Y';
Your output looks similar to the following:
Propagation Group Name Master Method Comment ---------- ------------------------- ------------ ------------------------------ HR_REPG ORC1.WORLD ASYNCHRONOUS
Determining Which Materialized Views Are Currently Refreshing
Determining Which Materialized Views Are Currently Refreshing
The following query shows the materialized views that are currently refreshing:
COLUMN SID HEADING 'Session|Identifier' FORMAT 9999 COLUMN SERIAL# HEADING 'Serial|Number' FORMAT 999999 COLUMN CURRMVOWNER HEADING 'Owner' FORMAT A15 COLUMN CURRMVNAME HEADING 'Materialized|View' FORMAT A25 SELECT * FROM V$MVREFRESH;
Your output looks similar to the following:
Session Serial Materialized
Identifier Number Owner View
---------- ------- --------------- -------------------------
19 233 HR COUNTRIES_MV
5 647 HR EMPLOYEES_MV
Note:
The V$MVREFRESH dynamic performance view does not contain information about updatable materialized views when the materialized views' deferred transactions are being pushed to its master.Tuesday, October 29, 2013
Get create user DDL with grants, privileges and roles
rem script: user_cr_ddl.sql
rem Purpose: generate create user script with privs
rem
rem Usage: user_cr_ddl
rem
rem Note:
rem If ORA-31608 encountered, it means the user does not
rem have grants in that category. Edit the spooled script
rem as ncessary
rem
rem
SET LINESIZE 200
SET PAGESIZE 0 FEEDBACK off VERIFY off
-- SET TRIMSPOOL on
SET LONG 1000000
-- COLUMN ddl_string FORMAT A100 WORD_WRAP
EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY',true);
EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',true);
COLUMN ddl FORMAT A4000
define username=&&1
spool &username._cr_ddl.sql
SELECT DBMS_METADATA.GET_DDL('USER', upper('&username') ) DDL FROM dual;
prompt -- Role
SELECT DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT', upper('&username')) DDL from dual
where exists ( select 1 from dba_role_privs where grantee=upper('&username') );
prompt -- Sys priv
SELECT DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT', upper('&username')) DDL FROM dual
where exists ( select 1 from dba_sys_privs where grantee=upper('&username') );
prompt -- Object priv
SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT', upper('&username')) DDL
FROM dual where exists ( select 1 from dba_tab_privs where grantee=upper('&username') );
prompt -- tablespace quota
SELECT DBMS_METADATA.GET_GRANTED_DDL('TABLESPACE_QUOTA',upper('&username')) DDL from dual
where exists ( select 1 from dba_ts_quotas where username=upper('&username') );
spool off
exit
rem Purpose: generate create user script with privs
rem
rem Usage: user_cr_ddl
rem
rem Note:
rem If ORA-31608 encountered, it means the user does not
rem have grants in that category. Edit the spooled script
rem as ncessary
rem
rem
SET LINESIZE 200
SET PAGESIZE 0 FEEDBACK off VERIFY off
-- SET TRIMSPOOL on
SET LONG 1000000
-- COLUMN ddl_string FORMAT A100 WORD_WRAP
EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY',true);
EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',true);
COLUMN ddl FORMAT A4000
define username=&&1
spool &username._cr_ddl.sql
SELECT DBMS_METADATA.GET_DDL('USER', upper('&username') ) DDL FROM dual;
prompt -- Role
SELECT DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT', upper('&username')) DDL from dual
where exists ( select 1 from dba_role_privs where grantee=upper('&username') );
prompt -- Sys priv
SELECT DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT', upper('&username')) DDL FROM dual
where exists ( select 1 from dba_sys_privs where grantee=upper('&username') );
prompt -- Object priv
SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT', upper('&username')) DDL
FROM dual where exists ( select 1 from dba_tab_privs where grantee=upper('&username') );
prompt -- tablespace quota
SELECT DBMS_METADATA.GET_GRANTED_DDL('TABLESPACE_QUOTA',upper('&username')) DDL from dual
where exists ( select 1 from dba_ts_quotas where username=upper('&username') );
spool off
exit
Wednesday, October 23, 2013
V$lock - query to find blockers/Lockconflicts - Oracle
######## if dba_blockers is not working ###########
##### Using V$lock ########################
select l1.sid, ' IS BLOCKING ', l2.sid
from v$lock l1, v$lock l2
where l1.block =1 and l2.request > 0
and l1.id1=l2.id1
and l1.id2=l2.id2
####### mix of v$session #############
select s1.username || '@' || s1.machine
|| ' ( SID=' || s1.sid || ' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 ;
###############
SELECT vh.sid locking_sid,
vs.status status,
vs.program program_holding,
vw.sid waiter_sid,
vsw.program program_waiting
FROM v$lock vh,
v$lock vw,
v$session vs,
v$session vsw
WHERE (vh.id1, vh.id2) IN (SELECT id1, id2
FROM v$lock
WHERE request = 0
INTERSECT
SELECT id1, id2
FROM v$lock
WHERE lmode = 0)
AND vh.id1 = vw.id1
AND vh.id2 = vw.id2
AND vh.request = 0
AND vw.lmode = 0
AND vh.sid = vs.sid
AND vw.sid = vsw.sid
##### Using V$lock ########################
select l1.sid, ' IS BLOCKING ', l2.sid
from v$lock l1, v$lock l2
where l1.block =1 and l2.request > 0
and l1.id1=l2.id1
and l1.id2=l2.id2
####### mix of v$session #############
select s1.username || '@' || s1.machine
|| ' ( SID=' || s1.sid || ' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 ;
###############
SELECT vh.sid locking_sid,
vs.status status,
vs.program program_holding,
vw.sid waiter_sid,
vsw.program program_waiting
FROM v$lock vh,
v$lock vw,
v$session vs,
v$session vsw
WHERE (vh.id1, vh.id2) IN (SELECT id1, id2
FROM v$lock
WHERE request = 0
INTERSECT
SELECT id1, id2
FROM v$lock
WHERE lmode = 0)
AND vh.id1 = vw.id1
AND vh.id2 = vw.id2
AND vh.request = 0
AND vw.lmode = 0
AND vh.sid = vs.sid
AND vw.sid = vsw.sid
Tuesday, September 17, 2013
Query to find number of archive logs getting generated every day
SELECT A.*,
Round(A.Count#*B.AVG#/1024/1024) Daily_Avg_Mb
FROM
(
SELECT
To_Char(First_Time,’YYYY-MM-DD’) DAY,
Count(1) Count#,
Min(RECID) Min#,
Max(RECID) Max#
FROM
v$log_history
GROUP
BY To_Char(First_Time,’YYYY-MM-DD’)
ORDER
BY 1 DESC
) A,
(
SELECT
Avg(BYTES) AVG#,
Count(1) Count#,
Max(BYTES) Max_Bytes,
Min(BYTES) Min_Bytes
FROM
v$log
) B;
Round(A.Count#*B.AVG#/1024/1024) Daily_Avg_Mb
FROM
(
SELECT
To_Char(First_Time,’YYYY-MM-DD’) DAY,
Count(1) Count#,
Min(RECID) Min#,
Max(RECID) Max#
FROM
v$log_history
GROUP
BY To_Char(First_Time,’YYYY-MM-DD’)
ORDER
BY 1 DESC
) A,
(
SELECT
Avg(BYTES) AVG#,
Count(1) Count#,
Max(BYTES) Max_Bytes,
Min(BYTES) Min_Bytes
FROM
v$log
) B;
Thursday, July 11, 2013
Backup Progress during Incremental Backups with BCT enabled
select file#,
avg(datafile_blocks),
avg(blocks_read),
avg(blocks_read/datafile_blocks) * 100 as "% read for backup"
from v$backup_datafile
where incremental_level > 0
and used_change_tracking = 'YES'
group by file#
order by file#;
From Oracle Metalink
avg(datafile_blocks),
avg(blocks_read),
avg(blocks_read/datafile_blocks) * 100 as "% read for backup"
from v$backup_datafile
where incremental_level > 0
and used_change_tracking = 'YES'
group by file#
order by file#;
From Oracle Metalink
Friday, June 28, 2013
archivelog generation per hour in gb
archivelog generation per hour in gb
SELECT A.*,
Round(A.Count#*B.AVG#/1024/1024/1024) Daily_Avg_GB
FROM
(
SELECT
To_Char(First_Time,'YYYY-MM-DD') DAY,
Count(1) Count#,
Min(RECID) Min#,
Max(RECID) Max#
FROM
v$log_history
GROUP
BY To_Char(First_Time,'YYYY-MM-DD')
ORDER
BY 1 DESC
) A,
(
SELECT
Avg(BYTES) AVG#,
Count(1) Count#,
Max(BYTES) Max_Bytes,
Min(BYTES) Min_Bytes
FROM
v$log
) B;
SELECT A.*,
Round(A.Count#*B.AVG#/1024/1024/1024) Daily_Avg_GB
FROM
(
SELECT
To_Char(First_Time,'YYYY-MM-DD') DAY,
Count(1) Count#,
Min(RECID) Min#,
Max(RECID) Max#
FROM
v$log_history
GROUP
BY To_Char(First_Time,'YYYY-MM-DD')
ORDER
BY 1 DESC
) A,
(
SELECT
Avg(BYTES) AVG#,
Count(1) Count#,
Max(BYTES) Max_Bytes,
Min(BYTES) Min_Bytes
FROM
v$log
) B;
Subscribe to:
Posts (Atom)