presentation of oracle database products

66
SQL vs NoSQL Databases Algiers Tech Meetup #11

Upload: algiers-tech-meetup

Post on 14-Apr-2017

107 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Presentation of Oracle database products

SQL vs NoSQL Databases

Algiers Tech Meetup #11

Page 2: Presentation of Oracle database products

<Insert Picture Here>

Presentation of Oracle database products for Beginners

AGUEDAL YazidSenior Database administration consultantIT Synergy General [email protected]

Page 3: Presentation of Oracle database products

Agenda

• History and evolution of Oracle Database products

• Fundamental concepts of Oracle Database

• Some Advanced features

• The Cloud and Oracle 12c

• Q&A

Page 4: Presentation of Oracle database products

The History of Oracle

• Founded in August 1977 by Larry Ellison, Bob Miner, Ed Oates and Bruce Scott, Oracle was initially named after "Project Oracle" a project for one of their clients, the C.I.A, and the company that developed Oracle was dubbed "Systems Development Labs", or SDL.   Although they may not have realized it at the time, these four men would change the history of database management forever.

• In 1978 SDL was renamed Relational Software Inc (RSI) to market their new database. 

Page 5: Presentation of Oracle database products

• 1977: Larry Ellison and friends founded Software Development Laboratories (SDL).

• 1978: Oracle Version 1, written in assembly language, runs on PDP-11 under RSX, in 128K of memory. Implementation separates Oracle code and user code. Oracle V1 is never officially released.

