oracle表空间使用率查询
2015-09-09 16:24
423 查看
sqlplus -s / as sysdba<<EOF
set trimspool on
set linesize 10000
set pagesize 50000
set heading on
set term off
set heading on
set feedback off;
set newp none;
set echo off
set markup html on
spool on
spool xj.xls
--表空间使用率查询:
select t.tablespace_name,t.total,f.free,(t.total - f.free) / t.total * 100 used_percent
from
(select a.tablespace_name,sum(a.bytes/1024/1024) total
from dba_data_files a
group by a.tablespace_name
) t,
(select b.tablespace_name,sum(b.bytes/1024/1024) free
from dba_free_space b
group by b.tablespace_name
) f
where t.tablespace_name = f.tablespace_name
;
--临时表空间使用率查询(gv_$temp_space_header视图需要使用sys用户查看)
select a.tablespace_name,b.total,a.used,a.used / b.total * 100 used_percent,
a.free,a.free / b.total * 100 free_percent
from
(select tablespace_name,sum(bytes_used/1024/1024) used,sum(bytes_free/1024/1024) free
from gv_\$temp_space_header
group by tablespace_name
) a,
(select tablespace_name,sum(bytes/1024/1024) total
from dba_temp_files
group by tablespace_name
) b
where a.tablespace_name = b.tablespace_name
;
spool off
EOF
set trimspool on
set linesize 10000
set pagesize 50000
set heading on
set term off
set heading on
set feedback off;
set newp none;
set echo off
set markup html on
spool on
spool xj.xls
--表空间使用率查询:
select t.tablespace_name,t.total,f.free,(t.total - f.free) / t.total * 100 used_percent
from
(select a.tablespace_name,sum(a.bytes/1024/1024) total
from dba_data_files a
group by a.tablespace_name
) t,
(select b.tablespace_name,sum(b.bytes/1024/1024) free
from dba_free_space b
group by b.tablespace_name
) f
where t.tablespace_name = f.tablespace_name
;
--临时表空间使用率查询(gv_$temp_space_header视图需要使用sys用户查看)
select a.tablespace_name,b.total,a.used,a.used / b.total * 100 used_percent,
a.free,a.free / b.total * 100 free_percent
from
(select tablespace_name,sum(bytes_used/1024/1024) used,sum(bytes_free/1024/1024) free
from gv_\$temp_space_header
group by tablespace_name
) a,
(select tablespace_name,sum(bytes/1024/1024) total
from dba_temp_files
group by tablespace_name
) b
where a.tablespace_name = b.tablespace_name
;
spool off
EOF
相关文章推荐
- Oracle数据库查询练习
- 删除用户下所有对象
- oracle 体系结构
- 临时表空间过大,重建临时表空间
- fedora22安装oracle11gr2
- Oracle exp备份导入注意的六个事项
- oracle错误之未知的命令开头imp忽略了剩余行解决方案
- CentOS 下安装Oracle 11g 报错ORA-01034: ORACLE not available
- Oracle的function
- NodeJs连接Oracle数据库
- CentOS 6 下启动ORACLE 11gR2
- Oracle语句优化之一
- 计算累计差
- ORACLE分页查询SQL语法——最高效的分页
- plSQL 32位oracle客户端配置
- ORA-01035: ORACLE only available to users with RESTRICTED SESSION
- Oracle IO优化心得
- oracle设备
- oracle中with table as临时表
- Oracle存储过程基本语法介绍