Oracle writes whole file during database creation is it ok

oracleoracle-11g-r2tablespaces

Consider empty (!) database creation:

CREATE TABLESPACE reload DATAFILE 'D:\myDb.dbf'  SIZE 3000M  ONLINE;

This is leads to writring 3000 megabytes to the disk for empty database. Is it normal for oracle? I am new to oracle database, did I miss something important in CREATE TABLESPACE which leads to such behavior?

Best Answer

If you are able to create this tablespace(logical entity of Oracle database to hold user objects) then you already have created the database.

Yes, this is expected. The statement defines a datafile of 300MB size in underlying storage.

You can also auto increment size. For example, initially you have defined its size as 300M. When you create new objects and perform DML, they will use this space. Once this 300M is consumed by objects you need to either add new datafile or increase its size or let the Oracle increment its size as needed.

Example:

CREATE TABLESPACE tbs_02 
   DATAFILE '/diskb/tbs_f5.dbf' SIZE 500K REUSE
   AUTOEXTEND ON NEXT 500K MAXSIZE 100M;

It creates a tablespace called tbs_02with a datafile of 500K initial size. Once the 500K is occupied by objects it will be incremented by 500K at once and grows upto 100MB.

If you are new to Oracle database I strongly suggest you to follow Oracle Concepts Manual

Reference:

CREATE TABLESPACE

storage_clause