[20230414]完善seg2.sql指令碼.txt
[20230414]完善seg2.sql指令碼.txt
--//原始指令碼seg2.sql會顯示分割槽名,大多數情況下應用表都是沒有分割槽的表,顯示它有點多餘,完善該指令碼.
--//預設情況下不顯示該列.
$ cat seg2.sql
-- Copyright 2018 Tanel Poder. All rights reserved. More info at
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
col seg_owner head OWNER for a20
col seg_segment_name head SEGMENT_NAME for a30
col seg_segment_type head SEGMENT_TYPE for a20
col v_con new_value v_con
set term off
select decode('&&2',NULL,'noprint','1','print','p','print','print','print','noprint') v_con from dual;
set term on
col seg_partition_name head SEG_PART_NAME for a30 &v_con
select
round(bytes/1048576) seg_MB,
owner seg_owner,
segment_name seg_segment_name,
partition_name seg_partition_name,
segment_type seg_segment_type,
tablespace_name seg_tablespace_name,
blocks,
header_file hdrfil,
HEADER_BLOCK hdrblk
from
dba_segments
where
upper(segment_name) LIKE
upper(CASE
WHEN INSTR('&1','.') > 0 THEN
SUBSTR('&1',INSTR('&1','.')+1)
ELSE
'&1'
END
)
AND owner LIKE
CASE WHEN INSTR('&1','.') > 0 THEN
UPPER(SUBSTR('&1',1,INSTR('&1','.')-1))
ELSE
user
END
/
--//測試如下:
SCOTT@book> @ seg2 dept ''
SEG_MB OWNER SEGMENT_NAME SEGMENT_TYPE SEG_TABLESPACE_NAME BLOCKS HDRFIL HDRBLK
------ ----- ------------ ------------ ------------------- ------ ------ ------
0 SCOTT DEPT TABLE USERS 8 4 130
SCOTT@book> @ seg2 dept p
SEG_MB OWNER SEGMENT_NAME SEG_PART_NAME SEGMENT_TYPE SEG_TABLESPACE_NAME BLOCKS HDRFIL HDRBLK
------ ----- ------------ ------------- ------------ ------------------- ------ ------ ------
0 SCOTT DEPT TABLE USERS 8 4 130
SYS@192.168.100.141:1521/dyhis> @ seg2 audsys.AUD$UNIFIED print
SEG_MB OWNER SEGMENT_NAME SEG_PART_NAME SEGMENT_TYPE SEG_TABLESPACE_NAME BLOCKS HDRFIL HDRBLK
------ ------ ------------ ------------- --------------- ------------------- ------ ------ ------
175 AUDSYS AUD$UNIFIED SYS_P20923 TABLE PARTITION SYSAUX 22400 3 145690
80 AUDSYS AUD$UNIFIED SYS_P21663 TABLE PARTITION USERS 10240 2 48657
144 AUDSYS AUD$UNIFIED SYS_P19622 TABLE PARTITION SYSAUX 18432 3 656234
88 AUDSYS AUD$UNIFIED SYS_P20283 TABLE PARTITION SYSAUX 11264 3 550906
SYS@192.168.100.141:1521/dyhis> @ seg2 audsys.AUD$UNIFIED ''
SEG_MB OWNER SEGMENT_NAME SEGMENT_TYPE SEG_TABLESPACE_NAME BLOCKS HDRFIL HDRBLK
------ ------ ------------ --------------- ------------------- ------ ------ ------
175 AUDSYS AUD$UNIFIED TABLE PARTITION SYSAUX 22400 3 145690
80 AUDSYS AUD$UNIFIED TABLE PARTITION USERS 10240 2 48657
144 AUDSYS AUD$UNIFIED TABLE PARTITION SYSAUX 18432 3 656234
88 AUDSYS AUD$UNIFIED TABLE PARTITION SYSAUX 11264 3 550906
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2946380/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20210506]完善tix指令碼.txt指令碼
- [20201202]完善sosi指令碼.txt指令碼
- [20231101]使用tpt seg2.sql指令碼問題.txtSQL指令碼
- [20210623]完善清除aud指令碼.txt指令碼
- [20231117]完善ashtt.sql指令碼.txtSQL指令碼
- [20211230]完善sql_id指令碼.txtSQL指令碼
- [20211122]完善descx.sql指令碼.txtSQL指令碼
- [20221012]完善spsw.sql指令碼.txtSQL指令碼
- [20221010]完善descz.sql指令碼.txtSQL指令碼
- [20221101]完善descz.sql指令碼.txtSQL指令碼
- [20221101]完善gts.sql指令碼.txtSQL指令碼
- [20230203]完善awr.sql指令碼.txtSQL指令碼
- [20230123]完善curheapz.sql指令碼.txtSQL指令碼
- [20210407]完善ti.sql指令碼.txtSQL指令碼
- [20210125]完善hide.sql指令碼.txtIDESQL指令碼
- [20191111]完善bind_cap.sql指令碼.txtSQL指令碼
- [20220217]完善tpt gts.sql指令碼.txtSQL指令碼
- [20220510]完善tpt expandz.sql指令碼.txtSQL指令碼
- [20211202]完善d_buffer.sql指令碼.txtSQL指令碼
- [20211129]完善tpt tablist.sql指令碼.txtSQL指令碼
- [20211130]完善tpt t.sql指令碼.txtSQL指令碼
- [20211129]完善tpt killi.sql指令碼.txtSQL指令碼
- [20211126]完善tpt pr.sql指令碼.txtSQL指令碼
- [20230210]建立完善swcnm.sql指令碼.txtSQL指令碼
- [20221208]完善bind_cap.sql指令碼.txtSQL指令碼
- [20220311]完善ash_wait_chains指令碼.txtAI指令碼
- [20220309]完善shp4.sql指令碼.txtSQL指令碼
- [20231025]完善tpt的trans.sql指令碼.txtSQL指令碼
- [20241114]建立完善ext_kglob.sh指令碼.txt指令碼
- [20220111]完善tpt ashash_index_helper指令碼.txtIndex指令碼
- [20220323]完善tpt get_trace.sql指令碼.txtSQL指令碼
- [20220823]完善tpt的ashtop.sql指令碼.txtSQL指令碼
- [20221208]完善bind_cap_awr.sql指令碼.txtSQL指令碼
- [20190416]完善shared latch測試指令碼2.txt指令碼
- [20220129]完善tpt ash ash_index_helperx指令碼.txtIndex指令碼
- [20211111]補充完善ash_wait_chains指令碼.txtAI指令碼
- [20230302]建立完善tpt o2.sql指令碼.txtSQL指令碼
- [20230203]建立完善sp1x.sql指令碼.txtSQL指令碼