Sunday, April 10, 2016

ORACLE - fundamentals of Relational model and Oracle RDBMS

Oracle officially Oracle is called an Object-relational database.
RDBMS - Relational Database Management System

Oracle v1 - 1978 and never released
Oracle 8i - 1999 i stands for Internet (possibility to query DB online)
Oracle 10g - 2000 g stands for Grid Computing
Oracle 12c - 2014 c stands for Cloud

Grid infrastructure refErs to deploying of a Massively Parallel infrastructure with storage fabric for building a shared storage that consist from pluggable hard drives (HDs) that can be extended by adding more HDs.

Automatic Storage Management (ASM) is Oracle software feature for Grid infrastructure.
Real Application Cluster (RAC) is an Oracle technology

In Oracle Grid infrastructure you can cluster your application servers, storage (ASM) and database (RAC) - and end-to-end high availability solution.

======== TWO MEMORY STRUCTURES IN ORACLE DB ==========================

SGA - System Global Area (main collection of shared data caches, for Instances - shareable memory)
PGA - Process Global Area (for each session of user, keeps its preferences, logs, SQL queries etc)

=========== ORACLE INSTANCE DOCS =================================

http://docs.oracle.com/database/121/CNCPT/startup.htm#CNCPT005

=========== PL/SQL anti-pattern - use of DML inside LOOP ==========
Never manipulate tables data (by DML) from inside PROCEDURE LOOPS.
Data Manipulation Language (DML) is a vocabulary used to retrieve and work with data in SQL Server 2016. Use these statements to add, modify, query, or remove data from a SQL Server database.https://apexapps.oracle.com/pls/apex/f?p=44785:141:0::NO::P141_PAGE_ID,P141_SECTION_ID:168,1208


==================== ADVANTAGES OF ORACLE =======================
There are numerous features, that are quite unique. If I had to pick the ones that I consider killer, these would be:
  • ASM (Automatic Storage Management) makes the storage management so much easier and smoother.
  • RAC (Real Application Clusters) - this is something you will not find anywhere else and was the reason we went Oracle in the first place. Sure, there are replication or some sort of clustering solutions for other databases, but nothing comes close to RAC.
  • Realiability - this is a good thing in a database :) Oracle just won't eat your data. I have seen MySQL databases corrupted beyond repair, I have seen MSSQL database fall to pieces. I have yet to see Oracle do something, that is not easily recoverable (with the right backup and HA strategy of course).
  • Management - the Enterprise manager is awesome tool
  • Monitoring and diagnostics - Oracle measures and reports everything and I mean everything. It is not always simple to extract, but all the information you need to tune or debug the database or applications using the database is available.


Theory:
First description of Relational model in 1970 by EF "Ted" Codd: http://is.gd/eBKRHY
or http://bio.informatics.iupui.edu/beyond/misc/codd%20relational%20model%201970.pdf

Columns of the table could be called Domains
Rows of the table can be called Tuples
Table can be called Relation (that has n-tuples in it)

Active Domain of instant - the set of values represented at that instant.

Primary key - one domain of a given relation has values which uniquely identify each element (n-tuple) of that relation.
Primary key is nonredundant if it uniquely identify each element.
Relation can have more than one nonredundant primary keys, but only one of them should be selected and called THE primary key of this relation.

Foreign Key - domain of relation R is a Foreign Key if it is not the primary key of R but its elements are values of the primary key of some relation S.

Simple domains - domains whose elements are atomic (nondecomposable) values.
Normalization - is elimination of nonsimple domains.

Model - the relational view of data
Theory of Relations: https://en.wikipedia.org/wiki/Finitary_relation
Mathematically, then, a relation is simply an "ordered set". (k-ary, e.g ternary = 3-ary)
When two objects, qualities, classes, or attributes, viewed together by the mind, are seen under some connexion, that connexion is called a relation.
— Augustus De Morgan
Newton's law of universal gravitation: https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation
Einstein's General relativity:
https://en.wikipedia.org/wiki/General_relativity

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