Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 931
  • Last Modified:

How I estimate usage disk space of My Database.

I will make specification of Billing System and offer to board. I have ER-Diagram. But I don't have DB Server. So I must make price of Hardware Server and Software. Now I don't know usage disk space requirement for Oracle Database Server. How I estimate usage disk space for my database server.
Please.
0
teetaro
Asked:
teetaro
  • 4
  • 3
  • 3
  • +2
1 Solution
 
srikant033100Commented:
For estimation of disk space first u have to calculate the space requirement for each of the table .

Take each table and then calculate the average rowlenght and then the average no of rows likely to have in that table that will give u the space requirement of a table similary u have to go through each and every table or else go for the big table and have some sample estimation for the small table and then have some extra space and also keep some grace

srikant
0
 
srikant033100Commented:
In the above calcuation u should also keep in mind system file space requirements and indexes and temp space for sorting and other things. Its more like overall guess work

srikant
0
 
teetaroAuthor Commented:
Thank you for srikant 's proposed answer.
But I want to know disk space used for each field type  (such as date ,number ,varchar2) on Oracle DB Server too.
So I can calculate space requirement for each of the table.
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
srikant033100Commented:
The storage occury by field are

char(n)- n byes
varchar2(n) - n byes but if u specify varchar2(20) and put only 10 char then it take only 10 byes

number max 21 byes but generally it takes not more than 10-15 byes

rowid 6 byes
datetime 18 byes

Srikant
0
 
renurajCommented:
VSIZE function gives the diskspace used for each field type.

For Ex:

select vsize(empno), vsize(ename), vsize(hiredate) from emp
where rownum < 3;

Output:

VSIZE(EMPNO) VSIZE(ENAME) VSIZE(HIREDATE)
------------ ------------ ---------------
           3            6               7
           3            5               7

In this way, after calculating the row size for each table and no of rows estimated for each table gives the diskspace occupied by table.

Regards,
0
 
renurajCommented:
VSIZE returns the number of bytes in the internal representation

This is in addition to the above proposed answer.

Regards,
0
 
srikant033100Commented:
Hi but he doesnot have the database in place that's why the vsize will not help

srikant
0
 
tvspriyaCommented:
Example: Table Name Allocations
 ALLOC_ID                        NOT NULL NUMBER(20)
 REQUEST_ID                      NOT NULL NUMBER(20)
 STATUS_ID                       NOT NULL NUMBER(20)
 CREATION_DATE                   NOT NULL DATE
 CREATED_BY                      NOT NULL VARCHAR2(30)

Normally, Date takes 7, Varchar2 takes the same size as specified size and Number also the same. So for the above mentioned Table stucture the Average Row Length is 97, add some buffer so multiply that value with 1.2, you get 116.4 put it as 117 add 3 for Row Header, you get 120. This way you have to calculate all the tables' average row length. Then subsequently you can calculate the estimated Table storage size based on this Average row length multiplied with the expected number of rows for a period normally DBA will do this for 6 months. Summ up all these values you will get the disk space required. Ensure you add some buffer at the end to be on the safe side. Hope this helpls you.

tvspriya
0
 
teetaroAuthor Commented:
Thank you for renuraj 's proposed answer.
But it doesn't suit directly my question because I don't have any DB Server yet.
Thank you for tvspriya 's comment.
Your comment make me clear ,
but if I specify field type as NUMBER(20,2) ,how much storage does it take?
And I suspect about Date field ,you said "Date takes 7 bytes" ,but [Srikant] said Datetime take 18 bytes ,
Whome should I believe?
0
 
renurajCommented:

If NLS_DATE_FORMAT is set as DD-MON-YY then date field takes 7 bytes and if it is set as DD-MM-YYYY then date field takes as 8 bytes.  This depends on the NLS_DATE_FORMAT set.

Srikant mentioned it for both date and time, which takes 18 bytes (maximum) to store date as well as time .

Regards,  
 
0
 
davidgornshteinCommented:

Hi,
  Your question a bit complicated, but I will
  give you basics for the answer, I mean
  basic type sizes in addition to already explained
  and all overhaeds.
  Number defined in oracle as variable length sequence
  where first byte is exponent + sign (msb) and
  all other bytes are mantissa represented in excess 100
  and last byte is 0x66 for negatives.
  Generally, regular number (integer) takes about ~3-6
  bytes, float ~6-12 bytes.
 
  char and varchar2 explained well in "srikant" comment.
  however date is 7 bytes:
   first two bytes: centry and year (excess 100 format)
   next 2 bytes: month and day
   last 3 bytes: hours, minutes and seconds (24 hours
   excess 1 format)

  "18 bytes" it's mistake  !!!
  Example for all the guys:

  SQL> select dump(to_date('12:12:12  
    12:12:1999', 'hh24:mi:ss dd:mm:yyyy')) from dual;

DUMP(TO_DATE('12:12:1212:12:1
-------------------------
Typ=13 Len=8: 7,207,12,12,12,12,12,0

Real length is 7 first byte is length itself - overhead
as I will explain later.

  each value (number, char, varchar2) have 1 byte length
  overhead is stored as |column len | data
  each row have 3 bytes of row header overhead
  real life example:
upper line it's binary data, lower explanation.

2C  01     03     02                           C1 33
Row Flg     Lck b.     Cols# [ 2]     col  0: [ 2]  c1 33    

 C1 33 it's number, 50 in dec.

each rowid in index in oracle 8 is 10 bytes:
example rowid = AAAA73AADAAAGuqAAa
---------------------------------------------------
10 00 00 14 247 00 192 107 170 00 26

Block header overhead for datablock is 48 Bytes -
it is block header with 1 default ITL -
Cache/Transaction layer header.
 
You will define tables with some pctfree
it's additional overhead.
Block Size * pctfree/100

Each additonal ITL (defined by INITRANS in create
table clause)
have additional overhead of 24 bytes per data block.

You could also have additional overhead of segment
header - one block, if you have multiple freelist groups
each such group have header block.

Each chained or migrated row is 10 bytes overhead,
but you will have such rows only after some time
of work.

So, you will have additional overhead of
10 * (Chained rows per block + migrated row per block)

Your rollback segments tablespace
in prodution DB should be at least 2GB.
System tablespace at least 500 MB.
Tempoarary tablespace at least 2GB.  

Generaly, there are no magic answer to your question,
but this answer is most close to realty :-)
If you have additional questions about the terms
I used - e-mail is good invention :-).

Best regards.
David Gornshtein
Oracle Certified Professional
Oracle & MS Sql Server senior DBA
davidg@extent.com
Extent Technologies Ltd.
972-3-7530635    
0
 
teetaroAuthor Commented:
Thank you everybody for your comment/answer.
0

Featured Post

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.

  • 4
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now