[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

to fix thiis

Posted on 2014-04-03
7
Medium Priority
?
311 Views
Last Modified: 2014-04-08
SQL> SELECT
  2  NAME,
  3  TO_CHAR(SPACE_LIMIT, '999,999,999,999') AS SPACE_LIMIT,
  4  TO_CHAR(SPACE_LIMIT - SPACE_USED + SPACE_RECLAIMABLE,
  5  '999,999,999,999') AS SPACE_AVAILABLE,
  6  ROUND((SPACE_USED - SPACE_RECLAIMABLE)/SPACE_LIMIT * 100, 1)
  7  AS PERCENT_FULL
  8  FROM V$RECOVERY_FILE_DEST;
ROUND((SPACE_USED - SPACE_RECLAIMABLE)/SPACE_LIMIT * 100, 1)
                                      *
ERROR at line 6:
ORA-01476: divisor is equal to zero


What is the error here? how to fix..
0
Comment
Question by:tonydba
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 39976248
space_limit is 0 for at least one row.


how to fix is up to you.  What do you want to be displayed when the space limit is 0?
0
 
LVL 23

Expert Comment

by:paquicuba
ID: 39976254
Put a decode around it (I put 1 but may be wrong)
ROUND((SPACE_USED - SPACE_RECLAIMABLE)/decode(SPACE_LIMIT,0,1,SPACE_LIMIT) * 100, 1)

Or add a condition:
WHERE SPACE_LIMIT > 0
0
 
LVL 15

Expert Comment

by:Devinder Singh Virdi
ID: 39976257
Add
WHERE SPACE_LIMIT != 0 AND .....
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 15

Expert Comment

by:Devinder Singh Virdi
ID: 39976276
Another method:
Try this:-

SELECT
    NAME,
    TO_CHAR(SPACE_LIMIT, '999,999,999,999') AS SPACE_LIMIT,
    TO_CHAR(SPACE_LIMIT - SPACE_USED + SPACE_RECLAIMABLE,
    '999,999,999,999') AS SPACE_AVAILABLE,
    DECODE(to_char(PACE_LIMIT),'0','NaN',to_char(ROUND((SPACE_USED - SPACE_RECLAIMABLE)/SPACE_LIMIT * 100, 1)))
    AS PERCENT_FULL
    FROM V$RECOVERY_FILE_DEST;

I haven't ran above SQL, but should work fine.
Before calculating PERCENT_FULL, it will validate if SPACE_LIMIT=0, if it does, then NaN(Not a Number) will be displayed.
0
 
LVL 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 2000 total points
ID: 39976817
SELECT
NAME,
TO_CHAR(SPACE_LIMIT, '999,999,999,999') AS SPACE_LIMIT,
TO_CHAR(SPACE_LIMIT - SPACE_USED + SPACE_RECLAIMABLE,'999,999,999,999') AS SPACE_AVAILABLE,
case SPACE_LIMIT
  when 0 then 'ZERO SPACE_LIMIT'
  else ROUND((SPACE_USED - SPACE_RECLAIMABLE)/SPACE_LIMIT * 100, 1)
end AS PERCENT_FULL
FROM V$RECOVERY_FILE_DEST;
0
 
LVL 32

Expert Comment

by:awking00
ID: 39978389
To get the proper answer, you need to answer sdstuber's question as to what you want to see in the case where space_limit is zero. Your basic choices are 0, null, space_used minus space_reclaimable, or some message string (which I wouldn't recommend given the numeric nature of the fields).
0
 

Author Closing Comment

by:tonydba
ID: 39986468
Thank youi.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question