1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| ---10g/11g set linesize 640 set pagesize 36 col snap_id for 999999 col con_id for 99999 col pdbname for a16 col ts_name for a20 col rtime for a18 col ts_size_mb for 999999.9 col ts_used_mb for 999999.9 col pct_used for 99.99 select u.snap_id, to_char(s.begin_interval_time, 'yyyy-mm-dd hh24') begin_time, to_char(s.end_interval_time, 'yyyy-mm-dd hh24') end_time, t.name, round(u.tablespace_size * ts.block_size / 1024 / 1024, 2) ts_size_mb, round(u.tablespace_usedsize * ts.block_size / 1024 / 1024, 2) ts_used_mb, round((u.tablespace_size - u.tablespace_usedsize) * ts.block_size / 1024 / 1024, 2) ts_free_mb, round(u.tablespace_usedsize / u.tablespace_size * 100, 2) pct_used from dba_hist_tbspc_space_usage u, v$tablespace t, dba_hist_snapshot s, dba_tablespaces ts where u.tablespace_id = t.ts# and u.snap_id = s.snap_id and t.name = ts.tablespace_name and s.instance_number = 1 and t.name = upper('&tablespace_name') and s.end_interval_time > sysdate - 7 order by snap_id desc; ---多租户 set linesize 640 set pagesize 36 col snap_id for 999999 col con_id for 99999 col pdbname for a16 col ts_name for a20 col rtime for a18 col ts_size_mb for 999999.99 col ts_used_mb for 999999.99 col pct_used for 99.99 select a.snap_id, a.con_id, e.name pdbname, c.tablespace_name ts_name, to_char(to_date(a.rtime, 'mm/dd/yyyy hh24:mi:ss'), 'yyyy-mm-dd hh24:mi') rtime, round(a.tablespace_size * c.block_size / 1024 / 1024, 2) ts_size_mb, round(a.tablespace_usedsize * c.block_size / 1024 / 1024, 2) ts_used_mb, round((a.tablespace_size - a.tablespace_usedsize) * c.block_size / 1024 / 1024, 2) ts_free_mb, round(a.tablespace_usedsize / a.tablespace_size * 100, 2) pct_used from cdb_hist_tbspc_space_usage a, (select tablespace_id, nb.con_id, substr(rtime, 1, 10) rtime, max(snap_id) snap_id from dba_hist_tbspc_space_usage nb group by tablespace_id, nb.con_id,substr(rtime, 1, 10)) b, cdb_tablespaces c, v$tablespace d, V$CONTAINERS e where a.snap_id = b.snap_id and a.tablespace_id = b.tablespace_id and a.con_id=b.con_id and a.con_id=c.con_id and a.con_id=d.con_id and a.con_id=e.con_id and a.tablespace_id=d.TS# and d.NAME=c.tablespace_name and c.tablespace_name=upper('&tablespace_name') and to_date(a.rtime, 'mm/dd/yyyy hh24:mi:ss') >=sysdate-30 order by a.con_id,a.tablespace_id,to_date(a.rtime, 'mm/dd/yyyy hh24:mi:ss') desc;
|