-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtablespace_size.xml
281 lines (139 loc) · 7.49 KB
/
tablespace_size.xml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?xml version="1.0" encoding="UTF-8" ?>
<displays>
<display id="a1172c89-0119-1000-8001-ac146e3cae78" type="" style="Table" enable="true">
<name><![CDATA[Tablespace]]></name>
<description><![CDATA[Tablespace Size and suggest space to add]]></description>
<tooltip><![CDATA[Tablespace Information]]></tooltip>
<drillclass><![CDATA[]]></drillclass>
<CustomValues>
<TYPE><![CDATA[horizontal]]></TYPE>
</CustomValues>
<query>
<sql><![CDATA[SELECT nvl(name,'=== TOTAL for DB ===') Tablespace ,
TO_CHAR(SUM(mbytes),'999,999,999.99') "Total MB" ,
TO_CHAR(SUM(used),'999,999,999.99') "Used MB" ,
TO_CHAR(SUM(free),'999,999,999.99') "Free MB" ,
ROUND(AVG(pct_used),2) "%Used" ,
ROUND(AVG(pct_free),2) "%Free" ,
'SQLDEV:GAUGE:0:100:0:0:'|| AVG(pct_used) AS "Tablespace Utilization"
FROM
(SELECT name ,
ROUND(mbytes,2) mbytes ,
ROUND(used,2) used ,
ROUND(free,2) free ,
ROUND(pct_used,2) pct_used,
ROUND(pct_free,2) pct_free
FROM
(SELECT NVL(b.tablespace_name, NVL(a.tablespace_name,'UNKOWN')) name,
mbytes_alloc Mbytes ,
mbytes_alloc-NVL(mbytes_free,0) used ,
NVL(mbytes_free,0) free ,
((mbytes_alloc-NVL(mbytes_free,0))/ mbytes_alloc)*100 pct_used ,
100 -(((mbytes_alloc-NVL(mbytes_free,0))/ mbytes_alloc)*100) pct_free
FROM
(SELECT SUM(bytes)/1024/1024 Mbytes_free,
MAX(bytes) /1024/1024 largest ,
tablespace_name
FROM dba_free_space
GROUP BY tablespace_name
) a ,
(SELECT SUM(bytes)/1024/1024 Mbytes_alloc,
SUM(maxbytes) /1024/1024 Mbytes_max ,
tablespace_name
FROM sys.dba_data_files
GROUP BY tablespace_name
UNION ALL
SELECT SUM(bytes)/1024/1024 Mbytes_alloc,
SUM(maxbytes) /1024/1024 Mbytes_max ,
tablespace_name
FROM dba_temp_files
GROUP BY tablespace_name
) b
WHERE a.tablespace_name (+) = b.tablespace_name
)
)
GROUP BY rollup (name)
ORDER BY
CASE
WHEN name IS NULL
THEN 200
ELSE ROUND(AVG(pct_free),2)
END ASC]]></sql>
</query>
<pdf version="VERSION_1_7" compression="CONTENT">
<docproperty title="" author="" subject="" keywords="" />
<cell toppadding="2" bottompadding="2" leftpadding="2" rightpadding="2" horizontalalign="LEFT" verticalalign="TOP" wrap="true" />
<column>
<heading font="null" size="10" style="NORMAL" color="-16777216" rowshading="-1" labeling="FIRST_PAGE" />
<footing font="null" size="10" style="NORMAL" color="-16777216" rowshading="-1" labeling="NONE" />
<blob blob="NONE" zip="false" />
</column>
<table font="null" size="10" style="NORMAL" color="-16777216" userowshading="false" oddrowshading="-1" evenrowshading="-1" showborders="true" spacingbefore="12" spacingafter="12" horizontalalign="LEFT" />
<header enable="false" generatedate="false">
<data>
null </data>
</header>
<footer enable="false" generatedate="false">
<data value="null" />
</footer>
<pagesetup papersize="LETTER" orientation="1" measurement="in" margintop="1.0" marginbottom="1.0" marginleft="1.0" marginright="1.0" />
</pdf>
<display id="" type="" style="Table" enable="true">
<name><![CDATA[Tablespace Datafiles ]]></name>
<description><![CDATA[Show the datafiles for the selected tablespace.]]></description>
<tooltip><![CDATA[Show the datafiles for the selected tablespace.]]></tooltip>
<drillclass><![CDATA[]]></drillclass>
<CustomValues>
<TYPE><![CDATA[horizontal]]></TYPE>
</CustomValues>
<query>
<sql><![CDATA[select df.file_id,
df.file_name AS file_name,
substr(df.file_name,1, instr(df.file_name,'/')-1) ASM_DISKGROUP,
round(bytes/1024/1024) AS MB,
DECODE(df.autoextensible,'YES',round((df.maxbytes - bytes)/1024/1024),'0') AS extend_to_MB,
df.autoextensible,
round(df.increment_by * nvl((select max(block_size) from dba_tablespaces where tablespace_name = df.tablespace_name),1)/1024/1024)INCREMENT_BY_MB
from dba_data_files df
where df.tablespace_name = UPPER(:TABLESPACE)
UNION ALL
select tf.file_id,
tf.file_name AS file_name,
substr(tf.file_name,1, instr(tf.file_name,'/')-1) ASM_DISKGROUP,
round(tf.bytes/1024/1024) AS MB,
DECODE(tf.autoextensible,'YES',round((tf.maxbytes - tf.bytes)/1024/1024),'0') AS extend_to_MB,
tf.autoextensible,
round(tf.increment_by * nvl((select max(block_size) from dba_tablespaces where tablespace_name = tf.tablespace_name),1)/1024/1024)INCREMENT_BY_MB
from dba_temp_files tf
where tablespace_name = UPPER(:TABLESPACE)
order by 1 desc]]></sql>
<binds>
<bind id="TABLESPACE">
<prompt><![CDATA[TABLESPACE]]></prompt>
<tooltip><![CDATA[TABLESPACE]]></tooltip>
<value><![CDATA[NULL_VALUE]]></value>
<bracket><![CDATA[null]]></bracket>
</bind>
</binds>
</query>
<pdf version="VERSION_1_7" compression="CONTENT">
<docproperty title="" author="" subject="" keywords="" />
<cell toppadding="2" bottompadding="2" leftpadding="2" rightpadding="2" horizontalalign="LEFT" verticalalign="TOP" wrap="true" />
<column>
<heading font="null" size="10" style="NORMAL" color="-16777216" rowshading="-1" labeling="FIRST_PAGE" />
<footing font="null" size="10" style="NORMAL" color="-16777216" rowshading="-1" labeling="NONE" />
<blob blob="NONE" zip="false" />
</column>
<table font="null" size="10" style="NORMAL" color="-16777216" userowshading="false" oddrowshading="-1" evenrowshading="-1" showborders="true" spacingbefore="12" spacingafter="12" horizontalalign="LEFT" />
<header enable="false" generatedate="false">
<data>
null </data>
</header>
<footer enable="false" generatedate="false">
<data value="null" />
</footer>
<pagesetup papersize="LETTER" orientation="1" measurement="in" margintop="1.0" marginbottom="1.0" marginleft="1.0" marginright="1.0" />
</pdf>
</display>
</display>
</displays>