Hi guys,
Please give an advise about what I am missunderstanding in following issue I have.
Database version:
SQL>SELECT banner FROM v$version;
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
"CORE 11.2.0.1.0 Production"
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
The issue I have is...
I don't understand why the following query,
SELECT limit_
,current_usage
,maximum_limit
,pct_max_limit
,ROUND(current_usage*100/maximum_limit) pct_used
FROM
(
SELECT 'DB Sessions' limit_, p.cnt maximum_limit, c.cnt current_usage, 85 pct_max_limit
FROM (SELECT TO_NUMBER(value) cnt FROM v$parameter WHERE name = 'sessions') p
,(SELECT COUNT(*) cnt FROM v$session) c
UNION ALL
SELECT 'DB Processes' limit_, p.cnt maximum_limit, c.cnt current_usage, 85 pct_max_limit
FROM (SELECT TO_NUMBER(value) cnt FROM v$parameter WHERE name = 'processes') p
,(SELECT COUNT(*) cnt FROM v$process) c
UNION ALL
SELECT 'DB Files' limit_, p.cnt maximum_limit, c.cnt current_usage, 85 pct_max_limit
FROM (SELECT TO_NUMBER(value) cnt FROM v$parameter WHERE name = 'db_files') p
,(SELECT SUM(cnt) cnt FROM (SELECT COUNT(*) cnt FROM v$datafile
UNION ALL
SELECT COUNT(*) cnt FROM v$tempfile
)
) c
UNION ALL
SELECT 'ASM DiskGroups' limit_, p.cnt maximum_limit, c.cnt current_usage, 85 pct_max_limit
FROM (SELECT 63 cnt FROM dual) p /*ASM Storage Limits 11gr2*/
,(SELECT COUNT(*) cnt FROM v$asm_diskgroup) c
UNION ALL
SELECT 'ASM Disks' limit_, p.cnt maximum_limit, c.cnt current_usage, 85 pct_max_limit
FROM (SELECT 10000 cnt FROM dual) p /*ASM Storage Limits 11gr2*/
,(SELECT COUNT(*) cnt FROM v$asm_disk) c
)
--WHERE
;
;
that returns in my DEV environment the following ouput
LIMIT_ | CURRENT_USAGE | MAXIMUM_LIMIT | PCT_MAX_LIMIT | PCT_USED |
DB Sessions | 79 | 3792 | 85 | 2 |
DB Processes | 80 | 2500 | 85 | 3 |
DB Files | 179 | 200 | 85 | 90 |
ASM DiskGroups | 0 | 63 | 85 | 0 |
ASM Disks | 0 | 10000 | 85 | 0 |
When I put the following WHERE clause
WHERE ROUND(current_usage*100/maximum_limit) >= 85
Returns the following error (alse tested in 11.2.0.3):
ORA-01476: divisor is equal to zero
01476. 00000 - "divisor is equal to zero"
*Cause:
*Action:
I am totally lost in this .....
Can you help me please?
Thanks in advance.
Regards,
Juan M