~ubuntu-branches/ubuntu/wily/tora/wily-proposed

« back to all changes in this revision

Viewing changes to src/toresultstorage.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Meskes
  • Date: 2008-03-26 09:55:07 UTC
  • mfrom: (1.2.6 upstream) (3.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20080326095507-sm1ieybfn8iomub1
Tags: 1.3.23-1
* New upstream version
* Moved config.* handling from clean target to configure target.

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
            user /= total;
85
85
            free /= total;
86
86
            if (AvailableGraph)
87
 
                t.sprintf("%0.1f / %0.1f %%", free*100, (total - user) / total*100);
 
87
                t.sprintf("%0.1f / %0.1f / %0.1f %%", (user-free)*100, free*100, (1 - user)*100);
88
88
            else
89
89
                t.sprintf("%0.1f %%", free*100);
90
90
            p->fillRect(0, 0, int((user - free)*width), height(),
177
177
}
178
178
 
179
179
static toSQL SQLShowCoalesced("toResultStorage:ShowCoalesced",
180
 
                              "SELECT d.tablespace_name, \n"
 
180
                              "SELECT d.tablespace_name,\n"
181
181
                              "       d.status,\n"
182
182
                              "       d.extent_management,\n"
183
183
                              "       d.contents,\n"
184
184
                              "       d.logging,\n"
185
 
                              "       TO_CHAR(ROUND(NVL(a.bytes / b.unit, 0),2)),\n"
186
 
                              "       TO_CHAR(ROUND(NVL(f.bytes,0) / b.unit,2)), \n"
187
 
                              "       TO_CHAR(ROUND(NVL(a.maxbytes / b.unit, 0),2)),\n"
 
185
                              "       TO_CHAR(ROUND(NVL(a.tbs_size,0) / b.unit,2)),\n"
 
186
                              "       TO_CHAR(ROUND(NVL(f.free_size,0) / b.unit,2)), \n"
 
187
                              "       TO_CHAR(ROUND(NVL(a.autoextend_size,0) / b.unit,2)),\n"
188
188
                              "       '-',\n"
189
189
                              "       TO_CHAR(ROUND(f.percent_extents_coalesced,1))||'%',\n"
190
190
                              "       '-',\n"
191
 
                              "       TO_CHAR(f.total_extents)\n"
192
 
                              "  FROM sys.dba_tablespaces d,\n"
193
 
                              "       (select tablespace_name, sum(bytes) bytes, sum(maxbytes) maxbytes from sys.dba_data_files group by tablespace_name) a,\n"
194
 
                              "       (select tablespace_name, total_bytes bytes, total_extents, percent_extents_coalesced from sys.dba_free_space_coalesced) f,\n"
195
 
                              "       (select :unt<int> unit from sys.dual) b\n"
196
 
                              " WHERE d.tablespace_name = a.tablespace_name(+)\n"
197
 
                              "   AND d.tablespace_name = f.tablespace_name(+)\n"
198
 
                              "   AND NOT (d.extent_management like 'LOCAL' AND d.contents like 'TEMPORARY')\n"
 
191
                              "       TO_CHAR(f.free_extents)\n"
 
192
                              "  FROM (SELECT :unt<int> unit FROM sys.dual) b,\n"
 
193
                              "       sys.dba_tablespaces d\n"
 
194
                              "  LEFT JOIN (SELECT tablespace_name,\n"
 
195
                              "                    SUM(bytes) tbs_size,\n"
 
196
                              "              SUM(DECODE(autoextensible,'YES',maxbytes,bytes)) autoextend_size\n"
 
197
                              "               FROM sys.dba_data_files\n"
 
198
                              "        GROUP BY tablespace_name) a\n"
 
199
                              "       ON d.tablespace_name = a.tablespace_name\n"
 
200
                              "  LEFT JOIN (SELECT tablespace_name,\n"
 
201
                              "                    total_bytes free_size,\n"
 
202
                              "                    total_extents free_extents,\n"
 
203
                              "                    percent_extents_coalesced\n"
 
204
                              "               FROM sys.dba_free_space_coalesced) f\n"
 
205
                              "       ON d.tablespace_name = f.tablespace_name\n"
 
206
                              " WHERE NOT (d.extent_management like 'LOCAL' AND d.contents like 'TEMPORARY')\n"
199
207
                              " UNION ALL\n"
200
 
                              "SELECT d.tablespace_name, \n"
 
208
                              "SELECT d.tablespace_name,\n"
201
209
                              "       d.status,\n"
202
210
                              "       d.extent_management,\n"
203
211
                              "       d.contents,\n"
204
212
                              "       d.logging,\n"
205
 
                              "       TO_CHAR(ROUND(NVL(a.bytes / b.unit, 0),2)),\n"
206
 
                              "       TO_CHAR(ROUND(NVL(f.bytes,0) / b.unit,2)),\n"
207
 
                              "       TO_CHAR(ROUND(NVL(a.maxbytes / b.unit, 0),2)),\n"
208
 
                              "       '-',\n"
209
 
                              "       '-',\n"
210
 
                              "       TO_CHAR(ROUND(NVL(f.maxbytes,0) / b.unit,2)), \n"
 
213
                              "       TO_CHAR(ROUND(NVL(a.tbs_size,0) / b.unit,2)),\n"
 
214
                              "       TO_CHAR(ROUND(NVL(f.free_size,0) / b.unit,2)),\n"
 
215
                              "       TO_CHAR(ROUND(NVL(a.autoextend_size,0) / b.unit,2)),\n"
 
216
                              "       '-',\n"
 
217
                              "       '-',\n"
 
218
                              "       TO_CHAR(ROUND(NVL(f.max_free,0) / b.unit,2)), \n"
211
219
                              "       TO_CHAR(f.total_extents)\n"
212
 
                              "  FROM sys.dba_tablespaces d,\n"
213
 
                              "       (select tablespace_name, sum(bytes) bytes, sum(maxbytes) maxbytes from sys.dba_temp_files group by tablespace_name) a,\n"
214
 
                              "       (select tablespace_name, nvl(sum(bytes_cached),0) bytes, count(1) total_extents,nvl(max(bytes_cached),0) maxbytes from v$temp_extent_pool group by tablespace_name) f,\n"
215
 
                              "       (select :unt<int> unit from sys.dual) b\n"
216
 
                              " WHERE d.tablespace_name = a.tablespace_name(+)\n"
217
 
                              "   AND d.tablespace_name = f.tablespace_name(+)\n"
218
 
                              "   AND d.extent_management = 'LOCAL'\n"
219
 
                              "   AND d.contents = 'TEMPORARY'",
 
220
                              "  FROM (SELECT :unt<int> unit FROM sys.dual) b,\n"
 
221
                              "       sys.dba_tablespaces d\n"
 
222
                              "  LEFT JOIN (SELECT tablespace_name,\n"
 
223
                              "                    SUM(bytes) tbs_size,\n"
 
224
                              "                    SUM(DECODE(autoextensible,'YES',maxbytes,bytes)) autoextend_size\n"
 
225
                              "               FROM sys.dba_temp_files\n"
 
226
                              "              GROUP BY tablespace_name) a\n"
 
227
                              "       ON d.tablespace_name = a.tablespace_name\n"
 
228
                              "  LEFT JOIN (SELECT tablespace_name,\n"
 
229
                              "                    SUM(bytes_cached) free_size,\n"
 
230
                              "                    COUNT(1) total_extents,\n"
 
231
                              "                    MAX(bytes_cached) max_free\n"
 
232
                              "               FROM v$temp_extent_pool\n"
 
233
                              "              GROUP BY tablespace_name) f\n"
 
234
                              "       ON d.tablespace_name = f.tablespace_name\n"
 
235
                              " WHERE d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY'\n",
220
236
                              "Display storage usage of database. This includes the coalesced columns which may make the query sluggish on some DB:s. "
221
237
                              "All columns must be present in output (Should be 12)",
222
238
                              "0801");
268
284
                               "0703");