• 1979: SDL changed its company-name to "Relational Software, Inc." (RSI) and introduced its product Oracle V2 as an early relational database system - often cited[ as the first commercially sold RDBMS.The version did not support transactions, but implemented the basic SQL functionality of queries and joins. (RSI never released a version 1 - instead calling the first version version 2 as a marketing gimmick.)

Page 6: Presentation of Oracle database products

• 1982: RSI in its turn changed its name, becoming known as "Oracle Corporation",[ to align itself more closely with its flagship product.

• 1983: The company released Oracle version 3, which it had re-written using the C programming language, and which supported COMMIT and ROLLBACK functionality for transactions. Version 3 extended platform support from the existing Digital VAX/VMS systems to include Unix environments.

• 1984: Oracle Corporation released Oracle version 4, which supported read-consistency. In October it also released the first Oracle for the IBM PC.

• 1985: Oracle Corporation released Oracle version 5, which supported the client–server model—a sign of networks becoming more widely available in the mid-1980s.

Page 7: Presentation of Oracle database products

• 1986: Oracle version 5.1 started supporting distributed queries.• 1988: Oracle RDBMS version 6 came out with support for 

PL/SQL embedded within Oracle Forms v3 (version 6 could not store PL/SQL in the database proper), row-levellocking and hot backups.

• 1989: Oracle Corporation entered the application-products market and developed its ERP product, (later to become part of the Oracle E-Business Suite), based on the Oracle relational database.

• 1990: the release of Oracle Applications release 8

Page 8: Presentation of Oracle database products

• 1992: Oracle version 7 appeared with support for referential integrity, stored procedures and triggers.

• 1997: Oracle Corporation released version 8, which supported object-oriented development and multimedia applications.

• 1999: The release of Oracle8i aimed to provide a database inter-operating better with the Internet (the i in the name stands for "Internet"). The Oracle8i database incorporated a native Java virtual machine (Oracle JVM, also known as "Aurora").

• 2000: Oracle E-Business Suite 11i pioneers integrated enterprise application software

Page 9: Presentation of Oracle database products

• 2001: Oracle9i went into release with 400 new features, including the ability to read and write XML documents. 9i also provided an option for Oracle RAC, or "Real Application Clusters", a computer-cluster database, as a replacement for the Oracle Parallel Server (OPS) option.

• 2002: the release of Oracle 9i Database Release 2 (9.2.0)• 2003: Oracle Corporation released Oracle Database 10g, which

supported regular expressions. (The g stands for "grid"; emphasizing a marketing thrust of presenting 10g as "grid computing ready".)

• 2005: Oracle Database 10.2.0.1—also known as Oracle Database 10g Release 2 (10gR2)—appeared.

Page 10: Presentation of Oracle database products

• 2006: Oracle Corporation announces Unbreakable Linux and acquires i-flex

• 2007: Oracle Database 10g release 2 sets a new world record TPC-H 3000 GB benchmark result

• 2007: Oracle Corporation released Oracle Database 11g for Linux and for Microsoft Windows.

• 2008: Oracle Corporation acquires BEA Systems.• 2010: Oracle Corporation acquires Sun Microsystems.

Page 11: Presentation of Oracle database products

• 2011: Oracle Corporation acquires web content management system FatWire Software.

• 2011: On 18 October, Oracle Corporation acquires Endeca Technologies Inc. faceted search engine software vendor.

• 2013: Oracle Corporation released Oracle Database 12c

for Linux, Solaris and Windows. (The c stands for "cloud")• 2016: Oracle Corporation released Oracle Database 12

c Release 2

Page 12: Presentation of Oracle database products

DatabaseData files

Online redo log files

Control files

Oracle Database Architecture: Overview

Databasebuffercache

Shared pool

Data dictionarycache

Librarycache

PMONSMON Others

Serverprocess

PGA

Archived log filesUser

process

Instance

RECO

ARCn

SGA

DBWn

Redo logbuffer

LGWRCKPT

Page 13: Presentation of Oracle database products

Database

Oracle Database Server Structures

PMONSMON Others

Data filesOnline redo

log filesControl

files

Instance

RECOARCn DBWn LGWRCKPT

Storage structures

Userprocess

Serverprocess

Memory structures

Processes

Databasebuffercache

Shared pool

Data dictionarycache

Librarycache

SGA

Redo logbuffer

Page 14: Presentation of Oracle database products

Oracle Database Memory Structures

DB structures Memory - Process - Storage

SGA

Database buffercache

Redo log buffer

Java pool

Streams pool

Shared pool

Large pool

PGA PGA PGA Backgroundprocess

Serverprocess 1

Serverprocess 2

Shared SQL area

Library cache

Data dictionary cache

Other

I/O buffer

Response queue

Request queue

Free memory

Page 15: Presentation of Oracle database products

Process Architecture

• User process• Is started when a database user or a batch process

connects to Oracle Database• Database processes

• Server process: Connects to the Oracle instance and is started when a user establishes a session

• Background processes: Are started when an Oracle instance is started

DB structures - Memory Process - Storage

PMONSMON Others

Instance

RECOARCn DBWn LGWRCKPT

PGA

Userprocess

Serverprocess Background processes

Databasebuffercache

Shared pool

Data dictionarycache

Librarycache

SGA

Redo logbuffer

Page 16: Presentation of Oracle database products

Database Storage Architecture

Online redo log files

Password file

Parameter file Archived redo log files

Control files Data files

Alert log and trace files

Backup files

DB structures - Memory - Process Storage

Page 17: Presentation of Oracle database products

D E M O

Page 18: Presentation of Oracle database products
Page 19: Presentation of Oracle database products

Utiliser le langage SQL pour interrogerune base de données

• Le langage SQL (Structured Query Language) est : • le langage normalisé par l'ANSI pour la gestion

des bases de données relationnelles • efficace, facile à apprendre et simple d'utilisation • complet sur le plan fonctionnel (il permet de définir, d'extraire et

de manipuler des données dans les tables)

SELECT department_name FROM departments;

Serveur Oracle

Page 20: Presentation of Oracle database products

Instructions SQL • • SELECT • INSERT • UPDATE • DELETE • MERGE •

• • CREATE • ALTER • DROP • RENAME • TRUNCATE • COMMENT • • GRANT • REVOKE • • • COMMIT • ROLLBACK • SAVEPOINT • •

Langage de manipulation de données (LMD)

Langage de définition de données (LDD)

Contrôle des transactions

Langage de contrôle de données (LCD)

Page 21: Presentation of Oracle database products

Environnements de développementpour le langage SQL

• Dans le cadre de ce cours : • Utilisez en priorité Oracle SQL Developer version 1.2 • Utilisez SQL*Plus :

• si vous n'avez pas accès à Oracle SQL Developer • ou si une commande ne fonctionne pas dans Oracle SQL

Developer

SQL Developer SQL *Plus

Page 22: Presentation of Oracle database products

Oracle SQL Developer : Présentation • Oracle SQL Developer est un outil graphique améliorant

la productivité et simplifiant les tâches de développement liées aux bases de données.

• Vous pouvez vous connecter à n'importe quel schéma de base de données Oracle cible à l'aide de l'authentification de base de données Oracle standard.

SQL Developer

Page 23: Presentation of Oracle database products

Oracle SQL Developer : Caractéristiques

• Développé en langage Java • Prend en charge les plates-formes Windows,

Linux et Mac OS X • Connectivité par défaut à l'aide du pilote JDBC thin • Ne requiert aucun installeur

• Décompressez le kit Oracle SQL Developer téléchargé et cliquez deux fois sur sqldeveloper.exe pour lancer Oracle SQL Developer.

• Se connecte à n'importe quelle base de données Oracle de version 9.2.0.1 ou ultérieure

• Téléchargement gratuit à partir du lien suivant : • http://www.oracle.com/technology/products/database/

sql_developer/index.html • Nécessite l'installation sur votre système du kit JDK 1.5,

qui peut être téléchargé à partir du lien suivant : • http://java.sun.com/javase/downloads/index_jdk5.jsp

Page 24: Presentation of Oracle database products

Interface d'Oracle SQL Developer

Pour pouvoir utiliser SQL Developer afin

d'exécuter des interrogations SQL sur un schéma de base de données, vous devez d'abord définir une

connexion.

Page 25: Presentation of Oracle database products

Créer une connexion de base de données • Pour utiliser Oracle SQL Developer, vous devez disposer d'au

moins une connexion de base de données. • Vous pouvez créer et tester des connexions pour :

• plusieurs bases de données • plusieurs schémas

• Oracle SQL Developer importe automatiquement toutes les connexions définies dans le fichier tnsnames.ora de votre système.

• Vous pouvez exporter des connexions vers un fichier XML. • Chaque nouvelle connexion de base de données créée est

répertoriée dans la hiérarchie du navigateur de connexions.

Page 26: Presentation of Oracle database products

Créer une connexion de base de données 1

2

3

Page 27: Presentation of Oracle database products

Consulter les objets de base de données

• Utilisez le navigateur de connexions pour : • naviguer dans la liste des objets d'un schéma

de base de données • consulter d'un coup d'oeil les définitions des objets

Page 28: Presentation of Oracle database products

Utiliser SQL Worksheet

• Utilisez SQL Worksheet pour entrer et exécuter des instructions SQL, PL/SQL et SQL*Plus.

• Indiquez les actions qui peuvent être traitées par la connexion de base de données associée à SQL Worksheet.

Entrez des instructions SQL.

Les résultats sont affichés ici.

Page 29: Presentation of Oracle database products

Utiliser SQL Worksheet

1 2

3

4

5

6

7

8 9

Page 30: Presentation of Oracle database products

Exécuter des instructions SQL

• Entrez une ou plusieurs instructions SQL dans la zone Enter SQL Statement.

F9 F5

F9F5

Page 31: Presentation of Oracle database products

Formater le code SQL

Avant formatage

Après formatage

Page 32: Presentation of Oracle database products

Enregistrer des instructions SQL

1

2

3

Page 33: Presentation of Oracle database products

Exécuter des fichiers script

1

2

3

Page 34: Presentation of Oracle database products

Instructions SQL dans SQL*Plus

• Dans Oracle Database 11g, SQL*Plus est une interface de ligne de commande.

Page 35: Presentation of Oracle database products

I - 35

Coder PL/SQL dans Oracle SQL Developer • Oracle SQL Developer est un outil graphique gratuit qui

augmente la productivité et simplifie les tâches de développement de base de données.

• Vous pouvez vous connecter à n'importe quel schéma de base de données Oracle cible en utilisant l'authentification de base de données Oracle standard.

• Dans ce cours, vous allez utiliser SQL Developer.

SQL Developer

Page 36: Presentation of Oracle database products

I - 36

Exécuter du code PL/SQL dans SQL*Plus

Page 37: Presentation of Oracle database products

I - 37

Générer du code PL/SQL dans Oracle JDeveloper

Editer

Exécuter

Page 38: Presentation of Oracle database products

I - 38

Démarrer SQL Developer et créer une connexion de base de données

Page 39: Presentation of Oracle database products

1 - 39

A propos du langage PL/SQL

• Le langage PL/SQL : • signifie "Procedural Language extension to SQL"

(extension procédurale du langage SQL) • est le langage standard d'accès aux données d'Oracle

Corporation pour les bases de données relationnelles • intègre de manière transparente les structures procédurales au

langage SQL

Page 40: Presentation of Oracle database products

1 - 40

A propos du langage PL/SQL

• Caractéristiques du langage PL/SQL : • Il offre une structure de bloc pour les unités de code

exécutables. Cette structure bien définie facilite la maintenance du code.

• Il fournit des structures procédurales : • Variables, constantes et types de données • Structures de contrôle, telles que les instructions

conditionnelles et les boucles • Programmes réutilisables qui peuvent être exécutés

plusieurs fois

Page 41: Presentation of Oracle database products

1 - 41

Environnement PL/SQL

Moteur PL/SQL

Serveur de base de données Oracle

Programme d'exécution des instructions SQL

Programmed'exécution

des instructions

procédurales

instruction procédurale

SQL

BlocPL/SQL

Page 42: Presentation of Oracle database products

1 - 42

Avantages liés à l'utilisation du langage PL/SQL

• Intégration de structures procédurales au langage SQL • Amélioration des performances

SQL IF...THEN

SQL ELSE SQL

END IF; SQL

SQL 1

SQL 2 …

Page 43: Presentation of Oracle database products

1 - 43

Avantages liés à l'utilisation du langage PL/SQL

• Développement de programme modulaire • Intégration aux outils Oracle • Portabilité • Traitement des exceptions

Page 44: Presentation of Oracle database products

1 - 44

Structure d'un bloc PL/SQL

• DECLARE (facultatif) • Variables, curseurs, exceptions définies par l'utilisateur

• BEGIN (obligatoire) • Instructions SQL • Instructions PL/SQL

• EXCEPTION (facultatif) • Actions à effectuer lorsque

des erreurs se produisent • END; (obligatoire)

Page 45: Presentation of Oracle database products

1 - 45

Types de bloc

• Bloc anonyme Procédure Fonction

[DECLARE]

BEGIN --statements

[EXCEPTION]

END;

PROCEDURE name IS

BEGIN --statements

[EXCEPTION]

END;

FUNCTION name RETURN datatype

IS BEGIN

--statements RETURN value; [EXCEPTION]

END;

Page 46: Presentation of Oracle database products

1 - 46

Créer un bloc anonyme

• Entrez le bloc anonyme dans l'espace de travail SQL Developer :

Page 47: Presentation of Oracle database products

1 - 47

Exécuter un bloc anonyme

• Cliquez sur le bouton Run Script pour exécuter le bloc anonyme :

Run Script

Page 48: Presentation of Oracle database products

VLDB Manageability andPerformance Constraints• Table availability:

• It is too costly to have a large table inaccessible for hours because of recovery.

• Large tables can be more vulnerable to disk failure.• Large-table manageability:

• They take too long to be loaded.• Indexes take too long to be built.• Partial deletes take hours, and even days.

• Performance considerations:• Large-table and large-index scans are costly.• Scanning a subset improves performance.

Page 49: Presentation of Oracle database products

Manual Partitions Versus Partitioning

SALES_10 SALES_11

SALES_12

SALES (view)

P11P10 P12

Manual partitions (tables)

UNION ALL

SALES (partitioned table)

Page 50: Presentation of Oracle database products

Partitioned Tables and Indexes

• Large tables and indexes can be partitioned into smaller, more manageable pieces. Each piece is a segment.

Table T1 Index I1

Table T1 Index I1

Page 51: Presentation of Oracle database products

Table Versus Index Partitioning

A nonpartitioned table can have partitioned or

nonpartitioned indexes.

•A partitioned table can have partitioned or

nonpartitioned indexes.

Table T1

Index I1 Index I2

Table T2

Index I3 Index I4

Page 52: Presentation of Oracle database products

Partitioning Strategies:Single-Level Partitioning• Range partitioning: Maps data to partitions based on ranges

of partition key values for each partition• Hash partitioning: Maps data to partitions by using a

hashing algorithm applied to a partitioning key • List partitioning: Maps data to partitions by using a list of

discrete values for the partitioning column• Interval partitioning: Maps data to partitions of ranges that

are automatically created by the database following a specified interval

• System partitioning: Enables the application to explicitly map rows to arbitrary partitions

Page 53: Presentation of Oracle database products

Partitioning Strategies:Composite Partitioning• Top-level strategies: RANGE, INTERVAL, HASH, LIST• Bottom-level strategies: RANGE, HASH, LIST• All combinations are

supported, such as thefollowing examples:• RANGE-LIST• HASH-HASH

SP1a

SP2a

SP3a

SP4a

RANGE, HASH, LIST

SP1b SP1c SP1y SP1z

SP2b SP2c SP2y SP2z

SP3b SP3c SP3y SP3z

SP4b SP4c SP4y SP4z

RANGE, INTERVAL, HASH, LIST,

Page 54: Presentation of Oracle database products

Oracle Partitioning History

Core Functionality Performance Manageability

Oracle 8.0 Range partitioningGlobal range indexes

Static partition pruning Basic maintenance:ADD,DROP,EXCHANGE

Oracle 8i Hash partitioningRange-hash partitioning

Partition-wise joinsDynamic pruning

Expanded maintenance:MERGE

Oracle 9i List partitioning Global index maintenance

Oracle 9i R2 Range-list partitioning Fast partition SPLIT

Oracle 10g Global hash indexes Local index maintenance

Oracle 10g R2 1M partitions per table Multidimensional pruning Fast DROP TABLE

Oracle 11g Virtual column based partitioningMore composite choicesREF partitioning

Interval partitioningPartition AdvisorIncremental stats management

Oracle 11g R2 Hash-hash partitioning “AND” pruning Multibranch executionSegment creation on demand*

Page 55: Presentation of Oracle database products

Oracle et la haute disponibilité

• Real Application Cluster RAC

• Data Guard

Page 56: Presentation of Oracle database products

ORACLE RAC

Page 57: Presentation of Oracle database products
Page 58: Presentation of Oracle database products
Page 59: Presentation of Oracle database products

Le Cloud: L’avenir pour Oracle

Page 60: Presentation of Oracle database products

Le cloud: l’avenir pour Oracle

• Oracle Database 12c / Amazon Redshift

• MYSQL / Aurora

Page 61: Presentation of Oracle database products

SQL Server on Linux

•https://www.microsoft.com/en-us/cloud-platform/sql-

server-on-linux

Page 62: Presentation of Oracle database products

Microsoft défie Oracle avec SQL Server 2016 for Linux

• Redmond contre Redwood

• Cette décision reste logique. Les serveurs Linux gagnent en effet du terrain en entreprise. En particulier dans les infrastructures Cloud.

• De plus, si SQL Server reste devant la plupart de ses concurrents, ses parts de marché en entreprise sont moitiés moindres que celles d’Oracle Database, le leader du secteur.

Page 63: Presentation of Oracle database products
Page 64: Presentation of Oracle database products

Source: http://www.techrepublic.com/article/nosql-databases-eat-into-the-relational-database-market/

Page 65: Presentation of Oracle database products

Oracle aussi ….. offre du NoSQL

• Oracle NoSQL Database• Horizontally Scaled, Key-Value Database for Web

Services and Cloud• Oracle NoSQL Database provides a powerful and

flexible transaction model that greatly simplifies the process of developing a NoSQL-based application. It scales horizontally with high availability and transparent load balancing even when dynamically adding new capacity.

http://www.oracle.com/database/nosql/index.html

Page 66: Presentation of Oracle database products

AQ&