Académique Documents
Professionnel Documents
Culture Documents
The following example describes Oracle Database operations at the most basic level.
This illustrates an Oracle Database configuration where the user and associated server
process are on separate computers, connected through a network.
1. An instance has started on the computer running Oracle Database, often called the
host or database server.
2. A computer running an application (a local computer or client workstation) runs
an application in a user process. The client application attempts to establish a
connection to the server using the proper Oracle Net Services driver.
3. The server is running the proper Oracle Net Services driver. The server detects the
connection request from the application and creates a dedicated server process on
behalf of the user process.
4. The user runs a SQL statement and commits the transaction. For example, the user
changes a name in a row of a table.
5. The server process receives the statement and checks the shared pool (an SGA
component) for any shared SQL area that contains a similar SQL statement. If a
shared SQL area is found, then the server process checks the user's access
privileges to the requested data, and the existing shared SQL area is used to
process the statement. If not, then a new shared SQL area is allocated for the
statement, so it can be parsed and processed.
6. The server process retrieves any necessary data values, either from the actual
datafile (table) or those stored in the SGA.
7. The server process modifies data in the system global area. The database writer
process (DBWn) writes modified blocks permanently to disk when doing so is
efficient. Because the transaction is committed, the log writer process (LGWR)
immediately records the transaction in the redo log file.
8. If the transaction is successful, then the server process sends a message across the
network to the application. If it is not successful, then an error message is
transmitted.
9. Throughout this entire procedure, the other background processes run, watching
for conditions that require intervention. In addition, the database server manages
other users' transactions and prevents contention between transactions that
request the same data.
Reclaiming Unused Space
At the time of table creation there is no extend allocate for this table, when table data are
increasing/inserting new extend are allocating for this table and extend are not leave until table
are :
1. drop
2. Truncate
3. Move table to same/another tablespace.
After deleting data from table space are not release, because when we delete data from the table
block will go onto the freelist for that table only, for that another table/extend are not able to use
this free blocks and space are not usable by another table/extends.
1. Move Tablespace.
2. Export and import table by using data pump.
3. Redefine table using DBMS_REDEFINITION
4. Create new table, drop existing table, rename new table [Must create existing index in new
table].
5. Drop table [If there is no data and table are not required in future ].
6. Truncate table [if Table data are not required].
What is difference between oracle SID and Oracle service name?
Oracle SID is the unique name that uniquely identifies your instance/database where as the service
name is the TNS alias can be same or different as SID.
What is the difference between data block/extent/segment?
A data block is the smallest unit of logical storage for a database object. As objects grow they take
chunks of additional storage that are composed of contiguous data blocks. These groupings of
contiguous data blocks are called extents. All the extents that an object takes when grouped together
are considered the segment of the database object.
The system change number (SCN) is an ever-increasing value that uniquely identifies a
committed version of the database at a point in time. Every time a user commits a transaction
Oracle records a new SCN in redo logs.
Oracle uses SCNs in control files datafile headers and redo records. Every redo log file has both
a log sequence number and low and high SCN. The low SCN records the lowest SCN recorded
in the log file while the high SCN records the highest SCN in the log file.
The following are the parameter that will be used by DBA to adjust time or interval of how
frequently its checkpoint should occur in database.
LOG_CHECKPOINT_TIMEOUT = 3600; # Every one hour
LOG_CHECKPOINT_INTERVAL = 1000; # number of OS blocks.
What happens when we fire SQL statement in Oracle?
First it will check the syntax and semantics in library cache, after that it will create execution
plan.
If already data is in buffer cache it will directly return to the client.
If not it will fetch the data from datafiles and write to the database buffer cache after that it will
send server and finally server send to the client.
What is the use of large pool, which case you need to set the large pool?
You need to set large pool if you are using: MTS (Multi thread server) and RMAN Backups.
Large pool prevents RMAN & MTS from competing with other sub system for the same
memory. RMAN uses the large pool for backup & restore when you set the
DBWR_IO_SLAVES or BACKUP_TAPE_IO_SLAVES parameters to simulate asynchronous
I/O. If neither of these parameters is enabled, then Oracle allocates backup buffers from local
process memory rather than shared memory. Then there is no use of large pool.
Oracle Instance:
a means to access an Oracle database,always opens one and only one database and consists of
memory structures and background process.
Oracle server:
a DBMS that provides an open, comprehensive, integrated approach to information
management,Consists of an Instance and a database.
Oracle database:
a collection of data that is treated as a unit,Consists of Datafiles, Control files, Redo log files.
(optional param file, passwd file, archived log)
Background processes:
Started when an Oracle Instance is started.
Background Processes Maintains and enforces relationships between physical and memory
structures
There are two types of database processes:
1. Mandatory background processes
2. Optional background processes
Mandatory background processes:
DBWn, PMON, CKPT, LGWR, SMON
Optional background processes:
ARCn, LMDn, RECO, CJQ0, LMON, Snnn, Dnnn, Pnnn, LCKn, QMNn
DBWn writes when:
Checkpoint occurs
Dirty buffers reach threshold
There are no free buffers
Timeout occurs
RAC ping request is made
Tablespace OFFLINE
Tablespace READ ONLY
Table DROP or TRUNCATE
Tablespace BEGIN BACKUP
Log Writer (LGWR) writes:
At commit
When 1/3rd full
When there is 1 MB of redo
Every 3 seconds
Before DBWn writes
System Monitor (SMON) Responsibilities:
Instance recovery
Rolls forward changes in redo logs
Opens database for user access
Rolls back uncommitted transactions
Coalesces free space
Deallocates temporary segments.
Process Monitor (PMON) Cleans up after failed processes by:
Rolling back the transaction
Releasing locks
Releasing other resources
Restarting dead dispatchers
Checkpoint (CKPT) Responsible for:
Signaling DBWn at checkpoints
Updating datafile headers with checkpoint information
Updating control files with checkpoint information
Archiver (ARCn)
Optional background process
Automatically archives online redo logs when ARCHIVELOG mode is set
Preserves the record of all changes made to the database