Professional Documents
Culture Documents
Terminology
database:
An Oracle database is a collection of data, logically treated as a unit. The
data is physically stored in one or several files. Oracle manages data in
logical units called tablespaces. A database object, such as a table, is always
created in a particular tablespace. A tablespace consists of one or more files.
Data store block wise each block size by default 8k.
Oracle instance:
The combination of Oracle (background) processes and memory
buffers is called an Oracle instance. Every running Oracle database is linked
to an Oracle instance. Moreover, every Oracle database needs its own
instance.
SGA
Every time an Oracle instance is started, a shared memory region called
the System Global Area (SGA) is allocated. The SGA allocated by an
Oracle instance can only be accessed by the processes of this instance. This
means that each instance has its own SGA When the instance is stopped,
the SGA is deallocated.
processes
Every time an Oracle instance is started, Oracle background processes are
started. When an instance shuts down, the processes are stopped
Database architecture
Oracle Instance and Database: Architecture Overview
After an Oracle instance is started, a special process, the Listener allows the
database clients and the instance to communicate with each other.
Note: The listener process is not part of an Oracle instance; it is part of
networking processes that work with Oracle.
In SAP installations, dedicated servers are used. When a work process makes
a request to connect to the database, the listener creates a dedicated server
process and establishes an appropriate connection.
• The separate server process created on behalf of each work process
(generally, for each user process) is called a shadow process.
• To handle database requests from several SAP system users, a work
process communicates with its corresponding shadow process.
• When a work process has lost its connection to the database system, it
automatically reconnects after the database server is available again and a
database request is to be processed.
Oracle background processes perform various tasks required for the
database to function properly.
Initialization parameters:-
Each database has its own parameter file.The instance for oracle database
is started using an initialization parameter file.Parameters contained in this
file
Examples of instance paramters:-
Db_cache_size -- specifies the size of the buffer pool.
Log_buffer – specifies the amount of memory that oracle uses when
buffering redo entries.
Log_Archives_start= True. Specifies that the archive is started automatically.
CONTROL_FILES Specifies one or more names of control files.
Staring order :-
1. Spfile.ora
2. Init<sid>.ora or pfile or initialization file.
CONTROL FILE : -
Every oracle database has a control file, which is a small binary files
necessary for the database to start and operate successfully.control file
contains entries that specify the physical structure and state of the
database.such as table space information,names and location of data files
and redolog files or the current log sequence number.If physical structure
of database changes(for example when creating new data files or redolog
files).The control file is automatically updated by oracle.control files can
be changed only by oracle no database administrator or any other user
can edit the control files directly.after opening the database the control
file must be available for writing. If for some reasons the control file is
not accessable the databse can’t function properly.
Oracle control files can be mirrored for security
reasons several copies can be stored at different locations.oracle updates
these files at the same time.In SAP Installation the control file is stored
in 3 copies at different locations which is specified in init <sid >.ora file.
Which must be created on three physically separated disks.
Database files : --
it contains tables/index/data each database file is madeup of
oracle blocks. The very first block contains SCN(system change
number)number.each database file represent a particular oracle
table space.As the blocks are getting modified in the database file
then scn number gets incremented.
Database writer is the background
process which takes modified data(dirty buffers) from database
buffer cache(part of sga) and writes them to database files in the
hard disk.
REDOLOG FILES :--
These files contain latest changes made by user, any modification
(create, insert,update,alter,drop) are initially written to redolog
file,although they are actually meant for database files.
Log writer (LGWR) is the background process
which writes from redolog buffer to redolog files.
Background process: -
Database writer : --
Database writer takes dirty blocks (modified
blocks from SGA)(DB block buffer)and writes them into
database files on the following occations.
When check point occurs
Dirty buffers reached threshold value
No free buffers
When timeout takes place
When log switch is takes place
When database shut down
LOG WRITER : --
Log writer will invoke more often than db writer.As log files are
very small when compare to the database files, for every small
update oracle does not open huge data files which are in Giga
Bytes instant it writes first to log files.
The content of the Redolog files are file ID, block ID, new
content
Log writer writes from redolog buffers to redolog files
Log writes data from redolog buffer to redolog files in the
following occations.
o At commit
o When one-third full
o When there is 1 mb redo
o Every 3 seconds
o Before DB writer writes
ARCHIVING : --
As the online redolog is limited in size and can’t grow
automatically, oracle must overwrite old redolog to write new
ones.
However in a situation where you must restore data files
after a disk crash and recover them manually (usually to the
state the data had at the point of crash).You need a both db
backup and all the redolog information after this backup.Log
switch occur every few minutes so that online redolog files are
reused frequently ,to prevent loss og redolog information , it
must be copied from online redolog files to a safe location before
overwriting.This is the task of a special oracle background process
called archiver (ARCH).
Archiving must be explicitly activated on the ARCHIVE LOG
mode of the database and settings. The oracle instance
parameter LOG_ARCHIVE_START to TRUE.
SMON (SYSTEM MONITOR)
If database is crashed and next time when restart the database,
if oracle observe that the database was not properly shutdown
last time now it invokes SMON which perform crash recovery.
While performing the crash recovery if it finds the transaction
which committed but not found in the database file will now
applied from the redo log files.
Cleanup temporary segments that are no longer in use.
PMON : --
If client has opened a transaction and client machine got
rebooted then PMON Comes into the picture which treats open
transaction as indoubt tranasaction which now be roll back.
If old sesson was locked any resource now will be unlocked by
pmon
Pmon monitors the shadow processes
CKPT(check point) :--the checkpoint is the point at which the
database writer(DBW0) writes all changed buffer in the buffer
cache to the data files.The database writer receives a signal at
specific times from the background check point process (CKPT) to
perform this action.
It also writes chechpoint information to the database header
It writes information about the checkpoint position in the online
redolog into the control file.
Check point always occurs at log switch
Oracle System Privileges
When a work process starts and tries to connect to the Oracle database, the
following happens:
1. The work process logs into the database as its corresponding OPS$ user
with operating system authentication.
2. The work process sets a SELECT statement in the SAPUSER table and
reads
the password of SAP<SCHEMA-ID>.
3. The work process disconnects from Oracle.
4. The work process now connects with username SAP<SCHEMA-ID> and
the password retrieved from the table SAPUSER.
If any of the steps cannot be processed successfully, the connection cannot
be established and the work process stops with an error
Oracle Listener
For OracleNet to accept connections on the database server, the listener
must be running. The Oracle utility lsnrctl is used to start and stop the
listener and to check
the status of OracleNet connections. When listener is started:
• In a UNIX environment, the process tnslsnr is started.
• In a Windows environment, the service
Oracle<DBSID><Release>TNSListener is started.
If several Oracle instances are installed on one host, there is usually just one
listener process running on the host, serving all active Oracle instances.
The Oracle listener is controlled by the command line tool LSNRCTL
2. List the users registered in the database and show the content of the
table
SAPUSER.
a) Use the following select statement to show the content of table
DBA_USERS when connected as OPS$-user:
SQL> connect /
Connected.
SQL> select username from dba_users;
USERNAME
------------------------------
SYSTEM
SYS
ORACLE_OCM
WMSYS
OPS$TWDF1825\T99ADM
DBSNMP
DIP
OUTLN
OPS$TWDF1825\SAPSERVICET99
SAPT99
APPQOSSYS
When starting the database, you select the state in which it starts. The
following scenarios
– spfile.ora
– initSID.ora
The database must be named with the DB_NAME parameter either in the
initialization file or in the STARTUP command.
For example, the database must be mounted but not open during the
following tasks:
• Locating and opening the control files specified in the parameter file
• Reading the control files to obtain the names and status of the datafiles
and redo log files. (However, no checks are performed to verify the existence
of the data files and online redo log files at this time.)
Starting Up a Database
If any of the data files or online redo log files are not present when you
attempt to open the database, the Oracle server returns an error.
During this final stage, the Oracle server verifies that all the data files and
online redo log
files can be opened and checks the consistency of the database. If necessary,
the System Monitor background process (SMON) initiates instance recovery
[OPEN [RECOVER][database]
|MOUNT
|NOMOUNT]
Shut down the database to make operating system offline backups of all
physical structures and to have modified static initialization parameters
take effect.
Shutdown Options
Shutdown Normal
• The Oracle server waits for all users to disconnect before completing the
shutdown.
• Oracle closes and dismounts the database before shutting down the
instance.
Shutdown Transactional
Shutdown Immediate
• The Oracle server does not wait for users currently connected to the
database to disconnect.
• Oracle rolls back active transactions and disconnects all connected users.
• Oracle closes and dismounts the database before shutting down the
instance.
Shutdown Options
Shutdown Abort
If the normal and immediate shutdown options do not work, you can abort
the current database instance. Aborting an instance proceeds with the
following conditions:
• Current SQL statements being processed by the Oracle server are
immediately terminated.
• Oracle does not wait for users currently connected to the database to
disconnect.
DBA Cockpit
The DBA Cockpit offers a navigation area, which is visible in all functions of
the
DBA Cockpit. This area contains a menu tree with the following access
points:
• Performance (corresponds to the old transaction ST04)
• Space (corresponds to the old transaction DB02)
• Jobs (corresponds to the old transactions DB13, DB12, DB14, DB13C)
• Diagnosis
The individual functions of the DBA Cockpit occur under these four access
points, which can each be called by double-clicking them
Backup, Restore & Recovery
Importance of Backups
If data is lost due to external factors, such as water damage to your
hardware, or physical errors, such as hardware failure, you must recover
the database up to the point in time when the database crashed. If this
complete recovery is possible, only the data of transactions uncommitted at
the time of error will be lost. If data is lost due to logical errors, such as
unintentionally deleting a table, you may have to recover the database up
to a point in time shortly before the error occurred.
Your backup strategy must be designed according to your company’s needs.
To ensure the availability of your SAP system, your backup strategy must be
carefully tested before your SAP system goes live, and again after any
changes to your backup strategy.
When planning your backup strategy, take into account the maximum
downtime for each of the above recovery scenarios.
To ensure that the correct steps are performed for each of the scenarios,
create a document containing organizational descriptions of procedures and
an escalation plan. This document must be understood by the person who
performs database restore and recovery.
You should evaluate and implement the most suitable backup type and
method for
your company. SAP provides tools that support different types of backups,
such as online backups, incremental backups with RMAN, or split-mirror
backups
Backup cycle
A backup cycle is a time period during which you keep the backups on your
tapes.
The length of the backup cycle is the retention period for your tapes; a tape
is reused only if the backup on it is older than the retention period
SAP recommends a backup cycle of four weeks. The backup cycle must be
the same for database backups and offline redo log backups:
• Perform a complete online backup each work day.
• Perform a complete offline backup at least once in the cycle.
• Back up the offline redo log files on each work day, as well as after every
online and offline backup. Ensure that you back up every offline redo log file
twice, on separate tapes, before the file is deleted in the archive directory.
• To verify a backup, carry out a logical check of the database before or
after the backup, and check the backup for physical errors. You must
perform backup verification at least once in the backup cycle. However, it is
recommended to do it once a week.
• Remove the last verified full offline backup of each cycle from the tape
pool, and keep this backup in long-term storage. The removed tapes must
be replaced with new ones.
The relation between the backup cycle length and frequency of complete
database
backups should be such that you always have several generations of complete
backups. This protects you from data loss even in a situation where your
last database backup cannot be found or is unusable.
Backup Types
Offline Backup
The database is shut down before the backup. Database files are therefore
copied to the backup media in a closed state. If the database has been shut
down consistently (standard when using SAP tools), data is backed up in a
consistent state, and can be restored and opened even without redo log
files.
Online Backup
The database remains open during the backup, and activities can take place
(data can be modified) during this time. Obviously, data blocks copied to the
backup medium at the beginning of the backup procedure may correspond
to an older system change number than those backed up at the end. To
restore a consistent database from such a backup, you need at least the
redo information written during the time of the backup procedure. With
this information all blocks in the restored database can be recovered to a
state corresponding to the time of the end of the backup
Perform a Complete Backup
All data in the database are backed up. If you perform a full backup, after
backing up all data in the database, an additional piece of information (the
catalog information) is written to the control file by the Recovery Manager.
This makes it possible to subsequently create incremental backups. A whole
backup creates a backup of all data without the catalog information. In
terms of the database data, there is no difference between the whole
backup and full backup
Incremental Backup
If you have created a full backup, you can later back up just those data
blocks that have changed since the time of the full backup. This will reduce
the amount of data to be backed up; it does not significantly shorten the
backup time, because to check if a database block was changed and so must
be backed up, the block must be read.
• An incremental backup can only be based on a previous full backup.
Partial Backup
If a complete backup takes too long, you may choose to back up the
database
in smaller parts. The sum of individual partial backups must, of course,
cover the entire database, for example, during one week