Solved

to find the size

Posted on 2014-04-04
7
383 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
[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
  • 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 38

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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 38

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

729 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