Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Bolat.

Asked: January 19, 2017 - 5:23 am UTC

Last updated: January 20, 2017 - 9:41 am UTC

Version: 11.2.0.4

Viewed 1000+ times

You Asked

Hi Tom,
please recommend how to select right values

When selecting data from v$recovery_file_dest - I get the long values for columns SPACE_LIMIT & SPACE_USED
The question is how to convert them to right format?

select * from V$RECOVERY_FILE_DEST;

NAME SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
-------------------------------------------------- ----------- ---------- ----------------- ---------------
/u05/app/oracle/fast_recovery_area 3.3554E+10 2.8936E+11 2417879040 1560

How to format it in above select?
-
Because report is understandable for me:

SYS:DB1:MOUNTED> set lines 120
col name format a36
col size_mb format 999,999,999
col used_mb format 999,999,999
col pct_used format 999
TTITLE CENTER "Fast Recovery Area Space Status" SKIP 1 -
CENTER =================================
select
name,
ceil( space_limit / 1024 / 1024) size_mb,
ceil( space_used / 1024 / 1024) used_mb,
decode( nvl( space_used, 0),0, 0,
ceil ( ( space_used / space_limit) * 100) ) pct_used
from
v$recovery_file_dest
order by
name desc;

Fast Recovery Area Space Status
=================================
NAME SIZE_MB USED_MB PCT_USED
------------------------------------ ------------ ------------ --------
/u05/app/oracle/fast_recovery_area 32,000 275,960 863

1 row selected.

How to format it in the report script?

Thanks!

and Chris said...

What is the "right format" for you?

If you want to see long numbers in the entirety, i.e. not shorted to E+10 format, either ensure the SQL*Plus format is long enough or use to_char:

SQL> col n format 999,999,999,999
SQL> select 33554432000 n from dual;

               N
----------------
  33,554,432,000

SQL> select to_char(33554432000, '999,999,999,999') c from dual;

C
----------------
  33,554,432,000


Is this answer out of date? If it is, please let us know via a Comment