Scripts:报告数据库中对应对象用户表空间的段情况汇总dba_owner_to_tablespace.sql
来源:互联网 发布:网络招生发布信息平台 编辑:程序博客网 时间:2024/06/06 10:56
-- +----------------------------------------------------------------------------+
-- | Jeffrey M. Hunter |
-- | jhunter@idevelopment.info |
-- | www.idevelopment.info |
-- |----------------------------------------------------------------------------|
-- | Copyright (c) 1998-2012 Jeffrey M. Hunter. All rights reserved. |
-- |----------------------------------------------------------------------------|
-- | DATABASE : Oracle |
-- | FILE : dba_owner_to_tablespace.sql |
-- | CLASS : Database Administration |
-- | PURPOSE : Provide a summary report of owner to tablespace for all |
-- | segments in the database. |
-- | NOTE : As with any code, ensure to test this script in a development |
-- | environment before attempting to run it in production. |
-- +----------------------------------------------------------------------------+
SET TERMOUT OFF;
COLUMN current_instance NEW_VALUE current_instance NOPRINT;
SELECT rpad(instance_name, 17) current_instance FROM v$instance;
SET TERMOUT ON;
PROMPT
PROMPT +------------------------------------------------------------------------+
PROMPT | Report : Owner to Tablespace Report |
PROMPT | Instance : ¤t_instance |
PROMPT +------------------------------------------------------------------------+
SET ECHO OFF
SET FEEDBACK 6
SET HEADING ON
SET LINESIZE 180
SET PAGESIZE 50000
SET TERMOUT ON
SET TIMING OFF
SET TRIMOUT ON
SET TRIMSPOOL ON
SET VERIFY OFF
CLEAR COLUMNS
CLEAR BREAKS
CLEAR COMPUTES
COLUMN owner FORMAT a20 HEADING "Owner"
COLUMN tablespace_name FORMAT a30 HEADING "Tablespace Name"
COLUMN segment_type FORMAT a18 HEADING "Segment Type"
COLUMN bytes FORMAT 9,999,999,999,999 HEADING "Size (in Bytes)"
COLUMN seg_count FORMAT 9,999,999,999 HEADING "Segment Count"
BREAK ON report ON owner SKIP 2
COMPUTE sum LABEL "" OF seg_count bytes ON owner
COMPUTE sum LABEL "Grand Total: " OF seg_count bytes ON report
SELECT
owner
, tablespace_name
, segment_type
, sum(bytes) bytes
, count(*) seg_count
FROM
dba_segments
GROUP BY
owner
, tablespace_name
, segment_type
ORDER BY
owner
, tablespace_name
, segment_type
/
-- | Jeffrey M. Hunter |
-- | jhunter@idevelopment.info |
-- | www.idevelopment.info |
-- |----------------------------------------------------------------------------|
-- | Copyright (c) 1998-2012 Jeffrey M. Hunter. All rights reserved. |
-- |----------------------------------------------------------------------------|
-- | DATABASE : Oracle |
-- | FILE : dba_owner_to_tablespace.sql |
-- | CLASS : Database Administration |
-- | PURPOSE : Provide a summary report of owner to tablespace for all |
-- | segments in the database. |
-- | NOTE : As with any code, ensure to test this script in a development |
-- | environment before attempting to run it in production. |
-- +----------------------------------------------------------------------------+
SET TERMOUT OFF;
COLUMN current_instance NEW_VALUE current_instance NOPRINT;
SELECT rpad(instance_name, 17) current_instance FROM v$instance;
SET TERMOUT ON;
PROMPT
PROMPT +------------------------------------------------------------------------+
PROMPT | Report : Owner to Tablespace Report |
PROMPT | Instance : ¤t_instance |
PROMPT +------------------------------------------------------------------------+
SET ECHO OFF
SET FEEDBACK 6
SET HEADING ON
SET LINESIZE 180
SET PAGESIZE 50000
SET TERMOUT ON
SET TIMING OFF
SET TRIMOUT ON
SET TRIMSPOOL ON
SET VERIFY OFF
CLEAR COLUMNS
CLEAR BREAKS
CLEAR COMPUTES
COLUMN owner FORMAT a20 HEADING "Owner"
COLUMN tablespace_name FORMAT a30 HEADING "Tablespace Name"
COLUMN segment_type FORMAT a18 HEADING "Segment Type"
COLUMN bytes FORMAT 9,999,999,999,999 HEADING "Size (in Bytes)"
COLUMN seg_count FORMAT 9,999,999,999 HEADING "Segment Count"
BREAK ON report ON owner SKIP 2
COMPUTE sum LABEL "" OF seg_count bytes ON owner
COMPUTE sum LABEL "Grand Total: " OF seg_count bytes ON report
SELECT
owner
, tablespace_name
, segment_type
, sum(bytes) bytes
, count(*) seg_count
FROM
dba_segments
GROUP BY
owner
, tablespace_name
, segment_type
ORDER BY
owner
, tablespace_name
, segment_type
/
0 0
- Scripts:报告数据库中对应对象用户表空间的段情况汇总dba_owner_to_tablespace.sql
- Scripts:报告数据库中所有的数据文件情况(包括临时表空间)dba_files.sql
- Scripts:报告数据库中段使用情况的汇总dba_segment_summary.sql
- Scripts:查询数据库中表空间的情况汇总dba_tablespaces.sql
- Scripts:报告数据库中所有数据文件使用情况dba_files_all.sql
- Scripts:报告数据库中数据文件控制文件临时文件redo文件的使用情况dba_file_use.sql
- Scripts:报告无效对象汇总dba_invalid_objects_summary.sql
- Scripts:报告sga中空闲内存的情况perf_sga_free_pool.sql
- Scripts:报告数据库中所有已注册组件的汇总dba_registry.sql
- Scripts:查询数据库中各个表空间信息汇总dba_tablespace_to_owner.sql
- Scripts:报告dbtime的情况dbtime.sql
- Scripts:查询数据库对象汇总dba_object_summary.sql
- Scripts:报告数据库中表信息汇总dba_table_info.sql
- Scripts:报告物理数据库增长情况(注意脚本是看你数据库添加数据文件的时间哦)dba_db_growth.sql
- Scripts:报告所有用户session信息的脚本sess_user_sessions.sql
- Scripts:查询数据库中所有的表dba_tables_all.sql
- Scripts:报告数据库中的top segment的脚本dba_top_segments.sql
- 查询SQL数据库中各数据表的空间使用情况
- C#0001--如何使用错误提醒控件
- 编译安装lamp环境
- CURL模拟访问网页(转)
- 司机的救命之恩
- json和JavaBean,String之间的转换
- Scripts:报告数据库中对应对象用户表空间的段情况汇总dba_owner_to_tablespace.sql
- ORACLE数据库的事务&Oracle事务知识要点
- 可重启线程及线程池类的设计
- Oracle %ROWTYPE 用法
- activex插件遮盖问题的处理
- Zend Framework 2.1.5 中根据服务器的环境配置调用数据库等的不同配置
- jquery 和 javascript 清空下传控件 方法总结
- sql注入原理
- select下啦回显方式