0% found this document useful (0 votes)
4 views11 pages

23jun21 Arch&Install

The document provides an overview of Oracle database architecture, detailing the components of a database server, including its physical and logical structures. It explains the memory structure and background processes of an instance, as well as the multitenant architecture and installation requirements. Additionally, it covers SQL processing, kernel parameters, and practical commands for managing the database system.

Uploaded by

imsanju1909
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views11 pages

23jun21 Arch&Install

The document provides an overview of Oracle database architecture, detailing the components of a database server, including its physical and logical structures. It explains the memory structure and background processes of an instance, as well as the multitenant architecture and installation requirements. Additionally, it covers SQL processing, kernel parameters, and practical commands for managing the database system.

Uploaded by

imsanju1909
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 11

OS commands:

ls
ll
chown
mkdir
chmod
rm
grep
vi
ps -ef
cd
pwd

Database Server Made up of below two components


1)Database--->Taking space in Disk

2)Instance--->Taking space in RAM

Database again divided into two types


1)Physical Structure(6)
2)Logical Structure (4)

I)Physical Structure contains 6 files


1)Data File (Mandatory)
2)Redolog File(Mandatory)
3)Control File(Mandatory)
4)Parameter File(Mandatory)---->4 Files are mandatory during startup
5)Password File (Optional)
6)Archivelog File(Optional)

II)Logical Structure Divided into 4 types (All are Mandatory)


1)Tablespace
2)Segment
3)Extent
4)Block

Instance :
----------
What is Instance?

Instance is a combination of Memory Structure and Background Processes

I)Memory Structure(10)
II)Background Processes(10+...)

I)Memory Structure Devided into two types


1)SGA:System/Shared/Server Global Area (6 Component)
2)PGA:Program/Private/Process Global Area(4 Areas)

I)SGA Components
1)Shared Pool(Mandatory)-->Dynamic
Divided with two section(Library Cache and Data Dictionary Cache)

-> Library Cache:


The SQL or PL/SQL source statements (SQL, stored procedures, packages)
The parse tree for the SQL statements
The execution plan for each SQL statement

->Data Dict. Cache:


The data dictionary is a collection of database tables and views containing
reference information about the database, its structures, and its users.

2)Database Buffer Cache or DB Cache or Buffer Cache(Mandatory)>Dynamic

3)Redolog Buffer or Log Buffer(Mandatory)-->Static

4)Large Pool(Optional)-->Dynamic--->For RMAN/Parallel Activity Purpose

5)Java Pool(Optional)-->Dynamic-->For Store Jave Component

6)Streams Pool(Optional)-->Dynamic--->For Replication Streams/Golden Purpose

II)PGA Areas :- All are Mandatory


1)Session Information Area
2)Cursor Information Area
3)Sort Area
4)Stackspace--->To Store Bind Variable Values

Background Processes:
---------------------
1)DBWr-->Database Writer
The database writer process (DBW) writes the contents of database buffers to data
files.

2)LGWr-->Log Writer
The log writer process (LGWR) manages the online redo log buffer.

In the following circumstances, LGWR writes all redo entries that have been copied
into the buffer since the last time it wrote:
1. A user commits a transaction.
2. An online redo log switch occurs.
3. Three seconds have passed since LGWR last wrote.
4. The redo log buffer is one-third full or contains 1 MB of buffered data.
5. DBW must write modified buffers to disk.

What is write-ahead protocol??


Before DBW can write a dirty buffer, the database must write to disk the redo
records associated with changes to the buffer (the write-ahead protocol). If DBW
discovers that some redo records have not been written, it signals LGWR to write
the records to disk, and waits for LGWR to complete before writing the data buffers
to disk.

3)SMON-->System Monitor
Performing instance recovery,
4)PMON-->Process Monitor
The process monitor (PMON) detects the termination of other background processes.
If a server or dispatcher process terminates abnormally, then the PMON group is
responsible for performing process recovery.
Process termination can have multiple causes, including operating system kill
commands or ALTER SYSTEM KILL SESSION statements.

5)CKpt-->Checkpoint Process
Checkpoint is an event,It tells to Writing Data From DB Cache To Datafile .

The checkpoint process (CKPT) updates the control file and data file headers with
checkpoint information and signals DBW to write blocks to disk. Checkpoint
information includes the checkpoint position, SCN, and location in online redo log
to begin recovery.

1)When DBA Given: alter system checkpoint; command


2)When DB Cache Full
3)Proper Shutdown

6)RECO-->Recoverer
In a distributed database, the recoverer process (RECO) automatically resolves
failures in distributed transactions.

7)ARCH-->Archiver
An archiver process (ARCn) copies online redo log files to offline storage after a
redo log switch occurs.

• Manageability Monitor Processes (MMON and MMNL)


(MMON) performs many tasks related to the Automatic Workload Repository (AWR).
MMON writes when a metric violates its threshold value, taking snapshots, and
capturing statistics value for recently modified SQL objects.

manageability monitor lite process (MMNL) writes statistics from the Active Session
History (ASH) buffer in the SGA to disk. MMNL writes to disk when the ASH buffer is
full.

• Process Manager (PMAN)

Process Manager (PMAN) oversees several background processes including shared


servers, pooled servers, and job queue processes.

PMAN monitors, spawns, and stops the following types of processes:

Dispatcher and shared server processes


Connection broker and pooled server processes for database resident connection
pools
Job queue processes
Restartable backg
round processes

• Listener Registration Process (LREG)


The listener registration process (LREG) registers information about the database
instance and dispatcher processes with the Oracle Net Listener.

10)MMAN-->Memory Manager
This process performs the resizing of memory components on the instance.

11)CTWr-->Change Tracking Writer


Tracks changed data blocks as part of the Recovery Manager block change tracking
feature

12)RVWr-->Recovery Writer
Writes flashback data to the flashback logs in the fast recovery area

13)CJQnn-->Job Queue Co-ordinator


Selects jobs that need to be run from the data dictionary and spawns job queue
slave processes (Jnnn) to run the jobs

14)J000-->Job Queue Process


Executes jobs assigned by the job coordinator

.....many

=> Program Global Area


The Program Global Area (PGA) is a private memory region that contains the data and
control information for a server process. Only a server process can access the PGA.
Oracle Database reads and writes information in the PGA on behalf of the server
process. An example of such information is the run-time area of a cursor. Each time
a cursor is executed, a new run-time area is created for that cursor in the PGA
memory region of the server process executing that cursor.

- A private SQL area


A private SQL area holds information about a parsed SQL statement and other
session-specific information for processing.

- Work Area
A work area is a private allocation of PGA memory used for memory-intensive
operations.

For example, a sort operator uses the sort area to sort a set of rows. Similarly, a
hash
join operator uses a hash area to build a hash table from its left input, whereas a
bitmap merge uses the bitmap merge area to merge data retrieved from scans of
multiple bitmap indexes.

SQL Processing:
1)Parse--->Shared Pool
2)Bind--->Stackspace--->PGA
3)Execute--->DBCache/DF
4)Fetch--->PGA/DBCache/DF

Parse:
1)Syntax Check
2)Semantic Check------>Dictionary Cache -> whether the objects and columns in the
statement exist.
Privilege/Object Existance/Column/Datatype,Contraints/Triggers...Checking is called
Semantic Check for the given above statement
3)Shared Pool check--->Library Cache

When a SQL statement is executed, the database attempts to reuse previously


executed code. If a parsed representation of a SQL statement exists in the library
cache and can be shared, then the database reuses the code, known as a soft parse
or a library cache hit. Otherwise, the database must build a new executable version
of the application code, known as a hard parse or a library cache miss.

Parse
1)Soft Parse
2)Hard Parse

Soft Parse--->Reusing Existing Execution plan called Soft Parse


Hard Parse--->Building New Execution plan called Hard Parse(Time consumer)-->Here
Its checks Statistics in Data Dictionary

What is Library Cahe contains?


SQL,PL/SQL, Execution Plan

select * from dept;--->>ASCII Value-->Converted into Hash Value by Oracle,SQL


ID,Child Number,SQL Statement store in LC

alter system flush buffer_cache;

alter system flush shared_pool;

=> SGA:
What is Write List?
The Write List contains data that has changed since it was received in memory but
has not been written to the disk.

LRU(Least Recently Used) List:


Free buffers, pinned buffers, and dirty buffers that have not been transferred to
the write list are kept in the LRU List.

Free Buffer is a ready-to-use buffer.

A pinned buffer is a buffer that is accessed by some processes at that time.

===================================================================================
========================
===>Multitenant architecture:

=Benifits of MLT Arch

-DB consolidation -> consolidating data from multiple databases into one database
on one computer
-Cost Resuction -> By consolidating hardware and database infrastructure to a
single set of background processes, and efficiently sharing computational and
memory resources,
-Reapid movement of data and code -> you can plug a PDB into a CDB, unplug the PDB
from the CDB, and then plug this PDB into a different CDB.
-Easy management and monitoring -> Single DB to monitor
-Ease of PTe -> It is easier to collect performance metrics for a single database
than for multiple databases.
-Fewer DB to patch & upgrade -> Single DB to patch.

= Diff bet root container and PDB

-“Multitenant” Database Instance:


This is a term used to distinguish between a database instance that supports
multitenant database and one that does not.
Container Database (CDB): This is the database that is created when that database
supports Oracle’s multitenant option. It’s also called the ROOT container and is
the CDB$ROOT within the data dictionary views of the CDB.

-Root Container Database: This is created automatically when you create a


multitenant database. The root container contains the data dictionary for the CDB.
Pluggable Database (PDB): These are the databases that are stored within the CDB. A
PDB is a portable collection of schemas, schema objects, and nonschema objects that
appears to an Oracle Net client as a non-CDB.

-Note: A Container Database (CDB) comprises zero, one, or many customer-created


pluggable databases. All Oracle databases before Oracle Database 12c were non-CDBs.

-Oracle Multitenant offers the ability to have up to 252 PDBs per multitenant
container database. The multitenant architecture with one user-created pluggable
database (single tenant) is available in all editions without the multitenant
option.

=Structure of root:

The Root
The root container, also called the root, is a collection of schemas, schema
objects, and nonschema objects to which all PDBs belong. Every CDB has one and only
one root container, named CDB$ROOT, which stores the system metadata required to
manage PDBs. All PDBs belong to the root.

The root does not store user data. Thus, you must not add user data to the root or
modify system-supplied schemas in the root.

= Structure of PDBs
PDBs
A PDB is a user-created set of schemas, objects, and related structures that
appears logically to an application as a separate database. Every PDB is owned by
SYS, which is a common user in the CDB (see "Common Users in a CDB"), regardless of
which user created the PDB.

=Views:
- CDB_ -All of the objects in CDB across al PDBs
- DBA_ -All of the objects in the container or PDB
- ALL_ bjects accessible by the current user
- User_ objects owned by the current user

dba_tables
all_tables
user_tables

===================================================================================
========================

====>>> Installation:

Space requirement:

- min 7.5 gb of space Oracle binaries


-1 GB of space in the /tmp directory on your Linux system.
-Set the TMP and TMPDIR environment variables when setting the oracle user's
environment.

- Swap space:
cat /proc/swaps
grep Swap /proc/meminfo

Between 1 GB and 2 GB----------1.5 times the size of the RAM

Between 2 GB and 16 GB----------Equal to the size of the RAM

More than 16 GB-------------------16 GB

-------------------------------------------------------------
/etc/sysctl.conf

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576

Run the following command to change the current kernel parameters.

/sbin/sysctl -p

net.ipv4.ip_local_port_range = 9000 65500


-------------------------------------------------------------

Add the following lines to the "/etc/security/limits.conf" file.

oracle soft nofile 1024


oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768

Install the following packages if they are not already present.

rpm -ivh
rpm -Uvh
rpm -qa

# From Public Yum or ULN


yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

----------------------------------------------------------------------

Create the directories in which the Oracle software will be installed.

mkdir -p /u01/app/oracle/product/12.2.0/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01

4 -> R
1 - E
2 -> w
----------------------------------------------------------------------

"/home/oracle/.bash_profile" ---- bash profile

# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ol6-121.localdomain
export ORACLE_UNQNAME=cdb1

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1
export ORACLE_SID=cdb1

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

***********************************************************************************
*********************************************************************

====>>>>>>> Practical:

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
3537685

SQL>
SQL>
SQL>
SQL>
SQL>
SQL> /
CURRENT_SCN
-----------
3537690

SQL> /

CURRENT_SCN
-----------
3537692

SQL> /

CURRENT_SCN
-----------
3537694

SQL> /

CURRENT_SCN
-----------
3537695

SQL> /

CURRENT_SCN
-----------
3537700

SQL> alter system checkpoint;

System altered.

SQL>

SQL>
SQL>
SQL> alter system flush buffer_cache;

System altered.

SQL> alter system flush shared_pool;

System altered.

SQL>
SQL>

[oracle@testdb ~]$ ps -ef | grep pmon


grid 7249 1 0 Jun19 ? 00:02:16 asm_pmon_+ASM1
grid 10428 1 0 Jun19 ? 00:02:28 apx_pmon_+APX1
oracle 25330 1 0 Jul07 ? 00:00:37 ora_pmon_coe
oracle 73956 73648 0 13:59 pts/0 00:00:00 grep --color=auto pmon
[oracle@testdb ~]$
[oracle@testdb ~]$

QL>
SQL> show parameter db_n

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
db_name string coe
SQL>
SQL>
SQL> show parameter db_u

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
db_ultra_safe string OFF
db_unique_name string COE
db_unrecoverable_scn_tracking boolean TRUE
SQL>

You might also like