You can use the following SQL query:
select
to_char(completion_time, 'YYYY-MM-DD') as archivelog_date,
round(sum(blocks * block_size) / 1024 / 1024 / 1024, 2) as archivelog_size_gb
from
gv$archived_log
where
to_char(completion_time, 'YYYY-MM-DD') BETWEEN '开始日期' AND '结束日期'
group by
to_char(completion_time, 'YYYY-MM-DD')
order by
to_char(completion_time, 'YYYY-MM-DD');
Replace 'Start Date' and 'End Date' with the date range you want to count, in the format of 'YYYY-MM-DD'.
This query fetches information about archived logs from the view, grouped and summarized based on date Oracle
. v$archived_log
It converts the archive log completion time (completion_time) to a date and summarizes the archive log size in G by date.
v$archived_log
and gv$archived_log
are both views used to query Oracle
database archive log information, but their RAC - Real Application Clusters
usage scenarios in multi-instance ( ) environments are different.
v$archived_log
(v$
Indicates "View
")
1) This is a view used to query archive log information in a single instance database.
2) When youOracle
are working on a single instance database, you can use this view to view information about archive logs.
3) This view only displays the archive log information of the currently connected database instance.gv$archived_log
(gv$
Indicates "Global View
")
1) This is a global view used to query archive log information, usuallyOracle RAC
used in the environment.
2) InOracle RAC
, multiple database instances can run on different nodes at the same time, sharing the same database. In this case, archived log information may relate to multiple instances.
3)gv$archived_log
Archive log information for all instances can be displayed across multiple instances, allowing you toRAC
view and manage archive logs across the entire environment.
In short, v$archived_log
it is suitable for single-instance databases and gv$archived_log
multi-instance Oracle RAC
environments for viewing and managing archive log information globally. In a single-instance environment, you can use v$archived_log
, while in RAC
an environment it is generally preferred to use gv$archived_log
to monitor and analyze archived log data.
Note that to run this query, you need to have appropriate database permissions and be connected to the database instance that contains the archive log information. Also, make sure to replace the date range to get the data you are interested in.