269
285
 
270
286
static toSQL SQLNoShowCoalesced("toResultStorage:NoCoalesced",
271
 
                                "SELECT d.tablespace_name, \n"
272
 
                                "       d.status,\n"
273
 
                                "       d.extent_management,\n"
274
 
                                "       d.contents,\n"
275
 
                                "       d.logging,\n"
276
 
                                "       TO_CHAR(ROUND(NVL(a.bytes / b.unit, 0),2)),\n"
277
 
                                "       TO_CHAR(ROUND(NVL(f.bytes,0) / b.unit,2)), \n"
278
 
                                "       TO_CHAR(ROUND(NVL(a.maxbytes / b.unit, 0),2)),\n"
279
 
                                "       '-',\n"
280
 
                                "       '-',\n"
281
 
                                "       TO_CHAR(ROUND(NVL(f.maxbytes,0) / b.unit,2)), \n"
282
 
                                "       TO_CHAR(f.total_extents)\n"
283
 
                                "  FROM sys.dba_tablespaces d,\n"
284
 
                                "       (select tablespace_name, sum(bytes) bytes, sum(maxbytes) maxbytes from sys.dba_data_files group by tablespace_name) a,\n"
285
 
                                "       (select tablespace_name, NVL(sum(bytes),0) bytes, count(1) total_extents, NVL(max(bytes),0) maxbytes from sys.dba_free_space group by tablespace_name) f,\n"
286
 
                                "       (select :unt<int> unit from sys.dual) b\n"
287
 
                                " WHERE d.tablespace_name = a.tablespace_name(+)\n"
288
 
                                "   AND d.tablespace_name = f.tablespace_name(+)\n"
289
 
                                "   AND NOT (d.extent_management like 'LOCAL' AND d.contents like 'TEMPORARY')\n"
290
 
                                " UNION ALL\n"
291
 
                                "SELECT d.tablespace_name, \n"
292
 
                                "       d.status,\n"
293
 
                                "       d.extent_management,\n"
294
 
                                "       d.contents,\n"
295
 
                                "       d.logging,\n"
296
 
                                "       TO_CHAR(ROUND(NVL(a.bytes / b.unit, 0),2)),\n"
297
 
                                "       TO_CHAR(ROUND(NVL(f.bytes,0) / b.unit,2)),\n"
298
 
                                "       TO_CHAR(ROUND(NVL(a.maxbytes / b.unit, 0),2)),\n"
299
 
                                "       '-',\n"
300
 
                                "       '-',\n"
301
 
                                "       TO_CHAR(ROUND(NVL(f.maxbytes,0) / b.unit,2)), \n"
302
 
                                "       TO_CHAR(f.total_extents)\n"
303
 
                                "  FROM sys.dba_tablespaces d,\n"
304
 
                                "       (select tablespace_name, sum(bytes) bytes, sum(maxbytes) maxbytes from sys.dba_temp_files group by tablespace_name) a,\n"
305
 
                                "       (select tablespace_name, NVL(sum(bytes_cached),0) bytes, count(1) total_extents, NVL(max(bytes_cached),0) maxbytes from v$temp_extent_pool group by tablespace_name) f,\n"
306
 
                                "       (select :unt<int> unit from sys.dual) b\n"
307
 
                                " WHERE d.tablespace_name = a.tablespace_name(+)\n"
308
 
                                "   AND d.tablespace_name = f.tablespace_name(+)\n"
309
 
                                "   AND d.extent_management = 'LOCAL'\n"
310
 
                                "   AND d.contents = 'TEMPORARY'",
 
287
                                "SELECT d.tablespace_name,\n"
 
288
                                "       d.status,\n"
 
289
                                "       d.extent_management,\n"
 
290
                                "       d.contents,\n"
 
291
                                "       d.logging,\n"
 
292
                                "       TO_CHAR(ROUND(NVL(s.tbs_size,0) / b.unit,2)),\n"
 
293
                                "       TO_CHAR(ROUND(NVL(f.free_size,0) / b.unit,2)),\n"
 
294
                                "       TO_CHAR(ROUND(NVL(s.autoextend_size,0) / b.unit,2)),\n"
 
295
                                "       '-',\n"
 
296
                                "       '-',\n"
 
297
                                "       TO_CHAR(ROUND(NVL(f.max_free,0) / b.unit,2)),\n"
 
298
                                "       TO_CHAR(f.free_extents)\n"
 
299
                                "  FROM (select :unt<int> unit from sys.dual) b,\n"
 
300
                                "       sys.dba_tablespaces d\n"
 
301
                                "  LEFT JOIN (SELECT tablespace_name,\n"
 
302
                                "                    SUM(bytes) tbs_size,\n"
 
303
                                "                    SUM(DECODE(autoextensible,'YES',maxbytes,bytes)) autoextend_size\n"
 
304
                                "               FROM sys.dba_data_files \n"
 
305
                                "              GROUP BY tablespace_name\n"
 
306
                                "              UNION ALL\n"
 
307
                                "             SELECT tablespace_name,\n"
 
308
                                "                    SUM(bytes) tbs_size,\n"
 
309
                                "                    SUM(DECODE(autoextensible,'YES',maxbytes,bytes)) autoextend_size\n"
 
310
                                "               FROM sys.dba_temp_files \n"
 
311
                                "              GROUP BY tablespace_name\n"
 
312
                                "       ) s\n"
 
313
                                "       ON d.tablespace_name =  s.tablespace_name \n"
 
314
                                "  LEFT JOIN (SELECT tablespace_name,\n"
 
315
                                "                    SUM(bytes) free_size,\n"
 
316
                                "                    MAX(bytes) max_free,\n"
 
317
                                "                    COUNT(1)   free_extents\n"
 
318
                                "               FROM sys.dba_free_space\n"
 
319
                                "              GROUP BY tablespace_name\n"
 
320
                                "              UNION ALL\n"
 
321
                                "             SELECT tablespace_name,\n"
 
322
                                "                    SUM(bytes_cached) free_size,\n"
 
323
                                "                    MAX(bytes_cached) max_free,\n"
 
324
                                "                    COUNT(1)  free_extents\n"
 
325
                                "               FROM v$temp_extent_pool\n"
 
326
                                "              GROUP BY tablespace_name) f\n"
 
327
                                "       ON d.tablespace_name = f.tablespace_name\n",
311
328
                                "Display storage usage of database. This does not include the coalesced columns which may make the query sluggish on some DB:s. "
312
329
                                "All columns must be present in output (Should be 12)",
313
330
                                "0801");
