Solved

to find the size

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

856 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