Solved

to find the size

Posted on 2014-04-04
7
371 Views
Last Modified: 2014-04-06
I was trying to find the size of the database...
The results not executed.
Can you please rectify..


SQL> select
( select sum(bytes)/1024/1024/1024 data_size from dba_data_files ) +
  2    3  ( select nvl(sum(bytes),0)/1024/1024/1024 temp_size from dba_temp_file                                                                                                 s ) +
  4  ( select sum(bytes)/1024/1024/1024 redo_size from sys.v_$log ) +
  5  ( select sum(BLOCK_SIZE*FILE_SIZE_BLKS)/1024/1024/1024 controlfile_size fro                                                                                                 m v$controlfile) "Size in GB"
  6  from
  7  dual
  8
SQL> select
( select sum(bytes)/1024/1024/1024 data_size from dba_data_files ) +
  2    3    2    3  ( select nvl(sum(bytes),0)/1024/1024/1024 temp_size from dba_temp_file                                                                                                 s ) +
  4    4  ( select sum(bytes)/1024/1024/1024 redo_size from sys.v_$log ) +
  5    5  ( select sum(BLOCK_SIZE*FILE_SIZE_BLKS)/1024/1024/1024 controlfile_size fro                                                                                                 m v$controlfile) "Size in GB"
  6    6  from
  7    7  dual
  8
0
Comment
Question by:tonydba
  • 4
  • 2
7 Comments
 
LVL 23

Expert Comment

by:David
ID: 39978267
First off, your examples lack either the "/" or ";" to execute the statement.
0
 
LVL 37

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 500 total points
ID: 39978265
Your first query runs just fine?

select
( select sum(bytes)/1024/1024/1024 data_size from dba_data_files ) +
( select nvl(sum(bytes),0)/1024/1024/1024 temp_size from dba_temp_files ) +
( select sum(bytes)/1024/1024/1024 redo_size from sys.v_$log ) +
( select sum(BLOCK_SIZE*FILE_SIZE_BLKS)/1024/1024/1024 controlfile_size from v$controlfile) "Size in GB"
from
dual;

I get a size back in GB that matches the DB I tried it on.
0
 
LVL 23

Expert Comment

by:David
ID: 39978274
Note that Gerwin used in line 8, "dual;" whereas you had "dual".
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 37

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39978273
2nd one runs also, same result.

How are you running this query and what error do you get?
0
 
LVL 23

Expert Comment

by:David
ID: 39978351
Ahhh -- look at line 5, you have split the word "from" with a carriage return.  Copy and paste Gerwin's example, or else run your code through a text editor to proof for punctuation.
0
 
LVL 23

Expert Comment

by:David
ID: 39978358
Tony, a side comment since I don't have email access.  You are asking a slew of great, new questions this week.  Would you please take time to go back through them, and close the issues by awarding points.  Guidelines on doing so are available with a help query.

Regards,
dvz
0
 

Author Closing Comment

by:tonydba
ID: 39981567
This is good..
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL query question 8 78
PL/SQL Two changes 7 27
Create Index on a Materialized View 5 24
Trying to get a Linked Server to Oracle DB working 21 60
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

777 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