Laboratoire Supinfo des technologies Oracle
description
Transcript of Laboratoire Supinfo des technologies Oracle
Laboratoire Supinfo des technologies Oracle
Rappels
Aperçu de l’architecture Oracle
Database
Instance
SGA
Redo logbuffer
Data buffercache
Shared pool
Data dict.cache
Librarycache
PMON DBW0SMON LGWRCKPT Others
Userprocess
Serverprocess
PGA
Control files
Data files
Redo logfiles
Archived log files
Parameterfile
Passwordfile
Le fichier de paramètre
initU15.orainitU15.ora
SQL> CONNECT / AS SYSDBA
SQL> STARTUP PFILE=/DISK1/initU15.ora
SQL> CONNECT / AS SYSDBA
SQL> STARTUP PFILE=/DISK1/initU15.ora
Instance
SGA
Redo logbuffer
Data buffercache
Shared pool
Data dict.cache
Librarycache
PMON DBWRSMON LGWRCKPT ARCH
Startup et shutdown
OPENOPEN
MOUNTMOUNT
NOMOUNTNOMOUNT
SHUTDOWNSHUTDOWN
All files opened as All files opened as described by the control described by the control file for this instance.file for this instance.
Control file Control file opened for this opened for this instance.instance.
Instance Instance started.started.
STARTUPSTARTUP
SHUTDOWNSHUTDOWN
Options de Shutdown
A
x
x
x
x
T
x
x
o
o
I
x
x
x
o
Shutdown Mode
Allow new connections
Wait until current sessions end
Wait until current transactions end
Force a checkpoint and close files
N
x
o
o
o
Shutdown mode: Shutdown mode:
A AbortA Abort I ImmediateI Immediate
T TransactionalT Transactional N NormalN Normal YESYES
NONOx
o
Creating the database
SPOOL creU16.log
STARTUP NOMOUNT PFILE=initU16.ora
CREATE DATABASE U16
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXLOGHISTORY 100
LOGFILE
GROUP 1 ('/DISK3/log1a.rdo',/DISK4/log1b.rdo’) SIZE 1 M,
GROUP 2 ('/DISK3/log2a.rdo',/DISK4/log2b.rdo’) SIZE 1 M
DATAFILE
'/DISK1/system01.dbf' size 50M autoextend on
CHARACTER SET WE8ISO8859P1;
SPOOL creU16.log
STARTUP NOMOUNT PFILE=initU16.ora
CREATE DATABASE U16
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXLOGHISTORY 100
LOGFILE
GROUP 1 ('/DISK3/log1a.rdo',/DISK4/log1b.rdo’) SIZE 1 M,
GROUP 2 ('/DISK3/log2a.rdo',/DISK4/log2b.rdo’) SIZE 1 M
DATAFILE
'/DISK1/system01.dbf' size 50M autoextend on
CHARACTER SET WE8ISO8859P1;
Catégories de vues
DBA_xxx
USER_xxx
ALL_xxx
Objects owned by the current user
Objects accessible by the current user
All of the objects in the database
Examples
• General overview– DICTIONARY
• Schema objects– DBA_TABLES– DBA_OBJECTS
• Space allocation– DBA_ SEGMENTS– DBA_FREE_SPACE
• Database structure– DBA_DATA_FILES– DBA_ROLLBACK_SEGS– DBA_TABLESPACES
• General overview– DICTIONARY
• Schema objects– DBA_TABLES– DBA_OBJECTS
• Space allocation– DBA_ SEGMENTS– DBA_FREE_SPACE
• Database structure– DBA_DATA_FILES– DBA_ROLLBACK_SEGS– DBA_TABLESPACES
– DICT_COLUMNS
– DBA_TAB_COLUMNS
– DBA_CONSTRAINTS
– DBA_EXTENTS
– DICT_COLUMNS
– DBA_TAB_COLUMNS
– DBA_CONSTRAINTS
– DBA_EXTENTS
Script de création de vues
Script Purpose
catalog.sql Creates commonly used data dictionary
views and synonyms
catproc.sql Runs scripts required for server-side
PL/SQL
L’utilité du fichier de controle
• Small, binary file
• Required:– At mount– To operate
• Linked to a single database
• Should be multiplexed
• Loss may require recovery
• Small, binary file
• Required:– At mount– To operate
• Linked to a single database
• Should be multiplexed
• Loss may require recovery
Control files
Data files
Redo logfiles
Database
Multiplexage
control_files=(/DISK1/control01.con,/DISK2/control02.con)control_files=(/DISK1/control01.con,/DISK2/control02.con)
Disk 1Disk 1
control01.con
Disk 2Disk 2
control02.con
Groupes et membres de redo
Group 2Group 2 Group 3Group 3Group 1Group 1
Member
Disk 1Disk 1
Disk 2Disk 2Member
Member Member
MemberMember
Sans archivage
BackupBackup Disk failureDisk failure
101
t1t1 t2t2
Data files Control
files
50 51 100
Avec Archivage
Disk failureDisk failure
101
t2t2
100
t1t1
50 51
BackupBackup
Data files Control
files
Archived redo logsArchived redo logs
50
99
Hiérarchie de stockage
Database
Logical Physical
Tablespace Data file
OS blockOracle block
Segment
Extent
Création de tablespace
CREATE TABLESPACE app_data
DATAFILE '/DISK4/app_data_01.dbf'
SIZE 100M,
'/DISK5/app data_ 02.dbf'
SIZE 100M
MINIMUM EXTENT 500K
DEFAULT STORAGE ( INITIAL 500K
NEXT 500K
MAXEXTENTS 500
PCTINCREASE 0 );
CREATE TABLESPACE app_data
DATAFILE '/DISK4/app_data_01.dbf'
SIZE 100M,
'/DISK5/app data_ 02.dbf'
SIZE 100M
MINIMUM EXTENT 500K
DEFAULT STORAGE ( INITIAL 500K
NEXT 500K
MAXEXTENTS 500
PCTINCREASE 0 );
Rollback: Fonctionnalités
Transaction rollbackTransaction rollback
Transaction Transaction recoveryrecovery
Rollback segmentRollback segment Read consistencyRead consistency
Héritage des clause de stockage
Oracle default
Tablespace
Segment
Vue du dictionnaire de données
Tablespaces
DBA_TABLESPACES
Segments
DBA_SEGMENTS
Data files
DBA_DATA_FILES
Free extents
DBA_FREE_SPACE
Used extents
DBA_EXTENTS
Capacité de fragmentation
Tablespace
SYSTEM
TOOLS
DATAn
INDEXn
RBSn
TEMPn
Fragmentation
Zero
Very low
Low
Low
High
Very high*
Usage
Data dictionary
Applications
Data segments
Index segments
Rollback segments
Temporary segments
* Relevant only if tablespace PERMANENT* Relevant only if tablespace PERMANENT
Structure d’une ligne
Database blockDatabase block
Row headerRow header
Column lengthColumn length
Column valueColumn value
Classification des indexes
• Logical– Single column or concatenated– Unique or nonunique– Function-based
• Physical– Partitioned or nonpartitioned – B-tree– Normal or reverse key– Bitmap
• Logical– Single column or concatenated– Unique or nonunique– Function-based
• Physical– Partitioned or nonpartitioned – B-tree– Normal or reverse key– Bitmap
Fin du rappel
VOUS VOUS RAPPELEZ DE TOUT, ON FAIT UN CONTRÔLE
VOUS VOUS RAPPELEZ DE TOUT, ON FAIT UN CONTRÔLE