318
335
                                 "       ' ',\n"
319
336
                                 "       d.contents,\n"
320
337
                                 "       d.logging,\n"
321
 
                                 "       TO_CHAR(ROUND(NVL(a.bytes / b.unit, 0),2)),\n"
 
338
                                 "       TO_CHAR(ROUND(NVL(a.bytes,0) / b.unit,2)),\n"
322
339
                                 "       TO_CHAR(ROUND(NVL(f.bytes,0) / b.unit,2)), \n"
323
 
                                 "       TO_CHAR(ROUND(NVL(a.maxbytes / b.unit, 0),2)),\n"
 
340
                                 "       TO_CHAR(ROUND(NVL(a.maxbytes,0) / b.unit,2)),\n"
324
341
                                 "       '-',\n"
325
342
                                 "       '-',\n"
326
343
                                 "       TO_CHAR(ROUND(NVL(f.maxbytes,0) / b.unit,2)), \n"
341
358
                                 "       ' ',\n"
342
359
                                 "       d.contents,\n"
343
360
                                 "       'N/A',\n"
344
 
                                 "       TO_CHAR(ROUND(NVL(a.bytes / b.unit, 0),2)),\n"
 
361
                                 "       TO_CHAR(ROUND(NVL(a.bytes,0) / b.unit,2)),\n"
