This document provides an overview of Oracle database history, architecture, components, and terminology. It discusses:
- Oracle's release history from 1978 to present.
- The physical and logical structures that make up an Oracle database, including data files, control files, redo logs, tablespaces, segments, and blocks.
- The Oracle instance and its memory components like the SGA and PGA. It describes the various background processes.
- How clients connect to Oracle using the listener, tnsnames.ora file, and naming resolution.
- Common Oracle tools for accessing and managing databases like SQLPlus, SQL Developer, and views for monitoring databases.
2. Oracle History
•1978 – Oracle V1, never officially released
•1980 – Oracle V2 released, written in assembly language
•1994 – Oracle 7 for PC released
•1998 – Support for Linux platform
•1999 – Oracle 8i with Java integration
•2001 – Oracle 9i – modern Oracle
•2004 – Oracle 10g
•2007 – Oracle 11g
•2013 – Oracle 12c
2
3. Oracle database
•The best database for large database systems
•Most reliable in terms of data safety
•Highest availability and High Performance
•Scalable
•Internationalization support
•Multi-Model
•OLAP ready
3
4. Data safety
•Many features that ensure safety of data:
–multiplexing of important database files
–writing changes to data files and to special log files. Log files are
used to recover database after software or hardware failure
–archiving of log files. Archived log files can be written to backup
location(s)
–protection from human errors
4
5. Availability
•Very high availability:
– online backups – without shutting down the database
– most administrative tasks can be performed while the database is running and available for users, for
example: analyzing, rebuilding indexes, moving data
– disk failure: it is possible to turn off and recover only the part of the database that was affected by the
failure, the rest of the database can continue running
– parameters that ensure that recovery after failure will take no more than the specified time
– standby database – second database that can be opened if the main database fails
•Oracle Active Data Guard
• extends Oracle Data Guard
5
6. Scalability
•Oracle can handle unlimited amount of data:
–no limit on number of rows, number of tables etc.
–no limit on total size of the database
•Oracle runs on various operating systems:
–Windows NT/XP
–Linux
–Solaris, HP-UX, AIX
•Oracle Cloud/Grid – single database on a cluster
• Oracle Real Application Clusters (RAC)
6
7. Internationalization
•Database supports multiple languages/locales:
–sorting of text can be done in client language order
–date, time and currency is client dependent
–character set conversion – database running in utf8 or iso8859-2
will convert data for clients using windows-1250
•Internally database can store data in Unicode
7
8. Analytics
8
•Oracle Advanced Analytics allows access to in-database data mining algorithms and use of Oracle R
Enterprise functionality, an integration with open-source R statistical programming language and
environment.
•Oracle Partitioning allows partitioning of tables and indices, where large objects are stored in
database as a collection of individual smaller pieces at the same time appearing on application level
as a uniform data object
•Oracle On-Line Analytical Processing (OLAP) is Oracle implementation of online analytical processing.
•Oracle data models: pre-built data models with database analytics and business intelligence
capabilities for specific industries including
â—¦ Retail Data Model
â—¦ Communications Data Model
â—¦ Airlines Data Model
â—¦ Utilities Data Model
9. Performance
Oracle Advanced Compression complements Enterprise Edition basic table compression feature
with comprehensive data compression and Information Lifecycle Management capabilities,
including those specifically tailored to Oracle's engineered systems, like Oracle Exadata.
Oracle Database In-Memory, an in-memory, column-oriented data store, has been seamlessly
integrated into the Oracle Database
Oracle Real Application Testing enable testing of system changes in a simulation of production-
level workload and use
Oracle TimesTen Application-Tier Database Cache allows caching subsets of a database in the
application tier for improved response time. It is built using Oracle TimesTen In-Memory
Database.
9
10. Multi-model support
•JSON document support
• data natively with relational database features, including transactions, indexing, declarative querying,
and views
•Oracle Spatial and Graph Oracle Database provides native support for managing spatial and
location data
•Oracle XML DB or XDB
•Oracle Text
•Oracle Multimedia (known as "Oracle interMedia" before Oracle 11g)
•Object-relational database
10
11. Oracle editions
•Express edition XE:
–Simple installation and administration, some features are not
available (for example: Java Virtual Machine is disabled)
•Standard edition:
–Most frequently used features are available
•Enterprise edition:
–All features, very expensive
11
12. Oracle terminology - database
•Database – data stored on disk (data files and some additional files)
•Database instance – program (group of programs) that opens the
database (disk files) and makes it available to users
•User connects to the database instance and retrieves data or
requests changes to the database
•When running Oracle on a cluster, there are multiple database
instances that open the same database
12
13. Oracle terminology - schema
•Schema – set of objects (tables, indexes, views) that belong to a
database user.
– In Oracle SCHEMA = USER
– When new user is created (CREATE USER command), initially it has an empty schema
– When the user logs in and creates new table, the table is added to his schema
– When user issues:
SELECT * FROM some_table
Oracle looks for some_table in the user’s schema
– It is possible to access data in some other schema:
SELECT * FROM some_user.some_table
13
14. DBMS Difference
Single database
•Postgres, SQL Server, MySQL ,…
•multiple databases opened by a single database engine
• each application can use separate database for its data
•In Oracle single Oracle Instance can open one database
• normally on a single database server there will be only one database
• each application can store its data in separate user schema
14
15. DBMS Difference
Data storage
•Many other database systems (Postgres, MySQL) store table
data in a separate file or group of files
•Oracle stores table data in a tablespace. Multiple tables are
normally stored in the same tablespace. Tablespace can be
stored in one or more data files (physical disk files)
15
16. DBMS Difference
Transactions
•Oracle executes every statement in a transaction
•there is no command to start a transaction (like BEGIN
TRANSACTION)
•transaction is started automatically with a first statement after
COMMIT or ROLLBACK
•usually transaction must be finished manually with COMMIT,
exceptions:
• it is possible to turn on AUTOCOMMIT (by default: disabled)
• some statements commit the transaction automatically: all CREATE, ALTER, DROP and TRUNCATE
statements
16
17. DBMS Difference
Date format, language, Naming
•Oracle has no fixed date and time format. When displaying
dates, Oracle uses the format consistent with the connected
client
•Language used by Oracle (for example: error messages) also
depend on the language settings
•To use English with Oracle, set the environment variable
NLS_LANG before starting SQLPlus:
– SET NLS_LANG=AMERICAN_AMERICA.UTF8
–Naming
– Test <> “Test”
17
20. Physical Structures
•Datafiles (*.dbf)
• The datafiles contain all the database data. The data of logical database structures, such as tables and indexes, is physically
stored in the datafiles allocated for a database.
•Control Files (*.ctl)
• Every Oracle database has a control file. A control file contains entries that specify the physical structure of the database such
as Database name and the Names and locations of datafiles and redo log files.
•Redo Log Files (*.log)
• The primary function of the redo log is to record all changes made to data. If a failure prevents modified data from being
permanently written to the datafiles, then the changes can be obtained from the redo log, so work is never lost.
•Archive Log Files (*.log)
• Oracle automatically archives log files when the database is in ARCHIVELOG mode. This prevents oracle from overwriting the
redo log files before they have been safely archived to another location.
•Parameter Files (initSID.ora)
• Parameter files contain a list of configuration parameters for that instance and database.
•Alert and Trace Log Files (*.trc)
• Each server and background process can write to an associated trace file. When an internal error is detected by a process, it dumps information
about the error to its trace file. The alert log of a database is a chronological log of messages and errors.
20
21. Logical Structures
Tablespaces
â—¦ A database is divided into logical storage units called tablespaces, which group related logical structures together. One or
more datafiles are explicitly created for each tablespace to physically store the data of all logical structures in a tablespace.
Oracle Data Blocks
â—¦ At the finest level of granularity, Oracle database data is stored in data blocks. One data block corresponds to a specific
number of bytes of physical database space on disk. The standard block size is specified by the DB_BLOCK_SIZE initialization
parameter.
Extents
â—¦ The next level of logical database space is an extent. An extent is a specific number of contiguous data blocks, obtained in a
single allocation, used to store a specific type of information.
Segments
â—¦ Above extents, the level of logical database storage is a segment. A segment is a set of extents allocated for a certain logical
structure. The different types of segments are :
◦ Data segment – stores table data
◦ Index segment – stores index data
◦ Temporary segment – temporary space used during SQL execution
◦ Rollback Segment – stores undo information
21
22. Segments, Extents, and Blocks
â—¦ Segments exist within a tablespace.
â—¦ Segments are made up of a collection of extents.
â—¦ Extents are a collection of data blocks.
â—¦ Data blocks are mapped to disk blocks.
22
Segment Extents Data
blocks
Disk
blocks
23. Logical and Physical Database Structures
23
Database
Logical Physical
Tablespace Data file
OS block
Segment
Extent
Oracle data
block
Schema
24. Oracle Instance and Background
Processes
•An Oracle instance:
• Is a means to access an Oracle database
• Always opens one and only one database
•SGA( System Global Area)
• a group of shared memory structures that contain data and control information for one Oracle database
instance.
• the data in the instance's SGA is shared among the multiple concurrent users.
• allocated when you start the database instance
• de-allocated when the instance is shutdown.
•PGA (Program Global Area)
• Each server process has a PGA allocated that is a private area for each server
• Work area for each application.
24
Instance
SGA
Background processes
25. SGA Memory Areas
•Shared pool contains machine-language code and execution plans for frequently used SQL
commands.
•Database Buffer Cache stores data values which are written later to the data files by the
database writer (DBWn).
•Redo Log Buffer stores a copy of the changed data from user transaction. This data is
periodically written to the Redo Log Files by the Log Writer (LGWR).
•Large Pool is a work area given for backup and recovery operations.
•Java Pool stores the machine-language and execution plans for Java commands used in
application programs and database operations.
25
26. Program Global Area (PGA)
•PGA is a memory buffer
• contains data and control information for a server process.
• A server process is a process that services a client’s requests.
• A PGA is created by oracle when a server process is started.
• The PGA area is a non-shared area of memory created by oracle when a server process is started.
•The basic difference between SGA and PGA
• PGA cannot be shared between multiple processes in the sense that it is used only for requirements of a
particular process
• SGA is used for the whole instance and it is shared.
26
27. Processes
•System Monitor (SMON) :
• general server housekeeping functions.
•Process Monitor (PMON) :
• monitors and manages individual user sessions .
• performs database locking/unlocking functions on UPDATE and DELETE query.
•Database Writer (DBWn) :
• writes changed data from the database buffer cache to data files.
• an oracle 10G instance can have 10 writer instances DBW0-DBW9.
•Log Writer (LGWR) :
• writes the redo log data from the Redo Log Buffer to the Redo Log Files.
• Redo Log files aid in database recovery.
• keep track of the database changes whenever they are committed
27
28. Processes 2
•Checkpoint (CKPT) :
• responsible for signaling DBWn and LGWR to write the contents of the Database Buffer Cache and the
Redo Log Cache to the data files and Redo Log files respectively.
•Archiver (ARCn) :
• reads the Redo Log files after they are filled & copies it to a corresponding Archive Log File.
• there can be up to 10 separate archive processes per instance Arc0-Arc9.
•Recoverer (RECO) :
• detect and correct errors as a result of communications problems in a distributed database
environment.
28
29. Accessing the database
•Oracle can be accessed from various tools:
•Oracle tools:
• SQLPlus (always available) – command line tool for executing SQL statements. All administrative
statements can be executed from SQLPlus
• SQL Developer – free development tool, easier to use than SQLPlus
•Third party tools:
• TOAD –application for administrating Oracle database, executing SQL statements, TOAD Freeware
Edition is available for free
• Navicat
29
30. Connecting to Oracle – Oracle Listener
•Connection to Oracle is possible:
– in local mode – when connecting to local database only
– via network – when connecting to some other database
•All non-local connections are done through the listener
•Oracle Listener is separate from the database
•In Windows it starts as service OraclexxxxTNSListener
•One listener can handle connections for multiple databases
•Listener configuration determines how clients will connect to the database. By default
listener:
– uses TCP/IP
– listens on port 1521 – default Oracle port
30
32. Listener startup and shutdown
•Listener can be started manually from the command line:
–lsnrctl start
•Other commands:
–lsnrctl stop – stops the listener
–lsnrctl status – shows list of services that this listener
supports
32
33. Naming configuration
•When connecting to database using SQLPlus you specify:
–user name
–password
–database name
•When the database name is empty – connection to the local
database
•When the database name is not empty – lookup of the database
name. By default database names are looked up in
tnsnames.ora file
33
34. tnsnames.ora
•Location:
$ORACLE_HOME/network/admin/tnsnames.ora
•This file is used to lookup names of databases:
– IP address of the database
– listener port number
– name of the Oracle instance
•Typical entry in the tnsnames.ora file:
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = name_or_ip)
(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = database_instance_name)
)
)
34
35. System views
•Oracle provides many system views that provide information
about the database:
–v$session – all open sessions
–v$datafile – all data files
–v$logfile – all log files
–v$database – general information about the database
–v$instance – general information about the instance
•Some of those views are available when the database is closed
35
Datafiles
Every Oracle database has one or more physical datafiles. The datafiles contain all the database data. The data of logical database structures, such as tables and indexes, is physically stored in the datafiles allocated for a database. One or more datafiles form a logical unit of database storage called a tablespace.
Data in a datafile is read, as needed, during normal database operation and stored in the memory cache of Oracle. For example, assume that a user wants to access some data in a table of a database. If the requested information is not already in the memory cache for the database, then it is read from the appropriate datafiles and stored in memory.
Modified or new data is not necessarily written to a datafile immediately. To reduce the amount of disk access and to increase performance, data is pooled in memory and written to the appropriate datafiles all at once, as determined by the database writer process (DBWn) background process.
Control Files
Every Oracle database has a control file. A control file contains entries that specify the physical structure of the database such as Database name and the Names and locations of datafiles and redo log files.
Oracle can multiplex the control file, that is, simultaneously maintain a number of identical control file copies, to protect against a failure involving the control file.
Every time an instance of an Oracle database is started, its control file identifies the database and redo log files that must be opened for database operation to proceed. If the physical makeup of the database is altered (for example, if a new datafile or redo log file is created), then the control file is automatically modified by Oracle to reflect the change. A control file is also used in database recovery.
Redo Log Files
Every Oracle database has a set of two or more redo log files. The set of redo log files is collectively known as the redo log for the database. A redo log is made up of redo entries (also called redo records).
The primary function of the redo log is to record all changes made to data. If a failure prevents modified data from being permanently written to the datafiles, then the changes can be obtained from the redo log, so work is never lost.
To protect against a failure involving the redo log itself, Oracle allows a multiplexed redo log so that two or more copies of the redo log can be maintained on different disks.
The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to the datafiles. For example, if an unexpected power outage terminates database operation, then data in memory cannot be written to the datafiles, and the data is lost. However, lost data can be recovered when the database is opened, after power is restored. By applying the information in the most recent redo log files to the database datafiles, Oracle restores the database to the time at which the power failure occurred.
The process of applying the redo log during a recovery operation is called rolling forward.
Archive Log Files
You can enable automatic archiving of the redo log. Oracle automatically archives log files when the database is in ARCHIVELOG mode. This prevents oracle from overwriting the redo log files before a they have been safely archived to another location.
Parameter Files
Parameter files contain a list of configuration parameters for that instance and database.
Oracle recommends that you create a server parameter file (SPFILE) as a dynamic means of maintaining initialization parameters. A server parameter file lets you store and manage your initialization parameters persistently in a server-side disk file.
Alert and Trace Log Files
Each server and background process can write to an associated trace file. When an internal error is detected by a process, it dumps information about the error to its trace file. Some of the information written to a trace file is intended for the database administrator, while other information is for Oracle Support Services. Trace file information is also used to tune applications and instances.
The alert file, or alert log, is a special trace file. The alert log of a database is a chronological log of messages and errors.