Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help - Sys admin needs help with DBA role!!

Re: Help - Sys admin needs help with DBA role!!

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 30 Nov 1998 16:01:18 GMT
Message-ID: <3663bf81.6953839@192.86.155.100>


A copy of this was sent to bikeruk_at_my-dejanews.com (if that email address didn't require changing) On Mon, 30 Nov 1998 11:56:54 GMT, you wrote:

>Hi,
>
>First off, I'm a sys admin who has been tasked with a DBA task, so if I make a
>few mistakes, bear with me.
>
>I have been asked to provide the following:
>
>For all tables in a given schema, record the total number of records and the
>size in Mbs of each table. I have the SQL for the number of records as :
>select count (*) from <table name> and this seems to work, but how do I find
>out the other information. Also, how do I record this back to a unix
>text/ascii file for me to manipulate further.
>
>I'm after some form of output that provides the following layout:
>
>Date,TableName,Records,Size(Mb)
>

if you analyze your tables for statistics, then the easiest way to do this (after an analyze, when the numbers are the 'freshest') is:

select sysdate, table_name, num_rows,

       trunc(blocks * YOUR_BLOCK_SIZE/1024/1024) from user_tables;

where YOUR_BLOCK_SIZE is the blocksize you are using in your database.

If you don't analyze then:

select sysdate, '&1', trunc(bytes/1024/1024), count(*)   from &1, dba_segments
 where segment_name = upper('&1')
 group by sysdate, '&1', trunc(bytes/1024/1024) /

can get it table by table...

>
>Regards,
>
>Mark Smithers
>msmithers_at_ndsuk.com
>bikeruk_at_my-dejanews.com
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Mon Nov 30 1998 - 10:01:18 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US