How oracle saves your tables ?

All of you probably at least once in your life try to insert some records to a database table, but is anyone of you ever try to understand how Oracle actually saves the entries in the database? Last time I was making a small experiment and I want to share my results with you.

Step one, let’s build a small table and insert a few records:

Now, let’s insert some data to table:

After that my table content looks like below:

Let’s start some fun and check how my dump from Oracle DB looks like. First of all, I need to find the block where the table is stored:

Create a dump from the selected block:

Now I have to run the console, ssh into the remote system and check last files in Oracle directory:

Section of my dump looks like below:

If we look closer at block_row_dump, you will see some repeatability.  Let’s check what is the meaning of lines with c2 at the start.

To achieve this, we can just execute SQL statement below:

and a result of this statement is:

Value of raw 'c2 03 17′ is : 222. You can check all these values and everything will look like our inserts on the beginning. To be more precise we are actually on „row” level of database storage:

That’s all for today, this is a basic knowledge related to database data save in tables. This knowledge is a key to understand how to works indexing or compression on the database.


Sprawdź też

Let’s write our own database!

I think it is a time to do something really crazy, write something which probably …