Friday, July 15, 2016

Oracle Database Summary 

Description ::

Table -> Tablespace -> gets mapped to something physical(data and index on storage) 

Storage
Memory
Process

Data files -> Data for tables, Indexes, Row back segments, special file that has temporary data in it. Whenever oracle does a sort for PGA(Memory), it saves in temp file. 65535 data files on max, Views- DBA_DATA_FILES has information about data files which is physical, and shows how these data files mapped to tablespaces(logical), V$DB_FILE, V$DATAFILE

Control files -> Contains the structure of database.(atleast two control files on any database)- from 10g 3 control files on different disk drives- DB NAMe, when database created, path, Check point information for each of the data files.V$CONTROL FILE tells you the path of control file
Redo logs ->
Archive logs -> 

Online Redo logs -> stores 3 major pieces of information.   (used for recovery)
1) DML - Insert, Update, Delete
2) DDL - create, alter, commits record there

When the group(n1,n2) gets filled, there is a check point which performs log switch that runs in other group(g2) and likewise in 3rd group. If even 3rd group gets fill, goes for 1st again
Archived Redo logs -> When the 3rd group redo logs get filled, it again moves into the first group redo logs and overrides it.. The first group redo logs will be sent to archived redo logs. 

No archive log mode -> Generally when you create a new database, we create it in No archive log mode. which means when group3 fills it comes back and overrides group1.
In archive log mode that will never happen, after filling group3 it wont switch to group1 and overrides until the group1 is archived. 
If it is not getting archived, the archive directory is full, then the database will hang.

Oracle Database -> An Oracle database is defined as 3 types of files. datafiles, control files, redo logs.
In 6,7,8,8i there is no spfile instead we have init.ora file(ASCII file) which OS able to make changes
In 9i we have spfile(binary file) and we change it using alter system command- (db_cache-size, db_block_size, shared_pool_size)
Orapwd is the utility that make changes to the password file(pfile) which customers would have..

2) Memory - Refers to SGA(Shared/System Global Area)
Database buffer cache/pool - Each square referred to as oracle datablock. There are 4 major parts in the database buffer pool. Each block is 8k. It uses the algorithm called LRU.(for quicker access).Flush the database buffer when required.

shared pool - we use this to reduce parsing. We can Flush the shared pool when required
            Library cache (SQL/PLSQL) ,
                          compiled version of SQL/PLSQL also called as metacode.
                          Execution plan how the oracle optimizer retrieve the rows.. V$SQLAREA, V$SQL
            Dictionary Cache - contains names of the object that touched recently (Queries against employees table, table, column name, priveleges,all access info will be stored. LRU applies to this as well.

shared_pool_size( controls the size of shared pool)
RMAN - will be configured in the large pool to backup, recover and restore oracle database.
OSS - Oracle Shared server

DB writer-  writes the data  buffer cache information into the corresponding datafiles. As the people writes into the memory, the DB writes moves the before ones into disk to make room/space.

log writer - writes Redo logs from memory to Online redo logs(in disk).

smon(system monitor) -  It talks with all the processes constantly, whenever there is an instance crash, it does the instance recovery.It also cleans up source

pmon - monitors the processes. pmon detects deadlock, cleansup after booting process
check point - only upto 7. because of the LRU algorithm, blocks keep getting updated and they could stay in memory forever. we have mechanism that forces the updated commited blocks into the data files. There is a parameter in sp file for this. We have command for it.
Oracle Instance - is comprised of SGA and background processes.
Oracle server - Instance associated with Database.

No comments:

Post a Comment