x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 936

# 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.
0
teetaro
• 4
• 3
• 3
• +2
1 Solution

Commented:
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

Commented:
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

Author 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

Commented:
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

Commented:
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

Commented:
VSIZE returns the number of bytes in the internal representation

Regards,
0

Commented:
Hi but he doesnot have the database in place that's why the vsize will not help

srikant
0

Commented:
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

Author 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

Commented:

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

Commented:

Hi,
Your question a bit complicated, but I will
give you basics for the answer, I mean
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
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:
---------------------------------------------------
10 00 00 14 247 00 192 107 170 00 26

it is block header with 1 default ITL -

You will define tables with some pctfree
Block Size * pctfree/100

Each additonal ITL (defined by INITRANS in create
table clause)

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.

10 * (Chained rows per block + migrated row per block)

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

but this answer is most close to realty :-)
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

Author Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.