345
362
                                 "       TO_CHAR(ROUND(NVL(f.bytes,0) / b.unit,2)), \n"
346
363
                                 "       '-',\n"
347
364
                                 "       '-',\n"
372
389
                         "       ' ',\n"
373
390
                         "       to_char(round(s.maxbytes/b.unit,2)),\n"
374
391
                         "       to_char(s.num),\n"
375
 
                         "       NULL,\n" // Used to fill in tablespace name
376
 
                         "       v.file#\n"
377
 
                         "  FROM sys.dba_data_files d,\n"
378
 
                         "       v$datafile v,\n"
379
 
                         "       (SELECT file_id, NVL(SUM(bytes),0) bytes, COUNT(1) num, NVL(MAX(bytes),0) maxbytes FROM sys.dba_free_space  GROUP BY file_id) s,\n"
380
 
                         "       (select :unt<int> unit from sys.dual) b\n"
381
 
                         " WHERE (s.file_id (+)= d.file_id)\n"
382
 
                         "   AND (d.file_name = v.name)\n"
 
392
                         "       NULL,\n"    // Used to fill in tablespace name
 
393
                         "       v.file#\n"  // Needed by toStorage to work
 
394
                         "  FROM (select :unt<int> unit from sys.dual) b,\n"
 
395
                         "       sys.dba_data_files d\n"
 
396
                         "  JOIN v$datafile v\n"
 
397
                         "    ON d.file_id = v.file#\n"
 
398
                         "  LEFT JOIN (SELECT file_id, NVL(SUM(bytes),0) bytes, COUNT(1) num, NVL(MAX(bytes),0) maxbytes FROM sys.dba_free_space  GROUP BY file_id) s\n"
 
399
                         "    ON s.file_id = d.file_id\n"
383
400
                         " UNION ALL\n"
384
401
                         "SELECT d.tablespace_name,\n"
385
402
                         "       v.name,\n"
394
411
                         "       ' ',\n"
395
412
                         "       ' ',\n"
396
413
                         "       '1',\n"
397
 
                         "       NULL,\n" // Used to fill in tablespace name
398
 
                         "       v.file#\n" // Needed by toStorage to work
399
 
                         "  FROM sys.dba_temp_files d,\n"
400
 
                         "       v$tempfile v,\n"
401
 
                         "       v$temp_extent_pool t,\n"
402
 
                         "       (select :unt<int> unit from sys.dual) b\n"
403
 
                         " WHERE (t.file_id (+)= d.file_id)\n"
404
 
                         "   AND (d.file_id = v.file#)",
 
414
                         "       NULL,\n"    // Used to fill in tablespace name
 
415
                         "       v.file#\n"  // Needed by toStorage to work
 
416
                         "  FROM (select :unt<int> unit from sys.dual) b,\n"
 
417
                         "       sys.dba_temp_files d\n"
 
418
                         "  JOIN v$tempfile v\n"
 
419
                         "    ON d.file_id = v.file#\n"
 
420
                         "  LEFT JOIN v$temp_extent_pool t\n"
 
421
                         "    ON t.file_id = d.file_id\n",
405
422
                         "Display information about a datafile in a tablespace. "
406
423
                         "All columns must be present in the output (Should be 14)",
407
424
                         "0801");