Because of deferred segment creation.
In Oracle 11.2, when you create a table with no data, you no longer allocate any space in the tablespace. Oracle doesn't actually create the segment until you try to insert data into the table. This is a difference from earlier versions in which the segment was created when the table was created rather than when data was inserted.
The reason for the new feature is that there are a lot of packaged applications on the market that create potentially hundreds of tables that will never have data because the customer isn't using some specific module of the project that uses those tables. It was annoying for someone that packaged a big ERP tool, for example, to end up with potentially GB of space allocated to tables that would never have any data.
You'll only see deferred segment creation if you've set COMPATIBLE
to 11.2 and if DEFERRED_SEGMENT_CREATION
is set to the default of TRUE
SQL> conn / as sysdba
Connected.
SQL> show parameter compatible
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
compatible string 11.2.0.0.0
SQL> show parameter deferred
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
deferred_segment_creation boolean TRUE
SQL> create user deferred identified by deferred default tablespace users;
User created.
SQL> crant create table, create session to deferred;
SP2-0734: unknown command beginning "crant crea..." - rest of line ignored.
SQL> grant create table, create session to deferred;
Grant succeeded.
SQL> conn deferred/deferred
Connected.
SQL> create table test( col1 number );
Table created.
SQL> insert into test values( 1 );
insert into test values( 1 )
*
ERROR at line 1:
ORA-01950: no privileges on tablespace 'USERS'
You've missed one place to get an overview of Oracle: the Concepts Guide. It covers all the major topics (including backup and recovery, which is quite important and doesn't appear in the list of links you've posted).
Whats the next step? Create the Schema or Tablespace?
Both! They're orthogonal. Users are logical entities that access your database. Tablespaces are a storage concept. A user can have access to multiple tablespaces, and a tablespace can store data from multiple schemas. You need both, and you need to grant access to the appropriate tablespace to the users you create. (See e.g. here for the difference between user and schema.)
Tablespace datafile(s) is where actual data from tables is stored?
Yes, all your database's data and indexes are stored in tablespaces. The main storage structures are:
- Ordinary tablespaces store normal, persistent data. That's going to be the largest part of your database, space-usage wise.
- Temporary tablespaces store non-persistent data - global temporary tables that get purged at the end of sessions or transactions, temporary storage for things like on-disk sorts, etc.
- Undo tablespace(s) and redo log files: that's what Oracle uses to provide ACID guarantees.
- Control files: they describe your database (name, files, log sequence and checkpoint information, even some backup info).
(The system tablespace is an ordinary tablespace, except that you shouldn't store anything in it - consider it as Oracle internal and off-limits for ordinary use.)
In addition, your should take great care of your redo log files, the "most crucial structure for database recovery". They are "hot" (lots of writes) and should be on their own disks/luns.
How many [tablespaces/datafiles] are needed?
As much as you need. There's no general rule here. The number of datafiles will depend on how much data you need to store, operating system limits, Oracle datafile size limits, your storage (hard disks/volumes) constraints, backup/recovery considerations (e.g. having only one humongous Bigfile datafile might not be the best idea), ...
How you structure your tablespaces is up to you too. Having a tablespace per "application" in your tablespace can be good approach to get started. You can always create more tablespaces later if needed (but keep in mind that moving an object from one tablespace to another can be time-consuming, and might require either downtime or pretty complex operations).
Default or Temporary?
Both! You need space to store your data persistently, and you also need some amount of temporary storage for your database's operation.
How much space will I need for it?
Anywhere between a few megabytes and several terabytes – only you can know here. To estimate the space you need for a table, create a table with the same structure, fill it up with some sample data (should be more or less statistically representative of what you'll be storing in it) and measure the space usage. Then extrapolate. Don't forget to include the space required indexes (and materialized views)!
Autoextend?
I'd say yes, use autoextend features, but set limits. You probably shouldn't let Oracle try to autoextend past the actual available space on your filesystems. And monitor space usage. (Keep in mind that datafile extension is relatively costly. Don't set the autoextend size too small.)
For ZFS specifically, Oracle has a whitepaper you might be interested in: Configuring ZFS for an Oracle Database (270k PDF).
Best Answer
Since you quoted SQL Developer in your question -
View > DBA
Add your connection.
Go to Storage, Tablespaces.
Right-click, 'Create New'
Fill in the details - and I agree with Gerard Pile's comment to your question - you don't need to worry about what you're worrying about. Just pick a directory, file name, and intial file size, and how you want it to grow, with an optional max file size.
You could theoretically override the database's DB_BLOCK_SIZE on the 'Properties' page, but that's generally not necessary.
If you want to see the SQL that's generated by the dialog, click on the 'DDL' page of the popup, otherwise, just click 'Ok.'