【发布时间】:2009-06-04 08:08:49
【问题描述】:
我的服务器采用以下系统:
Windows 2003 R2 Ent 版 SP 2 甲骨文 1.0.2.0.4.0 数据库:5
数据库的归档日志位于闪回恢复区,如 v$recovery_file_dest 的 NAME 列所示,也可以从 sqlplus 调用“show parameter db_recovery_file_dest”。我想使用 SQL 或 PLSQL 脚本监控每个数据库归档日志的空间使用情况。
如果我在下面调用查询:
SET LINESIZE 145
SET PAGESIZE 9999
COLUMN name FORMAT a30 HEADING 'Name'
COLUMN space_limit FORMAT 99,999,999,999,999 HEADING 'Space Limit'
COLUMN space_used FORMAT 99,999,999,999,999 HEADING 'Space Used'
COLUMN space_used_pct FORMAT 999.99 HEADING '% Used'
COLUMN space_reclaimable FORMAT 99,999,999,999,999 HEADING 'Space Reclaimable'
COLUMN pct_reclaimable FORMAT 999.99 HEADING '% Reclaimable'
COLUMN number_of_files FORMAT 999,999 HEADING 'Number of Files'
prompt
prompt Current location, disk quota, space in use, space reclaimable by deleting files,
prompt and number of files in the Flash Recovery Area.
prompt
SELECT
name
, space_limit
, space_used
, ROUND((space_used / space_limit)*100, 2) space_used_pct
, space_reclaimable
, ROUND((space_reclaimable / space_limit)*100, 2) pct_reclaimable
, number_of_files
FROM
v$recovery_file_dest
ORDER BY
name
/
我会得到这样的输出:
Name Space Limit Space Used % Used Space Reclaimable % Reclaimable Number of Files
------------------------------ ------------------- ------------------- ------- ------------------- ------------- ---------------
D:\oracle\product\10.2.0\flash 107,374,182,400 34,239,603,712 31.89 0 .00 804
_recovery_area\DBNAME
我的问题是:如何将每个数据库中每个相似查询的结果整合到一个输出中?
输出如下所示:
Name Space Limit Space Used % Used Space Reclaimable % Reclaimable Number of Files
------------------------------ ------------------- ------------------- ------- ------------------- ------------- ---------------
D:\oracle\product\10.2.0\flash 107,374,182,400 34,239,603,712 31.89 0 .00 804
_recovery_area\DBNAME1
D:\oracle\product\10.2.0\flash 107,374,182,400 34,239,603,712 31.89 0 .00 804
_recovery_area\DBNAME2
D:\oracle\product\10.2.0\flash 107,374,182,400 34,239,603,712 31.89 0 .00 804
_recovery_area\DBNAME3
【问题讨论】: