23jun21 Arch&Install
23jun21 Arch&Install
ls
ll
chown
mkdir
chmod
rm
grep
vi
ps -ef
cd
pwd
Instance :
----------
What is Instance?
I)Memory Structure(10)
II)Background Processes(10+...)
I)SGA Components
1)Shared Pool(Mandatory)-->Dynamic
Divided with two section(Library Cache and Data Dictionary Cache)
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.
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.
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 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.
10)MMAN-->Memory Manager
This process performs the resizing of memory components on the instance.
12)RVWr-->Recovery Writer
Writes flashback data to the flashback logs in the fast recovery area
.....many
- 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
Parse
1)Soft Parse
2)Hard Parse
=> 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.
===================================================================================
========================
===>Multitenant architecture:
-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.
-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:
- Swap space:
cat /proc/swaps
grep Swap /proc/meminfo
-------------------------------------------------------------
/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
/sbin/sysctl -p
rpm -ivh
rpm -Uvh
rpm -qa
----------------------------------------------------------------------
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
----------------------------------------------------------------------
# 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:
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
System altered.
SQL>
SQL>
SQL>
SQL> alter system flush buffer_cache;
System altered.
System altered.
SQL>
SQL>
QL>
SQL> show parameter db_n