Solved

to find the size

Posted on 2014-04-04
7
359 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 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
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.

Join & Write a Comment

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 …
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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 shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now