1--查询表空间使用率
2col TABLESPACE_NAME for a20
3select tbs_used_info.tablespace_name,
4 tbs_used_info.alloc_mb,
5 tbs_used_info.used_mb,
6 tbs_used_info.max_mb,
7 tbs_used_info.free_of_max_mb,
8 tbs_used_info.used_of_max || '%' used_of_max_pct
9 from (select a.tablespace_name,
10 round(a.bytes_alloc / 1024 / 1024) alloc_mb,
11 round((a.bytes_alloc - nvl(b.bytes_free,
12 0)) / 1024 / 1024) used_mb,
13 round((a.bytes_alloc - nvl(b.bytes_free,
14 0)) * 100 / a.maxbytes) used_of_max,
15 round((a.maxbytes - a.bytes_alloc + nvl(b.bytes_free,
16 0)) / 1048576) free_of_max_mb,
17 round(a.maxbytes / 1048576) max_mb
18 from (select f.tablespace_name,
19 sum(f.bytes) bytes_alloc,
20 sum(decode(f.autoextensible,
21 'YES',
22 f.maxbytes,
23 'NO',
24 f.bytes)) maxbytes
25 from dba_data_files f
26 group by tablespace_name) a,
27 (select f.tablespace_name,
28 sum(f.bytes) bytes_free
29 from dba_free_space f
30 group by tablespace_name) b
31 where a.tablespace_name = b.tablespace_name(+)) tbs_used_info
32 order by tbs_used_info.used_of_max desc;
33
34--查询备份
35col status for a10
36col input_type for a20
37col INPUT_BYTES_DISPLAY for a10
38col OUTPUT_BYTES_DISPLAY for a10
39col TIME_TAKEN_DISPLAY for a10
40
41select input_type,
42 status,
43 to_char(start_time,
44 'yyyy-mm-dd hh24:mi:ss'),
45 to_char(end_time,
46 'yyyy-mm-dd hh24:mi:ss'),
47 input_bytes_display,
48 output_bytes_display,
49 time_taken_display,
50 COMPRESSION_RATIO
51 from v$rman_backup_job_details
52 where start_time > date '2021-07-01'
53 order by 3 desc;