Home » RDBMS Server » Server Administration » data storage (Oracle 10g, 10.2.0.4.0, Solaris 10)
data storage [message #458802] Tue, 01 June 2010 22:55 Go to next message
reym21
Messages: 241
Registered: February 2010
Location: Philippines
Senior Member

I do want to estimate the size of a new database (re: DB2010E + additional new tables) that will be installed in our existing server. This new db will be an enhancement of the old db (re: DB2010) installed before in the said server. As my initial step, I will based such estimation on the existing table structure.

How many bytes does the data type declared as NUMBER will be allocated? And how about the data type declared as NUMBER(5)?
Or NUMBER(10,2)?

Correct me if I'm wrong, for I knew that VARCHAR2 data type will store no. of bytes based on the length it was declared, e.g. VARCHAR2(50)-- will store 50 characters/bytes, while DATE data type will store a default of 7 bytes.

Would someone enlighten me on this? Thanks in advance.
Re: data storage [message #458803 is a reply to message #458802] Tue, 01 June 2010 23:00 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>How many bytes does the data type declared as NUMBER will be allocated? And how about the data type declared as NUMBER(5)?
>Or NUMBER(10,2)?

Do you have any of these in existing DB?
If not, what stops you from making test table & measuring results YOURSELF?

Are you unwilling or incapable to Read The Fine Manuals at http://tahiti.oracle.com where the answers already exist?
Re: data storage [message #458808 is a reply to message #458803] Tue, 01 June 2010 23:25 Go to previous messageGo to next message
Michel Cadot
Messages: 68653
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
How many bytes does the data type declared as NUMBER will be allocated?

It depends on the data.

Quote:
Correct me if I'm wrong, for I knew that VARCHAR2 data type will store no. of bytes based on the length it was declared, e.g. VARCHAR2(50)-- will store 50 characters/bytes,

You are wrong. Number of bytes is the one to store the characters of your data (plus some overhead).

Quote:
I will based such estimation on the existing table structure.

So it is easy to get the average of bytes from your current data and report it for your new tables.

Regards
Michel

[Updated on: Tue, 01 June 2010 23:26]

Report message to a moderator

Re: data storage [message #458814 is a reply to message #458803] Wed, 02 June 2010 00:20 Go to previous messageGo to next message
reym21
Messages: 241
Registered: February 2010
Location: Philippines
Senior Member

The plan is that we have just to create the new dB without it's data (just table structures), although I read the Oracle 10g data types on this site:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm
and
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#i2093

but what I'm after is a documentation of storage allocation of Oracle data types in bytes just like in MySQL, re:

DATA TYPE STORAGE REQUIRED
---------- -----------------
TINYINT 1 byte
INTEGER 4 bytes
...
DATE 3 bytes
TIME 3 bytes
YEAR 1 byte
...
VARCHAR(x) x+1 bytes if column value <255,
x+2 if >255,
etc.

Pls. refer to this:
http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html

Thanks again.


Re: data storage [message #458820 is a reply to message #458814] Wed, 02 June 2010 00:46 Go to previous messageGo to next message
Michel Cadot
Messages: 68653
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
AFAIK, Oracle removed this kind of information from its documentation many years ago as it depends on so many things. It replaces it by a procedure: DBMS_SPACE.CREATE_TABLE_COST (and same thing for index).

Regards
Michel
Re: data storage [message #459036 is a reply to message #458820] Thu, 03 June 2010 02:22 Go to previous messageGo to next message
reym21
Messages: 241
Registered: February 2010
Location: Philippines
Senior Member

Sir, it's a new thing to me, re: DBMS_SPACE.CREATE_TABLE_COST procedures.

But as a starter, can I use the SELECT DUMP syntax?
I created a test table and use the SELECT DUMP(COLUMN) FROM TABLE_NAME to know the length (in bytes) of certain data types.
In this example table(REYMTEST), I declare 'NUMBER' data types with diff. parameters:
NUMBER(16,2)
NUMBER
NUMBER(10)
NUMBER(5)
NUMBER(10,2)
NUMBER(2)

SQL> create table REYMTEST(
EX number(16,2), GAMMA number, SUN number(10),
ATOM number(5), RAYS varchar(10), HYDRO number(10,2),
MEGA number(2));

SQL> insert into REYMTEST values(12345678901234.12, 12345678901234567890, 1111111190, 55555, 'difrntrays', 1234567890.12, 99);

I extracted the supposed length(Len=) using the DUMP command:

DUMP(EX)
-----------------------------------------------
Typ=2 Len=9: 199,13,35,57,79,91,13,35,100

DUMP(GAMMA)
-----------------------------------------------
Typ=2 Len=11: 202,13,35,57,79,91,13,35,57,79,91

DUMP(SUN)
-----------------------------------------------
Typ=2 Len=6: 197,12,12,12,12,91

DUMP(ATOM)
-----------------------------------------------
Typ=2 Len=4: 195,6,56,56

DUMP(HYDRO)
-----------------------------------------------
Typ=2 Len=7: 197,13,35,57,79,91,13

DUMP(MEGA)
-----------------------------------------------
Typ=2 Len=2: 193,100

Is this fair enough to come up with a rough estimate of a table structure size (without data)?

Thanks again.
Re: data storage [message #459042 is a reply to message #459036] Thu, 03 June 2010 02:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68653
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Is this fair enough to come up with a rough estimate of a table structure size (without data)?

1/ Instead of DUMP use VSIZE
2/ If it is fair or not only you can answer if what you posted represents the data you will have.

Regards
Michel
Re: data storage [message #459248 is a reply to message #459042] Fri, 04 June 2010 02:21 Go to previous message
reym21
Messages: 241
Registered: February 2010
Location: Philippines
Senior Member

Thanks so much for this.

Regards.
Previous Topic: Oracle 11g installation error
Next Topic: How many databases
Goto Forum:
  


Current Time: Sun May 19 16:39:58 CDT 2024