Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

to find the size

Posted on 2014-04-04
7
Medium Priority
?
397 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 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 2000 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

876 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