Professional Documents
Culture Documents
vi.
c. Physical Database Structures: Datafiles, redo log files, control files
i. Data File
1. Datafiles contain all the database data.
2. A datafile can be associated with only one database
3. One or more datafiles form a logical unit of database storage called a
tablespace
ii. Redolog
1. A set of files that protect altered database data in memory that has not
been written to the datafiles. The redolog can consist of two parts: the
online redo log and archived redo log
2. Online redo log – set of two or more online redo log files that record all
changes made to the database, including both committed and
uncommitted changes. Redo entries are temporarily stored in redo log
buffers of the SGA and LGWR background process writes the redo
entries sequentially to an online redo log file
3. Archived redo log – Optionally, online redo files can be archived before
being reused, creating an archived redo log.
iii. Control File
1. A binary file that records the physical structure of a database and
contains the database name, the names and locations of associated
databases and online redo log files, the time stamp of the database
creation, the current log sequence number, and checkpoint information.
Every Oracle database should have atleast two control files, each
stored on a different disk.
2. What is SGA
a. The System Global Area is a shared memory region that contains data and control
information for one Oracle instance. Oracle allocates the SGA when an instance starts
and deallocates it when the instance shuts down.
b. Information stored in SGA is divided into
i. Database buffers use the most recently used blocks of data (less for
DataWarehousing and more for OLTP)
ii. Redo log buffer stores the redo entries – a log of changes made to the
database ((less for DataWarehousing and more for OLTP))
iii. Shared pool – contains shared memory constructs such as shared SQL areas.
A shared SQL area is required to process every unique SQL statement
submitted to a database. A shared SQL area contains information such as the
parse tree and execution plan for the corresponding statement. A single
shared SQL area is used by multiple applications that issue the same
statement, leaving more shared memory for other users.
iv. Large Pool – Optional area that provides large memory allocations for Oracle
backup and restore operations, I/O server processes and session memory for
the shared server and Oracle XA
v. Cursors – A handle for the memory associated with a specific statement –
Oracle Call Interface (OCI) refers this a statement handles
vi. Program Global Area (PGA) – Memory buffer that contains data and control
information for a server process. A PGA is created by Oracle when a server
process is started. (less for OLTP and more for DW)
vii. Oracle Process Size: The size of Oracle Process will be normally 40 MB for all
types of databases.
c. A minimum of 51% of physical memory is required to be allocated for SGA. Typical
setting will be 70%.
3. Oracle Processes
a. User Processes
b. Oracle Processes
i. Server Processes – Oracle creates server processes to handle requests from
connected user processes
ii. Background Processes – DBWn, LGWR, CKPT, SMON, PMON, ARCn, RECO,
Jnnn, Dnnn, LMS, QMNn
4. What is spfile
a. A repository for initialisation parameters that is maintained on the machine where the
database server executes. A server parameter file is initially built from a traditional text
initialisation parameter file using CREATE SPFILE statement.
5. CREATE DATABASE
a. Creates the datafiles
b. Creates the control files
c. Creates the redo log files and establishes the ARCHIVELOG mode
d. Creates the SYSTEM tablespace and the SYSTEM rollback segment
e. Creates the data dictionary
f. Sets the character set that stores data in the database
g. Sets the database time zone
h. Mounts and opens the database for use
6. What is data dictionary
a. Each Oracle database has a data dictionary
b. Oracle Data Dictionary is a set of tables and views that are used as a read-only
reference about the database. It stores information about the both the logical and
physical structure of the database. It also stores
i. The valid users of an Oracle Database
ii. Information about integrity constraints defined for tables in the database
iii. The amount of space allocated for a schema object and how much of it is in
use
12. When both pfile & spfile are present what is accessed by oracle to start database
a. At system startup, the default behaviour is to read a spfile to obtain initialisation
parameter settings.
13. How to start database through pfile when both pfile & spfile are present
a. Specify the PFILE clause when issuing the STARTUP command. STARTUP command
with no PFILE clause reads the spfile from an OS specific location
20. Locks
a. Oracle uses locks to control concurrent access to data.
b. Automatic Locking
i. Requires no user action. Implicit locking occurs for SQL statements as
necessary, depending on the action requested
ii. Exclusive lock and share lock
c. Manual Locking
i. A user might want to override default locking. Oracle allows manual override of
automatic locking features at both the row level and the table level
21. Security
a. Oracle server provides discretionary access control – restricting access to information
based on privileges and privileged users can grant other users privileges at their
discretion. Oracle manages database security using several different facilities:
i. Database Users and Schemas
1. Users are identified by Username and password
2. Each user is associated with a default tablespace
ii. Privileges: A privilege is a right to run a particular type of SQL statement.
1. System Privileges allow users to perform a particular systemwide
action or a particular action on a particular type of schema object.
2. Schema Object Privileges allow users to perform a particular action on
a specific schema object.
3. Privileges are granted to users
iii. Roles: Roles are named groups of related privileges that you grant to users
25. Checkpoints
a. At specific times, all modified database buffers in the SGA are written to the datafiles
by DBWn. This event is called a checkpoint. The CKPT process is responsible for
signalling DBWn at checkpoints and updating all the datafiles and control files of the
database to indicate the most recent checkpoint.
b. When a checkpoint occurs, Oracle must update the headers of all datafiles to record
the details of the checkpoint. This is done by CKPT process. The CKPT process does
not write blocks to disk; DBWn always performs the work.
c. Control files record information about checkpoints. Every 3 secs, the CKPT process
records information in the control file about the checkpoint position in the online redo
log.