shaman200 | Salut a tous!
J'utilise un p'tit script que j'ai trouve sur le net.
J'ai fait quelque modifs d'ordre esthetique.
Code :
- action(){
- sqlplus '/ as sysdba'<<!
- SET ECHO OFF
- ALTER SESSION
- SET NLS_DATE_FORMAT = 'DD/MM/YYYY HH24:MI:SS';
- Set lines 80
- SET FEEDBACK OFF
- SET TRIMSPOOL ON
- col NOM format a21 heading "Nom"
- col TOTAL format a15 heading "Total"
- col FREE format a15 heading "Espace libre"
- col PERCENT_FREE format a20 heading "Pourcentage libre"
- select a.tablespace_name as nom,
- lpad(substr(round(a.bytes / (1024*1024),1),1,10)||' M',10) as total,
- lpad(substr(round(b.bytes / (1024*1024),1),1,10)||' M',10) as free ,
- lpad(substr(round(100* b.bytes / a.bytes,1),1,8)||' %',12) as percent_free
- from
- (select tablespace_name, sum(bytes) bytes from dba_data_files
- group by tablespace_name) a,
- (select tablespace_name, sum(bytes) bytes from dba_free_space
- group by tablespace_name) b
- where a.tablespace_name = b.tablespace_name
- order by percent_free;
- !
- }
- action| awk '/^SQL> /, /^SQL> D/' | grep -v "SQL>"|grep -v "Session altered"
|
Ce script sert a voir l'espace libre des tablespace oracle.
Comme vous pouvez le voir je veux que les resultats soit trié par % d'espace libre.
Voici le resultat
Code :
- Nom Total Espace libre Pourcentage libre
- --------------------- --------------- --------------- --------------------
- ATXCC08UT_0211 2402 M 1250 M 52 %
- ATXCCC03UI 500 M 290 M 58 %
- ATXCC10UT_0305 3903 M 25 M ,6 %
- ATXCC10UI_0510 101 M 100 M 99 %
- ATXCC08UI_0601 101 M 100 M 99 %
- ATXCC10UT_0209 3603 M 50 M 1,4 %
- ATXCC17UT_0212 3503 M 50 M 1,4 %
- ATXCC08UI_0508 201 M 200 M 99,5 %
- ATXCC24UT 501 M 500 M 99,8 %
- ATXCCH06AT 151 M 150,6 M 99,8 %
|
Le probleme, c'est que des que le nombre n'est plus un entier, le tri est faux (voir ci dessus)
J'ai pas trouver de solution via le tri SQL.... Donc si vous avez des idées, n'hesitez pas!!
Merci ![:jap: :jap:](https://forum-images.hardware.fr/icones/smilies/jap.gif) Message édité par shaman200 le 15-01-2006 à 09:21:37
|