SlideShare a Scribd company logo
1 of 104
Leo’s notes from
Database 2 Day DBA
1
• Those slides are Leopold Gault's personal notes and drawings, when reading
Database 2 Day DBA
• You may ask me for the original file (with animations) at galeopold@gmail.com
3
Oracle Database components
Oracle software
Meta
data
Control file
User
data
database
Oracle instance
(identified by the SID and global database name)
= background processesMetadata: collection of information that permits the
Oracle software to manage user data.
{access, store, monitor, recover}
Server processes
(dedicated or shared)
Executes SQL
Oracle Net (software)
-> Net listener (process)
Client app
with connection object
ensure the {integrity, availability,
recoverability} of user data
Control structures (a.k.a. control files)
Online
redo logs
4
Database system = DB + Oracle instance
Oracle instance
(identified by the SID and global database name)
= background processes
Database system
Meta
data
Control file
User
data
database
Control structures (a.k.a. control files)
Online
redo logs +
5
Writing data to disk: OS filesystem vs ASM
Database files
OS filesystem
XOR
Oracle ASM
ASM disk groups
Oracle ASM performs software striping
and mirroring at the file level
ASM instance
(one per machine)configures and manages
disk groups
Metada
ta
Control file
User
data
Control structures (a.k.a. control files)
Online redo
logs
6
Mapping of OS user groups with DB privileges
OS user group OS user name
dba leo
dba Pape
oper Alexis
oper Guillaume
Oper Oliver
OSBACKUPDBA Marcos
Type of DB access (privilege) Mapped to OS user group
SYSDBA dba
SYSOPER oper
SYSBACKUP OSBACKUPDBA
Oracle instance
(identified by the SID and global database name)
= background processes
Such mapping will allow leo and Pape to
connect to the DB using OS logging:
>sqlplus SYS as SYSDBA
7
ORACLE_BASE
helps to facilitate the organization of
multiple Oracle software installations
Usually located in
/u0[1, 9]/app/username
ORACLE_HOME
Software location
You must specify a new
Oracle home directory for
each new installation of
Oracle Database software
oradata
(DB file location)
oraInventory
Used by the OUI to keep track
of all Oracle software installed
on the computer
the first
writable
/u0[1,9]
Oracle
Universal
Installer
8
Meta
data
User
data
Data files
Δ
online redo log group
(at least 2 groups / DB)
[inactive] online redo log group
Δlog writer process (LGWR)
SGA
Redo log
buffer area
The log writer process writes redo log entries to disk. Redo log entries are generated in the redo log
buffer of the System Global Area (SGA) and the log writer process writes the redo log entries
sequentially into an online redo log file.
*I think that there is only one online redo log file per group. As most of the times, the online redo log file of a group is multiplexed, the
documentation talks about the “online redo log files of the group” (which is confusing, because it could mean that there can be several
redo log files per group).
Online redo log file*
contains a record of changes that were made
to the data files
9
Data files
Δ
online redo log group
(at least 2 groups / DB)
[inactive] online redo log group
After the online redo log files in a group have filled up, the log writer process (LGWR) switches the writing of redo
records to a new online redo log group.
The LGWR process performs this action in a circular fashion so that the oldest group is overwritten by the most recent redo
records.
log writer process (LGWR)
SGA
Redo log
buffer area
Δ
Meta
data
User
data
Online redo log file*
contains a record of changes that were made
to the data files
10
Meta
data
User
data
Data files
Δ
Online redo log files
contain a record of changes that were made to
data files
online redo log group
(at least 2 groups / DB)
Oracle Database can automatically save the inactive group of online
redo log files to one or more offline destinations, known collectively as
the archived redo log (also called the archive log).
Archive redo log
[inactive] online redo log group
log writer process (LGWR)
Δ
11
Meta
data
User
data
Data files
Δ
Online redo log files
contain a record of changes that were made to
data files
online redo log group
(at least 2 groups / DB)
Oracle Database can automatically save the inactive group of online
redo log files to one or more offline destinations, known collectively as
the archived redo log (also called the archive log).
Archive redo log
[inactive] online redo log group
log writer process (LGWR)
Log files are
full, or a Log-
switch event
occurs
Δ
12
Meta
data
User
data
Data files
Δ
Online redo log files
contain a record of changes that were made to
data files
online redo log group
(at least 2 groups / DB)
Oracle Database can automatically save the inactive group of online
redo log files to one or more offline destinations, known collectively as
the archived redo log (also called the archive log).
Archive redo log
[inactive] online redo log group
log writer process (LGWR)
Log files are
full, or a Log-
switch event
occurs
Δ
13
Meta
data
User
data
Data files
Δ
Online redo log files
contain a record of changes that were made to
data files
online redo log group
(at least 2 groups / DB)
Oracle Database can automatically save the inactive group of online
redo log files to one or more offline destinations, known collectively as
the archived redo log (also called the archive log).
Archive redo log
[inactive] online redo log group
In ARCHIVELOG mode, the group is
ready for use by the LGWR only ofter
the archive process is completed
log writer process (LGWR)
Log files are
full, or a Log-
switch event
occurs
14
Multiplexing of the online redo logs
I think that the same LGWR process
writes at the n (2) locations at once
Group status = Current
The database log writer process (LGWR) writes redo records from the memory buffer to a redo log group until the log
files in that group reach their storage size limit, or until you request a log switch operation. The LGWR process then
writes to the next log group. The LGWR process performs this action in a circular fashion so that the oldest group is
overwritten by the most recent redo records.
15
ARCHIVELOG NOARCHIVELOG
Availability of the
online redo log group
A group of online redo log files cannot be reused by the log writer
(LGWR) process until the group is archived.
when a group becomes inactive after the LGWR process
switches to a new group, the inactive group is available for
immediate reuse by the LGWR process.
protection protects a database from instance failure and media failure. protects a database from instance failure but not from media
failure.
Only the most recent changes made to the database, which are
stored in the online redo log files, are available for instance
recovery.
restore you can use only entire database backups taken while the
database is closed. Therefore, back up the entire database at
regular, frequent intervals.
Backup online ? yes no
Listeners and services
16
17
ORACLE_BASE
helps to facilitate the organization of
multiple Oracle software installations
Usually located in
/u0[1, 9]/app/username
ORACLE_HOME
Software location
You must specify a new
Oracle home directory for
each new installation of
Oracle Database software
oradata
(DB file location)
oraInventory
Used by the OUI to keep track
of all Oracle software installed
on the computer
the first
writable
/u0[1,9]
network
admin
listener.ora
Default listener config file.
tnsnames.ora
Describes the mapping of the net service names (provided by
clients when requesting a connection, in their connect string) to
the connect descriptors (protocol + service name); for the local
naming method.
Default location for the Fast Recovery
Area
19
Default Listener
LISTENER
The default Oracle Net Listener (process)
listener.ora
The default listener config file.
This file is automatically configured during the
installation.
Its config file
:1521
LISTENER=
…
(ADDRESS=(PROTOCOL=tcp)
(HOST=host_name)(PORT=1521))
…
20
listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = OAC-DB.compute-gse00002322.oraclecloud.internal)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
VALID_NODE_CHECKING_REGISTRATION_LISTENER=ON
SSL_VERSION = 1.2
21
DB service = Logical representations of a database (i.e. the way a
database is presented to clients)
Database Service Names (the name of a DB Service)
LISTENER
The default Oracle Net Listener (process)
:1521
Service name 1
Service name 2
• An Oracle instance can be presented as multiple services
• and a service can be implemented as multiple Oracle instances.
22
A DB service name can be assigned to the Net Listener in listener.ora
DB Service names and the default Net Listener
LISTENER
The default Oracle Net Listener (process)
listener.ora
The default listener
config file.
Its config file
:1521
LISTENER=
…
(ADDRESS=(PROTOCOL=tcp)
(HOST=host_name)(PORT=1521))
(connect_data=
(service_name=test)
…
test
The service names, can be configured
in listener.ora
+
23
Dynamic registration
DB service names registration to Net Listener(s)
<LISTENET_NAME>
An Oracle Net Listener (process)
Service name 1
Dynamic registration
Service registration is performed by the listener registration (LREG)
process—an instance background process—of each database
instance. Dynamic service registration does not require modification
of the listener.ora file.
Listener registration process (LREG)
+
Service names can also be dynamically registered with the Net
listener. Dynamic registration of services and databases with the
Net listener is called service registration.
25
List the service names of an instance
SQL> SELECT service_id, name FROM v$services;
SERVICE_ID NAME
---------- ----------------------------------------------------------------
7 mydata.gse00002322.oraclecloud.internal
6 pdb1.gse00002322.oraclecloud.internal
3 OACDB.gse00002322.oraclecloud.internalXDB
4 OACDB.gse00002322.oraclecloud.internal
1 SYS$BACKGROUND
2 SYS$USERS
6 rows selected.
26
lsnrctl services
List the DB services names registered into the Net Listener
[oracle@OAC-DB ~]$ lsnrctl services
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 13-OCT-2017 14:32:36
Copyright (c) 1991, 2017, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=OAC-DB.compute-gse00002322.oraclecloud.internal)(PORT=1521)))
Services Summary...
Service "OACDB.gse00002322.oraclecloud.internal" has 1 instance(s).
Instance "OACDB", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:9213 refused:0 state:ready
LOCAL SERVER
Service "OACDB.gse00002322.oraclecloud.internalXDB" has 1 instance(s).
Instance "OACDB", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:83 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: OAC-DB, pid: 7742>
(ADDRESS=(PROTOCOL=tcp)(HOST=OAC-DB.compute-gse00002322.oraclecloud.internal)(PORT=13692))
Service "mydata.gse00002322.oraclecloud.internal" has 1 instance(s).
Instance "OACDB", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:9213 refused:0 state:ready
LOCAL SERVER
Service "pdb1.gse00002322.oraclecloud.internal" has 1 instance(s).
Instance "OACDB", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:9213 refused:0 state:ready
LOCAL SERVER
The command completed successfully
That’s LISTENER (cf listener.ora)
All the services that have
been registered to it
Because a DB service can represent
multiple Oracle instances
The server process,
which is set as a
handler of this DB
service, is in dedicated
mode (so there is no
dispatcher)
For this
service, the
server is in
shared mode
27
What clients do to request a connection
Client app
Users initiate a connection-request by
providing a connect string. It includes:
• Username and password
• Connect identifier
The Connect Identifier can be:
• The Connect descriptor
• OR a net service name
The Connect descriptor contains :
• A protocol
• And a DB service name
Net service name
A name that resolves to the connect descriptor using
mapping information stored in one or more repositories
accessed with one of the following naming methods:
• Easy connect naming: {TCP/IP protocol, DB service
name, hostname}
• Local naming: connect descriptor mapped to a net
service name in tnsnames.ora
• Directory naming: resolves {a DB service, net service
name, or a net service alias} to a connect descriptor,
stored in a LDAP
28
Easy Connect Naming
Net Service Name – Naming Methods
The Easy Connect feature, which was introduced in Oracle Database 11g Release 1 (11.1), makes the following parts of the conventional JDBC
connection URL syntax optional:
jdbc:oracle:driver_type:[username/password]@[//]host_name[:port][:serviceName]
In this URL:
• // is optional.
• :port is optional.
Specify a port only if the default Oracle Net listener port (1521) is not used.
• :serviceName is optional.
The connection adapter for the Oracle Database connects to the default service on the host.
e.g. of connect identifier: hostname:1521/dbServiceName
Here, the Connect Identifier is a net service
name, which is resolved thanks to the easy
connect naming
connect string
29
[oracle@leoDB admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = leoDB.compute-gse00012384.oraclecloud.internal)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
VALID_NODE_CHECKING_REGISTRATION_LISTENER=ON
SSL_VERSION = 1.2
Maps net service name <-> Connect descriptor
[oracle@leoDB admin]$ cat tnsnames.ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = leoDB.compute-gse00012384.oraclecloud.internal)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL.gse00012384.oraclecloud.internal)
)
)
PDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = leoDB.compute-gse00012384.oraclecloud.internal)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdb1.gse00012384.oraclecloud.internal)
)
)
Net service
name
Connect descriptor
Local Naming (uses tnsnames.ora)
Net Service Name – Naming Methods
Side note
• “DB service” is often referred as “DB service name” or “service name”
• “Net service name” ≠ “service name”
30
31
Oracle Instance’s (background) processes
Oracle instance
(identified by the SID and global database name)
= background processes
Background Process Description
Database writer (DBWn) The database writer writes modified blocks from the database buffer cache to the files on a disk. Oracle Database allows
a maximum of 36 database writer processes.
Log writer (LGWR) The log writer process writes redo log entries to disk. Redo log entries are generated in the redo log buffer of the System
Global Area (SGA) and the log writer process writes the redo log entries sequentially into an online redo log file.
Checkpoint (CKPT) At specific times, all modified database buffers in the SGA are written to the data files by a database writer process
(DBWn). This event is called a checkpoint. The checkpoint process signals DBWn, updates the data files and control
files of the database, and records the time of this update.
System monitor (SMON) The system monitor performs instance recovery when a failed instance is restarted.
Process monitor (PMON) The process monitor performs a recovery when a user process fails. It cleans up the cache and frees resources that the
failed process was using.
Archiver (ARCn) Archiver processes copy the online redo log files to archival storage when the log files are full or a log switch occurs. The
database must be in archive log mode to run archive processes. For more information, see Performing Backup and
Recovery.
Manageability monitor (MMON) This process performs various management-related background tasks, for example:
•Issuing alerts whenever a given metric violates its threshold value
•Taking snapshots by spawning additional processes
•Capturing statistical values for SQL objects that have been recently modified
Job Queue Processes (CJQ0
and Jnnn)
Job queue processes run user jobs, often in batch mode. A job is a user-defined task scheduled to run one or more
times.
SGA
Database
buffer
Meta
data User
data
Δ
Data files
Dedicated
Each client process has its own server process. Although a dedicated server process is good
for long-running queries and administrative tasks, an idle process or too many dedicated
processes can result in an inefficient use of resources.
32
Shared
Eliminates the need for a dedicated server process for each user connection,
requires less memory for each user connection, and enables more users to access
the database. Shared server mode is more efficient at supporting multiple client
programs making frequent short-running queries.
Dedicated/shared server mode
PGA PGA
PGA
33
System Global Area VS Program Global Area
Memory Structures: SGA vs PGA
Oracle instance
(identified by the SID and global database name)
= background processes
Server processes
(dedicated or shared)
Executes SQL
SGA
PGA
Exemple: Database buffer cache, Redo log buffer, Result
cache, Shared pool (for stored procedures, info from the data
dictionary –user account data, table and index descriptions,
privileges), streams pool, Large pool, etc.
PGA
PGA
PGA
PGA
PGA
Total instance PGA
It is non-shared memory created by Oracle Database when a server
process is started. Access to the PGA is exclusive to the server
process. There is one PGA for each server process. Background
processes also allocate their own PGAs.
The amount of (total instance PGA as well as the amount of PGA for each
server process) PGA memory used, and the contents of the PGA depend
on whether the instance is running in dedicated server mode (each client
process has its own server process) or shared server mode (you don’t have
a dedicated server process for each user connection).
The PGA is used to process SQL statements and to hold logon and other
session information. A large part of the PGA is dedicated to SQL work
areas, which are working memory areas for sorts and other SQL
operations.
34
1) Spawning the Oracle instance
Startup an Oracle Instance
Oracle instance
(identified by the SID and global database name)
= background processes
Init<SID>.ora
010011
SPFILE
XOR
1) The instance reads the initialization
parameter file, allocates the SGA, and
starts the background processes
> STARTUP
SGA
Oracle instance (init process)
2)
3)
35
2) Reach the MOUNT state
Startup an Oracle Instance
Oracle instance
(identified by the SID and global database name)
= background processes
Meta
data User
data
Database
Control file
• DB name
• Location of associated
data files and redo log
files
• Timestamp of the DB
creation
• Current log sequence
number
• Checkpoint info
Online redo
logs
If you mount the database, then the Oracle instance
opens the control file for the database, but does not
open the data files.
36
3) Reach the OPEN state
Startup an Oracle Instance
Oracle instance
(identified by the SID and global database name)
= background processes
Meta
data User
data
Database
Control file
• DB name
• Location of associated
data files and redo log
files
• Timestamp of the DB
creation
• Current log sequence
number
• Checkpoint info
Online redo
logs
If you open the database, then, after reading the parameter file and control
file, the online redo log files and data files for the database are also
opened. The state of the database is now OPEN and user access to the
data is available.
37
SHUTDOWN (NORMAL or IMMEDIATE)
Shut down an Oracle Instance
Oracle instance
(identified by the SID and global database name)
= background processes
SGA
Database
buffer
Redo logs
buffer
Meta
data User
data
Data files
online
redo log
Checkpoint is
triggered
Control file
Database
38
SHUTDOWN (NORMAL or IMMEDIATE)
Shut down an Oracle Instance
Oracle instance
(identified by the SID and global database name)
= background processes
SGA
Database
buffer
Redo logs
buffer
Meta
data User
data
Data files
online
redo log
Control file
Database is
closed
39
SHUTDOWN (NORMAL or IMMEDIATE)
Shut down an Oracle Instance
Oracle instance
(identified by the SID and global database name)
= background processes
SGA
Database
buffer
Redo logs
buffer
Meta
data User
data
Data files
online
redo log
Control file
NOMOUNT
database
40
SHUTDOWN (NORMAL or IMMEDIATE)
Shut down an Oracle Instance
Oracle instance
(identified by the SID and global database name)
= background processes
SGA
Database
buffer
Redo logs
buffer
Meta
data User
data
Data files
online
redo log
Control file
NOMOUNT
database
41
Oracle DB storage structures
Oracle instance
(identified by the SID and global database name)
= background processes
What the Oracle
instance sees
What the OS sees
1..1 if you choose
BigFile tablespace
(for ASM or other
logical volume
managers)
1..n
There can be multiple undo
tablespaces, but only one can be
active for an Oracleinstance.
3 groups of multiplexed
online redo logs
Temps
filesTemps
filesTemps
filesTemps
file
42
CDB and PDBs
Control file
online
redo log
Temps
filesTemps
filesTemps
filesTemps
file
Undo
data
files
Undo
data
files
Undo
data
files
Undo
data
file
System
data files
for
container n
System
data files
for
container n
System
data files
for
container n
System
data file
for
container n
System
data files
for
container n
System
data files
for
container n
System
data files
for
container n
System
data file
for
container 1
[1, *] sets of tem files One set of undo data files
A set of system data files for every container
Data
filesData
filesData
filesData
file
From my
understanding
Zero or more sets of user-
created data files
Temps
filesTemps
filesTemps
filesTemps
file
43
CDB and PDBs
Control file
online
redo log
Temps
filesTemps
filesTemps
filesTemps
file
Undo
data
files
Undo
data
files
Undo
data
files
Undo
data
file
System
data files
for
container n
System
data files
for
container n
System
data files
for
container n
System
data file
for
container n
System
data files
for
container n
System
data files
for
container n
System
data files
for
container n
System
data file
for
container 1
[1, *] sets of tem files One set of undo data files
A set of system data files for every container
Zero or more sets of user-
created data files
Data
filesData
files
From my
understanding
Legend:
used by the CDB
used by a PDB
Data
filesData
file
44
logical structures seen by the Oracle instance
Datafiles components
Data
file
1
Extent
A contiguous set of data blocks within a
segment.
Oracle Database allocates space for segments in units of one
extent. When the existing extents of a segment are full, the
database allocates another extent for that segment.
n
Segment
Contains a specific type of database
object.
For example, a table is stored in a table segment, and an
index is stored in an index segment.
1..n
1
data block, a.k.a database block
The smallest unit of I/O to database
storage. An extent consists of several
contiguous data blocks.
The database uses a default block size at database creation. After
the database has been created, it is not possible to change the
default block size without re-creating the database. It is possible,
however, to create a tablespace with a block size different than the
default block size.
Contiguous n
45
logical structures seen by the Oracle instance
Datafiles components
Data
file
1
Extent
A contiguous set of data blocks within a
segment.
Oracle Database allocates space for segments in units of one
extent. When the existing extents of a segment are full, the
database allocates another extent for that segment.
n
Segment
Contains a specific type of database
object.
For example, a table is stored in a table segment, and an
index is stored in an index segment.
1..n
1
data block, a.k.a database block
The smallest unit of I/O to database
storage. An extent consists of several
contiguous data blocks.
The database uses a default block size at database creation. After
the database has been created, it is not possible to change the
default block size without re-creating the database. It is possible,
however, to create a tablespace with a block size different than
the default block size.
Contiguous n
46
logical structures seen by the Oracle instance
Datafiles components
Data
file
1
Extent
A contiguous set of data blocks within a
segment.
Oracle Database allocates space for segments in units of one
extent. When the existing extents of a segment are full, the
database allocates another extent for that segment.
n
Segment
Contains a specific type of database
object.
For example, a table is stored in a table segment, and an
index is stored in an index segment.
1..n
1
data block, a.k.a database block
The smallest unit of I/O to database
storage. An extent consists of several
contiguous data blocks.
The database uses a default block size at database creation. After
the database has been created, it is not possible to change the
default block size without re-creating the database. It is possible,
however, to create a tablespace with a block size different than the
default block size.
Contiguous n
Tablespaces
• group related logical structures (such as tables, views, and other database objects).
• For example, all application objects can be grouped into a single tablespace to simplify
maintenance operations.
• consists of one or more physical data files.
• provide a means to physically locate data on storage. When you define the data files
that comprise a tablespace, you specify a storage location for these files.
• The backup and recovery features of Oracle Database enable you to back up or
recover at the tablespace level.
47
Logical storage units
48
Some tablespaces included in the database
Tablespace Description
EXAMPLE This tablespace contains the sample schemas that are included with Oracle Database. The sample schemas provide a common
platform for examples. Oracle documentation and educational materials contain examples based on the sample schemas.
SYSTEM This tablespace is automatically created at database creation. Oracle Database uses it to manage the database. It contains the data
dictionary, which is the central set of tables and views used as a read-only reference for a particular database. It also contains various
tables and views that contain administrative information about the database. These are all contained in the SYS schema, and can be
accessed only by the SYS user or other administrative users with the required privilege.
SYSAUX This is an auxiliary tablespace to the SYSTEM tablespace.
The SYSAUX tablespace contains data for some components and products, reducing the load on the SYSTEM tablespace. Every
database using Oracle Database 10g release 1 (10.1) or later must have a SYSAUX tablespace.
Components that use SYSAUX as their default tablespace during installation include Automatic Workload Repository, Oracle Streams,
and Oracle Text. For more information, see Oracle Database Administrator's Guide.
TEMP This tablespace stores temporary data generated when processing SQL statements. For example, this tablespace would be used for
query sorting. Every database should have a temporary tablespace that is assigned to users as their temporary tablespace. In the
preconfigured database, the TEMP tablespace is specified as the default temporary tablespace. If no temporary tablespace is specified
when a user account is created, then Oracle Database assigns this tablespace to the user.
UNDOTBS1 This is the undo tablespace used by the database to store undo information. See "Managing Undo Data" to understand how an Oracle
database uses the undo tablespace. Every database must have an undo tablespace.
USERS This tablespace is used to store permanent user objects and data. Similar to the TEMP tablespace, every database should have a
tablespace for permanent user data that is assigned to users. Otherwise, user objects will be created in the SYSTEM tablespace, which
is not good practice. In the preconfigured database, USERS is designated as the default tablespace for all new users.
49
Data dictionary
read-only set of tables and views that provides
information about the database
SYSTEM
Stored in the
SYSTEM tablespace,
probably in the SYS
schema
A data dictionary contains:
• The definitions of all schema objects in the database (tables,
views, indexes, clusters, synonyms, sequences, procedures,
functions, packages, triggers, and so on)
• How much space has been allocated for, and is currently used by,
the schema objects (*except for locally managed tablespaces I guess)
• Default values for columns
• Integrity constraint information
• The names of Oracle Database users
• Privileges and roles each user has been granted
• Auditing information, such as who has accessed or updated
various schema objects
• Other general database information
50
Locally managed tablespaces
Locally managed tablespaces keep the space allocation
information within the tablespace, not in the data
dictionary, thus offering better performance. By default,
Oracle Database sets all newly created tablespaces to
be locally managed with automatic segment
management (a feature that further improves
performance).
For a table to be recoverable using Flashback Drop, it must
reside in a locally managed tablespace.
Locally managed
tablespace
51
3 types of tablespaces
A database running in automatic undo
management mode transparently creates and
manages undo data in the undo tablespace.
Oracle Database uses undo data to:
• roll back transactions,
• provide read consistency,
• help with database recovery,
• enable features such as Oracle Flashback Query
and Oracle Flashback Table.
A database instance can have only one active
undo tablespace.
The database maintains and automatically tunes
an undo retention period. Committed undo data
whose age is less than the undo retention period
is retained for use by queries or Oracle Flashback
operations. 1
Used for storing temporary data, as would be
created when SQL statements perform sort
operations.
An Oracle database gets a temporary
tablespace when the database is created. You
would create another temporary tablespace if
you were creating a temporary tablespace group.
Under typical circumstances, you do not have to
create additional temporary tablespaces. If you
have an extremely large database, then you
might configure additional temporary
tablespaces.
The physical files that comprise a temporary
tablespace are called tempfiles, as opposed to
data files.
The TEMP tablespace is typically used as the
default temporary tablespace for users who are
not explicitly assigned a temporary tablespace.
[1,*]
Permanent
You use permanent tablespaces to store your user
and application data. Oracle Database uses
permanent tablespaces to store permanent data,
such as system data. Each user is assigned a default
permanent tablespace.
52
Password file
A database can use a password file to authenticate administrative users with SYSDBA, SYSOPER, and SYSBACKUP privileges. A password file is required for remote connections to
the database with any of these privileges. These privileges enable a DBA to start and shut down the database, back up and recover the database, and perform other high-level
administrative tasks. This password file is outside of the database itself, thereby enabling the authentication of a DBA when the database is not yet started. (A DBA must
authenticate before starting the database.)
When you invoke DBCA as part of the Oracle Database installation process, DBCA creates a password file with one entry: the SYS user. Granting SYSDBA, SYSOPER,
or SYSBACKUP to a user adds that user to the password file automatically.
Note:
Oracle Database can also use operating system authentication to authenticate users with the SYSDBA, SYSOPER, and SYSBACKUPprivileges. Operating system authentication
takes precedence over password file authentication
Users and roles
53
54
Users
For users to access your database, you must create user accounts and grant appropriate database
access privileges to those accounts. A user account is identified by a user name, and defines the
attributes of the user, including the following:
• Authentication method
• Password for database authentication
• Default tablespaces for permanent and temporary data storage
• Tablespace quotas
• Account status (locked or unlocked)
• Password status (expired or not)
When you create a user account, you must not only assign:
• a user name, a password, default tablespaces for the account,
• Grant the appropriate system privileges, object privileges, and roles to the account.
• If the user will be creating database objects, then give the user account a space usage quota on
each tablespace in which the objects will be created.
55
Schema = user
When you create a user account, you are also implicitly creating a schema for that user. A schema is a logical
container for the database objects (such as tables, views, triggers, and so on) that the user creates.
The schema name is the same as the user name, and can be used to unambiguously refer to objects owned
by the user. For example, hr.employees refers to the table named employees in the hr schema. (The
employees table is owned by hr.)
The terms database object and schema object are used interchangeably.
When you delete a user, you must either simultaneously delete all schema objects of that user, or you must
have previously deleted the schema objects in separate operations.
User privileges
The main types of user privileges are as follows:
• System privileges—A system privilege gives a user the ability to perform a particular action, or to perform an action on any
schema objects of a particular type. For example, the system privilege CREATE TABLE permits a user to create tables in the
schema associated with that user, and the system privilege CREATE USER permits a user to create database users.
• Object privileges—An object privilege gives a user the ability to perform a particular action on a specific schema object. Different
object privileges are available for different types of schema objects. The privilege to select rows from the EMPLOYEES table or to
delete rows from the DEPARTMENTS table are examples of object privileges.
56
System privileges vs Object privileges
User common roles
57
Role Name Description
CONNECT Enables a user to connect to the database. Grant this role to any user or application that needs database access.
RESOURCE Enables a user to create, modify, and delete certain types of schema objects in the schema associated with that user.
Grant this role only to developers and to other users that must create schema objects. This role grants a subset of the
create object system privileges. For example, it grants the CREATE TABLE system privilege, but does not grant
the CREATE VIEW system privilege. It grants only the following privileges: CREATE CLUSTER, CREATE
INDEXTYPE, CREATE OPERATOR, CREATE PROCEDURE, CREATE SEQUENCE, CREATE TABLE, CREATE
TRIGGER, CREATE TYPE.
DBA Enables a user to perform most administrative functions, including creating users and granting privileges; creating and
granting roles; creating, modifying, and deleting schema objects in any schema; and more. It grants all system
privileges, but does not include the privileges to start or shut down the database instance. It is by default granted to
users SYS and SYSTEM.
Three widely used roles that are predefined in Oracle Database:
58
Roles and privileges
User
Role
Privilege
*
*
*
*
*
1
SYS and SYSTEM users
• SYS: Granted roles: DBA . Granted privilege: SYSDBA (all high level admin
tasks such as backup and recovery)
• SYSTEM: Granted roles: DBA (all admin functions except backup &
recovery, and DB upgrade)
59
SYSDBA and SYSOPER are system privileges
60
Part 8
61
Schema
62
Schema
63
Oracle Database stores a schema object logically within a tablespace. There is no relationship between schemas and tablespaces: a
tablespace can contain objects from different schemas, and the objects for a schema can be contained in different tablespaces. The
data of each object is physically contained in one or more data files.
Tablespace 1
hr.object6
leo.object2
Tablespace 2
hr.object3
leo.object4
Data
filesData
filesData
filesData
filesData
file
Datafiles of the tablespace1
The data of each object is physically
contained in one or more data files.
Schema object types
64
The principal types of schema objects are:
• Tables : A table stores data in rows. Tables are the most important schema objects in a relational database.
• Indexes: Indexes are schema objects that contain an entry for each indexed row of the table or table cluster and provide direct, fast
access to rows. Oracle Database supports several types of index. An index-organized table is a table in which the data is stored in an
index structure.
• Partitions: Partitions are pieces of large tables and indexes. Each partition has its own name and may optionally have its own storage
characteristics.
• Views: Views are customized presentations of data in one or more tables or other views. You can think of them as stored queries. Views
do not actually contain data.
• Sequences: A sequence is a user-created object that can be shared by multiple users to generate integers. Typically, you use sequences
to generate primary key values.
• Dimensions: A dimension defines a parent-child relationship between pairs of column sets, where all the columns of a column set must
come from the same table. Dimensions are commonly used to categorize data such as customers, products, and time.
• Synonyms: A synonym is an alias for another schema object. Because a synonym is simply an alias, it requires no storage other than its
definition in the data dictionary.
• PL/SQL subprograms and packages: PL/SQL is the Oracle procedural extension of SQL. A PL/SQL subprogram is a named PL/SQL
block that can be invoked with a set of parameters. A PL/SQL package groups logically related PL/SQL types, variables, and
subprograms.
Other types of objects are also stored in the database and can be created and manipulated with SQL statements but are not contained in a
schema. These objects include database user account, roles, contexts, and dictionary objects.
Tables
1. relational table: structured with simple columns. It is the most common type. You can build relational
tables in either:
• heap structures: the rows are not stored in any particular order.
• index-organized structures: the row order is determined by the values in one or more selected columns.
For some applications, index-organized tables provide enhanced performance and more efficient use of disk space.
2. object tables
3. XMLType tables
Any of the three can be defined as permanent or temporary tables. Temp tables hold session-private data
that exists only for the duration of a transaction or session.
65
Three types of tables
Static Data Dictionary Views
The data dictionary views are called static views because they change
infrequently, only when a change is made to the data dictionary. Examples of
data dictionary changes include creating a new table or granting a privilege to a
user.
Many data dictionary tables have three corresponding views:
• DBA_ : displays all relevant information in the entire database.
• ALL_ : displays all the information accessible to the current user, including
information from the schema of the current user, and information from
objects in other schemas, if the current user has access to those objects
• USER_ : displays all the information from the schema of the current user
• Dynamic performance views
(v$)
Monitor ongoing database activity. They are available
only to administrators. The names of dynamic
performance views start with the characters V$.
66
Views
2 types of views
Backups and recovery
67
68
Files backed-up by RMAN
Data
filesData
filesData
filesData file
Archived redo log
Control file
010011
SPFILE
I think the reason why this list doesn’t include online
redo logs (active or inactive) is because they can be
multiplexed (thus recoverable in case of hadware
failure, without relying on backups).
69
Connect as TARGET
Backup and recovery of the CDB
$rman target '“leo as sysbackup"‘
Or
leopold@hostname ~$ rman target /
The DB user leo has SYSBACKUP (or SYSDBA) privilege
You can connect to the root in one of the following ways:
• Connect using OS authentication
You are connected to the root as the SYS user with the SYSDBA
privilege.
• Connect locally as a common user (Leo: i.e. DB user; as opposed to OS user,
belonging to a group which has been mapped with SYSDBA or SYSBACKUP privilege)
• Connect as a common user through Oracle Net Services (you can
connect with RMAN to a target on another host)
The OS user leopold is in the OSBACKUPDBA group (typically the
backupdba group on UNIX and Linux systems).
When you do not explicitly specify SYSDBA or SYSBACKUP, you are
connected to the target database with the SYSDBA privilege.
70
Restoring vs Recovering
Backups mediums
Data
filesData
filesData
files
Data
files
Archived redo log
Control file
010011
SPFILE
Restore: copy the physical files that comprise the database from a
backup medium to their original or to new locations.
Database recovery: the process of updating database files
restored from a backup, with the changes made to the
database after the backup. This updating is done by applying
incremental backups and redo logs to the restored files. Δ
Incremetal
backups
(only level 1?)
71
RMAN Repository
a record of database files and backups for each database on which RMAN performs
operations.
RMAN uses the repository metadata to choose the most efficient backups needed for a
restore and recovery.
RMAN can restore files only if they are recorded in the RMAN repository.
Control file
RMAN’s
metadata
repo
I think it is usually stored in the
control file of the backed up DB.
72
Schema of a separate DB used for storing the RMAN repos of other DBs
Recovery catalog
RMAN’s
metadata
repo
RMAN’s
metadata
repo
RMAN’s
metadata
repo
Recovery catalog (schema)
In some installations, a second copy of the RMAN repository is stored in a schema called the
recovery catalog. The recovery catalog is located in a separate database and can store
metadata for multiple target databases.
It is recommended that you use a recovery catalog. Because a recovery catalog stores
metadata history for longer than the control file, you can perform a recovery that goes
further back in time than the history in the control file. Also, if the target control file and all
backups are lost, then the RMAN metadata in the recovery catalog can be used.
Image Copies:
Exact byte-for-byte copies of the files (like a “cp”
command); and those copies are recorded in the
RMAN repository. I think that 1 datafile => 1 image
copy
• Can only be created on disk
• cannot use all RMAN features,
• but you can apply incremental backups(Leo: level 1) to
them(Leo: level 0) (synthetic full backups)
• and you can use them directly in place without
first copying them, for very fast restores.
Backup Sets:
Logical entities produced by the RMAN BACKUP
command.
73
Image copies vs Backup sets
Backups created by RMAN can be stored either as:
Backup
pieceBackup
pieceBackup
piece
Backup set
Backup
pieceBackup
pieceBackup
piece
Backup set
produces
RMAN-specific format
• RMAN uses unused block
compression to save space in
backing-up data files.
• Backup sets can also be
compressed, encrypted, sent to
tape, and use advanced unused-
space compression.
• Level 1 incremental backups can
only be backup sets
Full backups and level 0 incremental backups can be either image copies or backup sets,
but image copies cannot be on tape.
Unused space compression
RMAN backs up only the blocks that contain data.
1. Only available with Backups Sets
2. I think it’s a built-in behavior, that doesn’t
need to be configured
Backup optimization
excludes unchanged files, such as read-only files
and offline data files, that were previously
backed up.
1. I think it is also available for image copies.
2. Activate it with
CONFIGURE BACKUP OPTIMIZATION
ON;
74
Unused space compression VS Backup optimization
Full backup
• includes all used blocks of the data file.
• can be either an image copy or backup set.
Incremental backup
• Level 0: the same as full backup; but is the
starting point for an incremental backup strategy.
• Level 1: copies only blocks that have changed
since the previous level 0 or level 1 incremental
backup.
Level 1 backups can be:
• Cumulative: all blocks changed since the most recent level
0 backup are included
• Differential: only blocks changed since the most recent
level 0 or level 1 backup (if one has been performed yet)
are included.
Level 1 backups can only be backup sets.
75
Full backups vs Incremental backups
76
Sum up
Backup
pieceBackup
pieceBackup
piece
Backup set
Full backup
Level 0 incr backup
Level 1 incr backup
OR
OR
Images copies cannot use all RMAN features,
but you can use them directly in place
without first copying them, for very fast
restores.
Incremental Backups
77
Block-Change Tracking (Optional)
Block changing tracking improves the performance of incremental backups by recording changed blocks in the
block change tracking file. During an incremental
backup, instead of scanning all data blocks to identify which blocks have changed, RMAN uses this file to identify
the changed blocks that need to be backed up.
Block-change-tracking file.chg
- Block xxx in
datafile yyy
changed
- ….
Consistent
• i.e. when backed up, the data files were in a
transaction-consistent state; meaning that all
committed changes had been written from
the SGA to the data files. For this not to be
just “luck”, the backups must be performed
while the DB is shut down.
=> When you restore the data files, the DB can
be opened immediately
Inconsistent
• Backups performed on data files where the
some committed transactions had not been
written (because they were still in the SGA).
E.g. the DB was open during the backup.
• Using archived redo logs ,<?> and then the online
redo logs (which are multiplexed)</?>, you can
recover the DB (i.e. make the restored
datafiles consistent); to be able to open the
DB.
78
Consistent vs Inconsistent backups
Leo: But what if the data files are at a more
advanced state than what is recorded in the
archived/online redo logs ? It’s hard to roll back
without the undo files… I assume that RMAN makes
sure that online/archived redo logs are always
as/more advanced as/than the data files it backs up.
I think it is implied “[in]consistent with the <?>online or archived ? </?> redo logs”.
Media recovery
• It is the process by which inconsistent data files are made consistent with the archived and online redo
logs.
• requires a control file, data files (typically restored from backup), and online and archived redo log files
containing changes since the time the data files were backed up.
• Media recoveries an be of two types:
• Complete recovery can apply to individual datafiles, tablespaces, or the entire database.
You restore backup data files and apply all changes from the archived and online redo log files to the data files.
• Point-in-time recovery applies to the whole database (and also sometimes to individual tablespaces, with
automation help from RMAN).
You return a database to its contents at a user-selected time in the past. You restore a backup of data files
created before the target time and a complete set of archived redo log files from backup creation through the
target time.
• RMAN enables you to perform both a complete and a point-in-time recovery of your database.
79
Fast Recovery Area
• an Oracle-managed {file system directory, or ASM disk group} that provides a centralized storage location for:
• backup files (image copies or backup sets)
• and recovery files (archived redo logs and flashback logs).
• Oracle Database automatically manages this storage, deleting files that are no longer needed (based on the
retention policy window set for backups –which I believe is not specific to the FRA- : CONFIGURE RETENTION
POLICY TO RECOVERY WINDOW OF 31 DAYS).
• When you issue the RMAN BACKUP command without specifying a backup destination, RMAN automatically
backs up to the fast recovery area if it is configured.
• You may specify it as an archived redo log file destination.
• also acts as a disk cache for tape. You may also periodically copy backups to tape in order to free space for other
files.
• Even after files in the fast recovery area are obsolete (according to the retention policy), they are typically not
deleted until space is needed for new files. If space permits, files recently moved to tape remain on disk to avoid
restoring them from tape for a recovery.
80
Flashback logs
81
For the Flashback Database feature
Oracle instance
(identified by the SID and global database name)
= background processes
Fast Recovery Area
Flashback logs
images of data blocks
Occasionally logs images of data blocks
Automatically creates, deletes, and
resizes the flashback logs.
Archived redo log
You can specify the length of the desired flashback window (in
minutes). The default value is one day.
Backups to tape and media managers
• For tape backups, on most platforms, you must integrate a media manager with the Oracle database to
use sequential media for storage.
• You can use Oracle Secure Backup, which supports both database and file system backups to tape, as
your media manager. Oracle Secure Backup is an SBT interface, and provides services for RMAN. You
can also use third-party SBT interfaces.
• Oracle DB Cloud Backup Module (for OCI- Object Storage Classic)is an SBT interface too
83
E.g. Oracle Secure Backup
RMAN
SBT interface (teaches
RMAN how to use
sequential media)
Rolling forward image copies of datafiles
84
Updating level 0 image copies over time, using level 1 backup sets
Backup
pieceBackup
pieceBackup
piece
Backup set
Level 1 incr backup
You do this frequently, in order to keep the image
copies as up to date as possible; so that you don’t have
to apply too many differential level 1 backups if you
need to perform a DB restore & recovery.
Δ
Note: this can only be done on disk, as image copies are only supported on disk
86
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
Day 1
Job day 1: RMAN creates a
level 0 image copy for each
data file
Day 2 Day 3 time
87
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
Day 1
Job day 1: RMAN creates a
level 0 image copy for each
data file
Archived redo logs are created
in the FRA
Day 2 Day 3 time
88
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
Day 1
Job day 1: RMAN creates a
level 0 image copy for each
data file
Archived redo logs are created
in the FRA
Day 2 Day 3
Job day 2: RMAN creates a
differential incr backup level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
time
89
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
Day 1
Job day 1: RMAN creates a
level 0 image copy for each
data file
Archived redo logs are created
in the FRA
Day 2 Day 3
Job day 2: RMAN creates a
differential incr backup level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
time
Archived redo logs are created
in the FRA
90
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
Day 1
Job day 1: RMAN creates a
level 0 image copy for each
data file
Archived redo logs are created
in the FRA
Day 2 Day 3
Job day 2: RMAN creates a
differential incr backup level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
Job day 3: RMAN
creates a new
differential incr backup
level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
time
Archived redo logs are created
in the FRA
91
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
Day 1
Job day 1: RMAN creates a
level 0 image copy for each
data file
Archived redo logs are created
in the FRA
Day 2 Day 3
Job day 2: RMAN creates a
differential incr backup level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
Job day 3: RMAN
creates a new
differential incr backup
level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
time
Archived redo logs are created
in the FRA
Archived redo logs are created
in the FRA
92
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
Day 1
Job day 1: RMAN creates a
level 0 image copy for each
data file
Archived redo logs are created
in the FRA
Day 2 Day 3
Job day 2: RMAN creates a
differential incr backup level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
Job day 3: RMAN
creates a new
differential incr backup
level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
time
Archived redo logs are created
in the FRA
Archived redo logs are created
in the FRA
And so on…
93
Day 1
Job day 1: RMAN creates a
level 0 image copy for each
data file
Day 2 Day 3
Job day 2: RMAN creates a
differential incr backup level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
Δ
Job day 8: RMAN
applies Day 2’s level
1
Job day 3: RMAN
creates a new
differential incr backup
level 1
time
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
94
Day 1 Day 2 Day 3
Job day 2: RMAN creates a
differential incr backup level 1
Job day 8: RMAN
applies Day 2’s level
1
Job day 3: RMAN
creates a new
differential incr backup
level 1
time
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
95
Day 1 Day 2 Day 3
Job day 2: RMAN creates a
differential incr backup level 1
Job day 8: RMAN
applies Day 2’s level
1
Job day 3: RMAN
creates a new
differential incr backup
level 1
Backup
pieceBackup
pieceBackup
piece
Backup set
Job day 9: RMAN
applies Day 3’s
level 1
Δ
time
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
96
Day 1 Day 2 Day 3
Job day 2: RMAN creates a
differential incr backup level 1
Job day 8: RMAN
applies Day 2’s level
1
Job day 3: RMAN
creates a new
differential incr backup
level 1
Job day 9: RMAN
applies Day 3’s
level 1
time
Oracle Suggested Strategy for disk
Rolling forward image copies of datafiles
Validate datafiles and backups
The main purpose of RMAN validation is to check for corrupt blocks and missing files. You can also use RMAN to
determine whether backups can be restored.
• The VALIDATE DATAFILE command validates the backup for a specific datafile. The VALIDATE command determines
whether the backup exists and is not corrupted.
• You can run RESTORE ... VALIDATE to test whether RMAN can restore a specific file or set of files from a backup.
RMAN chooses which backups to use.
• To determine if the whole database can be restored: RESTORE VALIDATE DATABASE;
• To determine if a datafile can be restored to a specified SCN: RESTORE DATAFILE 1 VALIDATE UNTIL SCN 23456;
• To determine if the datafiles for the specified tablespace can be restored : RESTORE TABLESPACE VALIDATE;
98
Checks whether the backups are intact, and can be used.
Cross-checking
Checking whether backups listed in the RMAN repository exist and are accessible, and
marking as expired any backups not accessible at the time of the cross-check.
Backup recorded in the RMAN repository has one of the following status values:
• Available: the backup is still present on disk or tape, as recorded in the repository
• Expired: the backup no longer exists on disk or tape, but is still listed in the repository
• Unavailable: the backup is temporarily not available for data recovery operations
(because, for example, it is stored on a tape that is stored offsite or on a disk that is
currently not mounted)
• Obsolete: based on the currently configured retention policy.
99
Oracle advised recovery
The Oracle advised recovery feature uses Data Recovery Advisor, which is
an Oracle Database feature that:
• automatically diagnoses data failures,
• determines and presents appropriate repair options,
• and performs repairs if requested by the user.
In the example here, it restores from backups a data file that was
unintentionally deleted
100
Flashback
101
Rewind recent changes
Flashback table Flashback drop Flashback database
Description Rewind rows Recover deleted tables Rewind DB files, but faster
than a point-in-time
recovery
Can the DB stay open ? Yes Yes No
Logical level ? Yes Yes No, physical level
What makes it possible ? undo data (stored in the
undo tablespace).
“The user’s”* recycling bin Flashback logs (and a bit of
archived logs)
And what is the retention
period ?
The retention period of
undo data is decided
dynamically by the instance
I think it is unlimited, until
you purge the recycling bin
The default value for
flashback logs is 1 day, but
you can change it
Flashback
• Rewind accidental deletion or adding of row in one or more tables.
• Unlike a point-in-time recovery, the DB remains open during the flashback
• Uses undo data (from the undo tablespace). Its retention period is
automatically tuned by the DB instance.
• Before you use Flashback Table, you must ensure that row movement is enabled on the table you’re rewinding.
Row movement indicates that rowids will change after the flashback occurs. This restriction exists because if rowids
before the flashback were stored by an application, then there is no guarantee that the rowids will correspond to
the same rows after the flashback.
102
Flashback table
Flashback
• return a dropped table to the database along with dependent objects
such as indexes and triggers.
• This feature stores dropped objects in a recycle bin, from which they can
be retrieved until the recycle bin is purged, either explicitly or because
space is needed.
• You can do all this while the DB is available.
• For a table to be recoverable using Flashback Drop, it must reside in a locally managed tablespace. Also,
you cannot recover tables in the SYSTEM tablespaces (Leo: probably because the Data Dictionary is in
this tablespace)
• If the retrieved table had referential constraints before it was placed in the recycle bin, then you must
re-create them manually. The recycle bin does not preserve referential constraints on a table.
103
Flashback Drop Stores (logically) dropped tables
Flashback
104
Flashback Database
Fast Recovery Area
Flashback logs
images of data blocks
Archived redo log
Data file
Data file
also uses some data in the archived redo log
The result is similar to database point-in-time recovery, but
Flashback Database can be much faster because it does not
require you to restore and recover data files.
10 -Monitoring
105
• Wait classes are groupings of wait events based on the type of wait.
• User I/O means that the workload originating from the user causes the database to read data from disk
or write data to disk.
• SQL statements are monitored only if they have consumed at least 5 seconds of CPU or I/O time.
• An incident is an occurrence of a critical error in the database. Each incident is recorded in the
Automatic Diagnostic Repository (ADR), a directory structure located outside the database, which is
available for problem diagnosis even when the database is down. You can investigate critical errors
using the ADR Command Interpreter (ADRCI) utility.
106
SQL Tuning Advisor may suggest
• Creating SQL profiles (a collection of information that enables the query
optimizer to create an optimal execution plan for a SQL statement). A SQL
profile contains additional SQL statistics that are specific to the SQL
statement and enable the query optimizer to generate a significantly
better execution plan at run time.
• Creating new indexes
• Refreshing the optimizer statistics
• Restructuring the SQL statement
107
11- PDBs
108
• PDB: a portable collection of schemas, schema objects, and nonschema
objects that appear to an Oracle Net client as a separate database.
109

More Related Content

What's hot

Backup & recovery with rman
Backup & recovery with rmanBackup & recovery with rman
Backup & recovery with rmanitsabidhussain
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture pptDeepak Shetty
 
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESLudovico Caldara
 
How many ways to monitor oracle golden gate - OOW14
How many ways to monitor oracle golden gate - OOW14How many ways to monitor oracle golden gate - OOW14
How many ways to monitor oracle golden gate - OOW14Bobby Curtis
 
Rman Presentation
Rman PresentationRman Presentation
Rman PresentationRick van Ek
 
Oracle Database performance tuning using oratop
Oracle Database performance tuning using oratopOracle Database performance tuning using oratop
Oracle Database performance tuning using oratopSandesh Rao
 
Step By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business IntelligenceStep By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business IntelligenceOsama Mustafa
 
Shell Scripts for Oracle Database and E-Business Suite.pdf
Shell Scripts for Oracle Database and E-Business Suite.pdfShell Scripts for Oracle Database and E-Business Suite.pdf
Shell Scripts for Oracle Database and E-Business Suite.pdfAkhashRamnath
 
Oracle RDBMS architecture
Oracle RDBMS architectureOracle RDBMS architecture
Oracle RDBMS architectureMartin Berger
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsAnil Nair
 
15 Troubleshooting tips and Tricks for Database 21c - KSAOUG
15 Troubleshooting tips and Tricks for Database 21c - KSAOUG15 Troubleshooting tips and Tricks for Database 21c - KSAOUG
15 Troubleshooting tips and Tricks for Database 21c - KSAOUGSandesh Rao
 
The Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationThe Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationMarkus Michalewicz
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop Sandesh Rao
 
Understanding oracle rac internals part 1 - slides
Understanding oracle rac internals   part 1 - slidesUnderstanding oracle rac internals   part 1 - slides
Understanding oracle rac internals part 1 - slidesMohamed Farouk
 
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz
 
Reading AWR or Statspack Report - Straight to the Goal
Reading AWR or Statspack Report - Straight to the GoalReading AWR or Statspack Report - Straight to the Goal
Reading AWR or Statspack Report - Straight to the GoalFranck Pachot
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insightsKirill Loifman
 
Backup and Restore of database on 2-Node RAC
Backup and Restore of database on 2-Node RACBackup and Restore of database on 2-Node RAC
Backup and Restore of database on 2-Node RACPaulo Fagundes
 
SQL Server Database Backup and Restore Plan
SQL Server Database Backup and Restore PlanSQL Server Database Backup and Restore Plan
SQL Server Database Backup and Restore PlanHamid J. Fard
 

What's hot (20)

Backup & recovery with rman
Backup & recovery with rmanBackup & recovery with rman
Backup & recovery with rman
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture ppt
 
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
 
SQL Tuning 101
SQL Tuning 101SQL Tuning 101
SQL Tuning 101
 
How many ways to monitor oracle golden gate - OOW14
How many ways to monitor oracle golden gate - OOW14How many ways to monitor oracle golden gate - OOW14
How many ways to monitor oracle golden gate - OOW14
 
Rman Presentation
Rman PresentationRman Presentation
Rman Presentation
 
Oracle Database performance tuning using oratop
Oracle Database performance tuning using oratopOracle Database performance tuning using oratop
Oracle Database performance tuning using oratop
 
Step By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business IntelligenceStep By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business Intelligence
 
Shell Scripts for Oracle Database and E-Business Suite.pdf
Shell Scripts for Oracle Database and E-Business Suite.pdfShell Scripts for Oracle Database and E-Business Suite.pdf
Shell Scripts for Oracle Database and E-Business Suite.pdf
 
Oracle RDBMS architecture
Oracle RDBMS architectureOracle RDBMS architecture
Oracle RDBMS architecture
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
 
15 Troubleshooting tips and Tricks for Database 21c - KSAOUG
15 Troubleshooting tips and Tricks for Database 21c - KSAOUG15 Troubleshooting tips and Tricks for Database 21c - KSAOUG
15 Troubleshooting tips and Tricks for Database 21c - KSAOUG
 
The Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - PresentationThe Oracle RAC Family of Solutions - Presentation
The Oracle RAC Family of Solutions - Presentation
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop
 
Understanding oracle rac internals part 1 - slides
Understanding oracle rac internals   part 1 - slidesUnderstanding oracle rac internals   part 1 - slides
Understanding oracle rac internals part 1 - slides
 
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
 
Reading AWR or Statspack Report - Straight to the Goal
Reading AWR or Statspack Report - Straight to the GoalReading AWR or Statspack Report - Straight to the Goal
Reading AWR or Statspack Report - Straight to the Goal
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insights
 
Backup and Restore of database on 2-Node RAC
Backup and Restore of database on 2-Node RACBackup and Restore of database on 2-Node RAC
Backup and Restore of database on 2-Node RAC
 
SQL Server Database Backup and Restore Plan
SQL Server Database Backup and Restore PlanSQL Server Database Backup and Restore Plan
SQL Server Database Backup and Restore Plan
 

Similar to Leo's notes - Oracle DBA 2 Days

Oracle Instance Architecture.ppt
Oracle Instance Architecture.pptOracle Instance Architecture.ppt
Oracle Instance Architecture.pptHODCA1
 
Less14 Br Concepts
Less14 Br ConceptsLess14 Br Concepts
Less14 Br Conceptsvivaankumar
 
Exploring the Oracle Database Architecture.ppt
Exploring the Oracle Database Architecture.pptExploring the Oracle Database Architecture.ppt
Exploring the Oracle Database Architecture.pptMohammedHdi1
 
exploring-the-oracle-database-architecture.ppt
exploring-the-oracle-database-architecture.pptexploring-the-oracle-database-architecture.ppt
exploring-the-oracle-database-architecture.pptAmitavaRoy49
 
Oracle apps dba training dba technologies
Oracle apps dba training   dba technologiesOracle apps dba training   dba technologies
Oracle apps dba training dba technologiessanind88
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentationVimlendu Kumar
 
High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2Mario Redón Luz
 
Extreme replication at IOUG Collaborate 15
Extreme replication at IOUG Collaborate 15Extreme replication at IOUG Collaborate 15
Extreme replication at IOUG Collaborate 15Bobby Curtis
 
What is active directory
What is active directoryWhat is active directory
What is active directoryrajasekar1712
 
Data guard logical_r3.1
Data guard logical_r3.1Data guard logical_r3.1
Data guard logical_r3.1Ram Naani
 
[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery[Altibase] 13 backup and recovery
[Altibase] 13 backup and recoveryaltistory
 
Oracle dataguard overview
Oracle dataguard overviewOracle dataguard overview
Oracle dataguard overviewaguswahyudi09
 
Colvin RMAN New Features
Colvin RMAN New FeaturesColvin RMAN New Features
Colvin RMAN New FeaturesEnkitec
 

Similar to Leo's notes - Oracle DBA 2 Days (20)

Introduction to oracle
Introduction to oracleIntroduction to oracle
Introduction to oracle
 
Oracle architecture
Oracle architectureOracle architecture
Oracle architecture
 
Oracle Instance Architecture.ppt
Oracle Instance Architecture.pptOracle Instance Architecture.ppt
Oracle Instance Architecture.ppt
 
Oracle11g notes
Oracle11g notesOracle11g notes
Oracle11g notes
 
Less14 Br Concepts
Less14 Br ConceptsLess14 Br Concepts
Less14 Br Concepts
 
Exploring the Oracle Database Architecture.ppt
Exploring the Oracle Database Architecture.pptExploring the Oracle Database Architecture.ppt
Exploring the Oracle Database Architecture.ppt
 
exploring-the-oracle-database-architecture.ppt
exploring-the-oracle-database-architecture.pptexploring-the-oracle-database-architecture.ppt
exploring-the-oracle-database-architecture.ppt
 
Oracle apps dba training dba technologies
Oracle apps dba training   dba technologiesOracle apps dba training   dba technologies
Oracle apps dba training dba technologies
 
App D
App DApp D
App D
 
IMSDB - DBRC
IMSDB - DBRCIMSDB - DBRC
IMSDB - DBRC
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentation
 
High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2
 
Extreme replication at IOUG Collaborate 15
Extreme replication at IOUG Collaborate 15Extreme replication at IOUG Collaborate 15
Extreme replication at IOUG Collaborate 15
 
What is active directory
What is active directoryWhat is active directory
What is active directory
 
Data guard logical_r3.1
Data guard logical_r3.1Data guard logical_r3.1
Data guard logical_r3.1
 
[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery
 
Oracle dataguard overview
Oracle dataguard overviewOracle dataguard overview
Oracle dataguard overview
 
ORACLE ARCHITECTURE
ORACLE ARCHITECTUREORACLE ARCHITECTURE
ORACLE ARCHITECTURE
 
Colvin RMAN New Features
Colvin RMAN New FeaturesColvin RMAN New Features
Colvin RMAN New Features
 
Oracle 10g Introduction 1
Oracle 10g Introduction 1Oracle 10g Introduction 1
Oracle 10g Introduction 1
 

More from Léopold Gault

Containers and Kubernetes -Notes Leo
Containers and Kubernetes -Notes LeoContainers and Kubernetes -Notes Leo
Containers and Kubernetes -Notes LeoLéopold Gault
 
Leo's Notes about Apache Kafka
Leo's Notes about Apache KafkaLeo's Notes about Apache Kafka
Leo's Notes about Apache KafkaLéopold Gault
 
Application Continuity with Oracle DB 12c
Application Continuity with Oracle DB 12c Application Continuity with Oracle DB 12c
Application Continuity with Oracle DB 12c Léopold Gault
 

More from Léopold Gault (7)

OAuth OpenID Connect
OAuth OpenID ConnectOAuth OpenID Connect
OAuth OpenID Connect
 
SAML
SAMLSAML
SAML
 
Notes leo kafka
Notes leo kafkaNotes leo kafka
Notes leo kafka
 
Containers and Kubernetes -Notes Leo
Containers and Kubernetes -Notes LeoContainers and Kubernetes -Notes Leo
Containers and Kubernetes -Notes Leo
 
NoSQL - Leo's notes
NoSQL - Leo's notesNoSQL - Leo's notes
NoSQL - Leo's notes
 
Leo's Notes about Apache Kafka
Leo's Notes about Apache KafkaLeo's Notes about Apache Kafka
Leo's Notes about Apache Kafka
 
Application Continuity with Oracle DB 12c
Application Continuity with Oracle DB 12c Application Continuity with Oracle DB 12c
Application Continuity with Oracle DB 12c
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Leo's notes - Oracle DBA 2 Days

  • 1. Leo’s notes from Database 2 Day DBA 1 • Those slides are Leopold Gault's personal notes and drawings, when reading Database 2 Day DBA • You may ask me for the original file (with animations) at galeopold@gmail.com
  • 2.
  • 3. 3 Oracle Database components Oracle software Meta data Control file User data database Oracle instance (identified by the SID and global database name) = background processesMetadata: collection of information that permits the Oracle software to manage user data. {access, store, monitor, recover} Server processes (dedicated or shared) Executes SQL Oracle Net (software) -> Net listener (process) Client app with connection object ensure the {integrity, availability, recoverability} of user data Control structures (a.k.a. control files) Online redo logs
  • 4. 4 Database system = DB + Oracle instance Oracle instance (identified by the SID and global database name) = background processes Database system Meta data Control file User data database Control structures (a.k.a. control files) Online redo logs +
  • 5. 5 Writing data to disk: OS filesystem vs ASM Database files OS filesystem XOR Oracle ASM ASM disk groups Oracle ASM performs software striping and mirroring at the file level ASM instance (one per machine)configures and manages disk groups Metada ta Control file User data Control structures (a.k.a. control files) Online redo logs
  • 6. 6 Mapping of OS user groups with DB privileges OS user group OS user name dba leo dba Pape oper Alexis oper Guillaume Oper Oliver OSBACKUPDBA Marcos Type of DB access (privilege) Mapped to OS user group SYSDBA dba SYSOPER oper SYSBACKUP OSBACKUPDBA Oracle instance (identified by the SID and global database name) = background processes Such mapping will allow leo and Pape to connect to the DB using OS logging: >sqlplus SYS as SYSDBA
  • 7. 7 ORACLE_BASE helps to facilitate the organization of multiple Oracle software installations Usually located in /u0[1, 9]/app/username ORACLE_HOME Software location You must specify a new Oracle home directory for each new installation of Oracle Database software oradata (DB file location) oraInventory Used by the OUI to keep track of all Oracle software installed on the computer the first writable /u0[1,9] Oracle Universal Installer
  • 8. 8 Meta data User data Data files Δ online redo log group (at least 2 groups / DB) [inactive] online redo log group Δlog writer process (LGWR) SGA Redo log buffer area The log writer process writes redo log entries to disk. Redo log entries are generated in the redo log buffer of the System Global Area (SGA) and the log writer process writes the redo log entries sequentially into an online redo log file. *I think that there is only one online redo log file per group. As most of the times, the online redo log file of a group is multiplexed, the documentation talks about the “online redo log files of the group” (which is confusing, because it could mean that there can be several redo log files per group). Online redo log file* contains a record of changes that were made to the data files
  • 9. 9 Data files Δ online redo log group (at least 2 groups / DB) [inactive] online redo log group After the online redo log files in a group have filled up, the log writer process (LGWR) switches the writing of redo records to a new online redo log group. The LGWR process performs this action in a circular fashion so that the oldest group is overwritten by the most recent redo records. log writer process (LGWR) SGA Redo log buffer area Δ Meta data User data Online redo log file* contains a record of changes that were made to the data files
  • 10. 10 Meta data User data Data files Δ Online redo log files contain a record of changes that were made to data files online redo log group (at least 2 groups / DB) Oracle Database can automatically save the inactive group of online redo log files to one or more offline destinations, known collectively as the archived redo log (also called the archive log). Archive redo log [inactive] online redo log group log writer process (LGWR) Δ
  • 11. 11 Meta data User data Data files Δ Online redo log files contain a record of changes that were made to data files online redo log group (at least 2 groups / DB) Oracle Database can automatically save the inactive group of online redo log files to one or more offline destinations, known collectively as the archived redo log (also called the archive log). Archive redo log [inactive] online redo log group log writer process (LGWR) Log files are full, or a Log- switch event occurs Δ
  • 12. 12 Meta data User data Data files Δ Online redo log files contain a record of changes that were made to data files online redo log group (at least 2 groups / DB) Oracle Database can automatically save the inactive group of online redo log files to one or more offline destinations, known collectively as the archived redo log (also called the archive log). Archive redo log [inactive] online redo log group log writer process (LGWR) Log files are full, or a Log- switch event occurs Δ
  • 13. 13 Meta data User data Data files Δ Online redo log files contain a record of changes that were made to data files online redo log group (at least 2 groups / DB) Oracle Database can automatically save the inactive group of online redo log files to one or more offline destinations, known collectively as the archived redo log (also called the archive log). Archive redo log [inactive] online redo log group In ARCHIVELOG mode, the group is ready for use by the LGWR only ofter the archive process is completed log writer process (LGWR) Log files are full, or a Log- switch event occurs
  • 14. 14 Multiplexing of the online redo logs I think that the same LGWR process writes at the n (2) locations at once Group status = Current The database log writer process (LGWR) writes redo records from the memory buffer to a redo log group until the log files in that group reach their storage size limit, or until you request a log switch operation. The LGWR process then writes to the next log group. The LGWR process performs this action in a circular fashion so that the oldest group is overwritten by the most recent redo records.
  • 15. 15 ARCHIVELOG NOARCHIVELOG Availability of the online redo log group A group of online redo log files cannot be reused by the log writer (LGWR) process until the group is archived. when a group becomes inactive after the LGWR process switches to a new group, the inactive group is available for immediate reuse by the LGWR process. protection protects a database from instance failure and media failure. protects a database from instance failure but not from media failure. Only the most recent changes made to the database, which are stored in the online redo log files, are available for instance recovery. restore you can use only entire database backups taken while the database is closed. Therefore, back up the entire database at regular, frequent intervals. Backup online ? yes no
  • 17. 17 ORACLE_BASE helps to facilitate the organization of multiple Oracle software installations Usually located in /u0[1, 9]/app/username ORACLE_HOME Software location You must specify a new Oracle home directory for each new installation of Oracle Database software oradata (DB file location) oraInventory Used by the OUI to keep track of all Oracle software installed on the computer the first writable /u0[1,9] network admin listener.ora Default listener config file. tnsnames.ora Describes the mapping of the net service names (provided by clients when requesting a connection, in their connect string) to the connect descriptors (protocol + service name); for the local naming method. Default location for the Fast Recovery Area
  • 18. 19 Default Listener LISTENER The default Oracle Net Listener (process) listener.ora The default listener config file. This file is automatically configured during the installation. Its config file :1521 LISTENER= … (ADDRESS=(PROTOCOL=tcp) (HOST=host_name)(PORT=1521)) …
  • 19. 20 listener.ora # listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools. LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = OAC-DB.compute-gse00002322.oraclecloud.internal)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) VALID_NODE_CHECKING_REGISTRATION_LISTENER=ON SSL_VERSION = 1.2
  • 20. 21 DB service = Logical representations of a database (i.e. the way a database is presented to clients) Database Service Names (the name of a DB Service) LISTENER The default Oracle Net Listener (process) :1521 Service name 1 Service name 2 • An Oracle instance can be presented as multiple services • and a service can be implemented as multiple Oracle instances.
  • 21. 22 A DB service name can be assigned to the Net Listener in listener.ora DB Service names and the default Net Listener LISTENER The default Oracle Net Listener (process) listener.ora The default listener config file. Its config file :1521 LISTENER= … (ADDRESS=(PROTOCOL=tcp) (HOST=host_name)(PORT=1521)) (connect_data= (service_name=test) … test The service names, can be configured in listener.ora +
  • 22. 23 Dynamic registration DB service names registration to Net Listener(s) <LISTENET_NAME> An Oracle Net Listener (process) Service name 1 Dynamic registration Service registration is performed by the listener registration (LREG) process—an instance background process—of each database instance. Dynamic service registration does not require modification of the listener.ora file. Listener registration process (LREG) + Service names can also be dynamically registered with the Net listener. Dynamic registration of services and databases with the Net listener is called service registration.
  • 23. 25 List the service names of an instance SQL> SELECT service_id, name FROM v$services; SERVICE_ID NAME ---------- ---------------------------------------------------------------- 7 mydata.gse00002322.oraclecloud.internal 6 pdb1.gse00002322.oraclecloud.internal 3 OACDB.gse00002322.oraclecloud.internalXDB 4 OACDB.gse00002322.oraclecloud.internal 1 SYS$BACKGROUND 2 SYS$USERS 6 rows selected.
  • 24. 26 lsnrctl services List the DB services names registered into the Net Listener [oracle@OAC-DB ~]$ lsnrctl services LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 13-OCT-2017 14:32:36 Copyright (c) 1991, 2017, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=OAC-DB.compute-gse00002322.oraclecloud.internal)(PORT=1521))) Services Summary... Service "OACDB.gse00002322.oraclecloud.internal" has 1 instance(s). Instance "OACDB", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:9213 refused:0 state:ready LOCAL SERVER Service "OACDB.gse00002322.oraclecloud.internalXDB" has 1 instance(s). Instance "OACDB", status READY, has 1 handler(s) for this service... Handler(s): "D000" established:83 refused:0 current:0 max:1022 state:ready DISPATCHER <machine: OAC-DB, pid: 7742> (ADDRESS=(PROTOCOL=tcp)(HOST=OAC-DB.compute-gse00002322.oraclecloud.internal)(PORT=13692)) Service "mydata.gse00002322.oraclecloud.internal" has 1 instance(s). Instance "OACDB", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:9213 refused:0 state:ready LOCAL SERVER Service "pdb1.gse00002322.oraclecloud.internal" has 1 instance(s). Instance "OACDB", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:9213 refused:0 state:ready LOCAL SERVER The command completed successfully That’s LISTENER (cf listener.ora) All the services that have been registered to it Because a DB service can represent multiple Oracle instances The server process, which is set as a handler of this DB service, is in dedicated mode (so there is no dispatcher) For this service, the server is in shared mode
  • 25. 27 What clients do to request a connection Client app Users initiate a connection-request by providing a connect string. It includes: • Username and password • Connect identifier The Connect Identifier can be: • The Connect descriptor • OR a net service name The Connect descriptor contains : • A protocol • And a DB service name Net service name A name that resolves to the connect descriptor using mapping information stored in one or more repositories accessed with one of the following naming methods: • Easy connect naming: {TCP/IP protocol, DB service name, hostname} • Local naming: connect descriptor mapped to a net service name in tnsnames.ora • Directory naming: resolves {a DB service, net service name, or a net service alias} to a connect descriptor, stored in a LDAP
  • 26. 28 Easy Connect Naming Net Service Name – Naming Methods The Easy Connect feature, which was introduced in Oracle Database 11g Release 1 (11.1), makes the following parts of the conventional JDBC connection URL syntax optional: jdbc:oracle:driver_type:[username/password]@[//]host_name[:port][:serviceName] In this URL: • // is optional. • :port is optional. Specify a port only if the default Oracle Net listener port (1521) is not used. • :serviceName is optional. The connection adapter for the Oracle Database connects to the default service on the host. e.g. of connect identifier: hostname:1521/dbServiceName Here, the Connect Identifier is a net service name, which is resolved thanks to the easy connect naming connect string
  • 27. 29 [oracle@leoDB admin]$ cat listener.ora # listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools. LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = leoDB.compute-gse00012384.oraclecloud.internal)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) VALID_NODE_CHECKING_REGISTRATION_LISTENER=ON SSL_VERSION = 1.2 Maps net service name <-> Connect descriptor [oracle@leoDB admin]$ cat tnsnames.ora ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = leoDB.compute-gse00012384.oraclecloud.internal)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL.gse00012384.oraclecloud.internal) ) ) PDB1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = leoDB.compute-gse00012384.oraclecloud.internal)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdb1.gse00012384.oraclecloud.internal) ) ) Net service name Connect descriptor Local Naming (uses tnsnames.ora) Net Service Name – Naming Methods
  • 28. Side note • “DB service” is often referred as “DB service name” or “service name” • “Net service name” ≠ “service name” 30
  • 29. 31 Oracle Instance’s (background) processes Oracle instance (identified by the SID and global database name) = background processes Background Process Description Database writer (DBWn) The database writer writes modified blocks from the database buffer cache to the files on a disk. Oracle Database allows a maximum of 36 database writer processes. Log writer (LGWR) The log writer process writes redo log entries to disk. Redo log entries are generated in the redo log buffer of the System Global Area (SGA) and the log writer process writes the redo log entries sequentially into an online redo log file. Checkpoint (CKPT) At specific times, all modified database buffers in the SGA are written to the data files by a database writer process (DBWn). This event is called a checkpoint. The checkpoint process signals DBWn, updates the data files and control files of the database, and records the time of this update. System monitor (SMON) The system monitor performs instance recovery when a failed instance is restarted. Process monitor (PMON) The process monitor performs a recovery when a user process fails. It cleans up the cache and frees resources that the failed process was using. Archiver (ARCn) Archiver processes copy the online redo log files to archival storage when the log files are full or a log switch occurs. The database must be in archive log mode to run archive processes. For more information, see Performing Backup and Recovery. Manageability monitor (MMON) This process performs various management-related background tasks, for example: •Issuing alerts whenever a given metric violates its threshold value •Taking snapshots by spawning additional processes •Capturing statistical values for SQL objects that have been recently modified Job Queue Processes (CJQ0 and Jnnn) Job queue processes run user jobs, often in batch mode. A job is a user-defined task scheduled to run one or more times. SGA Database buffer Meta data User data Δ Data files
  • 30. Dedicated Each client process has its own server process. Although a dedicated server process is good for long-running queries and administrative tasks, an idle process or too many dedicated processes can result in an inefficient use of resources. 32 Shared Eliminates the need for a dedicated server process for each user connection, requires less memory for each user connection, and enables more users to access the database. Shared server mode is more efficient at supporting multiple client programs making frequent short-running queries. Dedicated/shared server mode PGA PGA PGA
  • 31. 33 System Global Area VS Program Global Area Memory Structures: SGA vs PGA Oracle instance (identified by the SID and global database name) = background processes Server processes (dedicated or shared) Executes SQL SGA PGA Exemple: Database buffer cache, Redo log buffer, Result cache, Shared pool (for stored procedures, info from the data dictionary –user account data, table and index descriptions, privileges), streams pool, Large pool, etc. PGA PGA PGA PGA PGA Total instance PGA It is non-shared memory created by Oracle Database when a server process is started. Access to the PGA is exclusive to the server process. There is one PGA for each server process. Background processes also allocate their own PGAs. The amount of (total instance PGA as well as the amount of PGA for each server process) PGA memory used, and the contents of the PGA depend on whether the instance is running in dedicated server mode (each client process has its own server process) or shared server mode (you don’t have a dedicated server process for each user connection). The PGA is used to process SQL statements and to hold logon and other session information. A large part of the PGA is dedicated to SQL work areas, which are working memory areas for sorts and other SQL operations.
  • 32. 34 1) Spawning the Oracle instance Startup an Oracle Instance Oracle instance (identified by the SID and global database name) = background processes Init<SID>.ora 010011 SPFILE XOR 1) The instance reads the initialization parameter file, allocates the SGA, and starts the background processes > STARTUP SGA Oracle instance (init process) 2) 3)
  • 33. 35 2) Reach the MOUNT state Startup an Oracle Instance Oracle instance (identified by the SID and global database name) = background processes Meta data User data Database Control file • DB name • Location of associated data files and redo log files • Timestamp of the DB creation • Current log sequence number • Checkpoint info Online redo logs If you mount the database, then the Oracle instance opens the control file for the database, but does not open the data files.
  • 34. 36 3) Reach the OPEN state Startup an Oracle Instance Oracle instance (identified by the SID and global database name) = background processes Meta data User data Database Control file • DB name • Location of associated data files and redo log files • Timestamp of the DB creation • Current log sequence number • Checkpoint info Online redo logs If you open the database, then, after reading the parameter file and control file, the online redo log files and data files for the database are also opened. The state of the database is now OPEN and user access to the data is available.
  • 35. 37 SHUTDOWN (NORMAL or IMMEDIATE) Shut down an Oracle Instance Oracle instance (identified by the SID and global database name) = background processes SGA Database buffer Redo logs buffer Meta data User data Data files online redo log Checkpoint is triggered Control file Database
  • 36. 38 SHUTDOWN (NORMAL or IMMEDIATE) Shut down an Oracle Instance Oracle instance (identified by the SID and global database name) = background processes SGA Database buffer Redo logs buffer Meta data User data Data files online redo log Control file Database is closed
  • 37. 39 SHUTDOWN (NORMAL or IMMEDIATE) Shut down an Oracle Instance Oracle instance (identified by the SID and global database name) = background processes SGA Database buffer Redo logs buffer Meta data User data Data files online redo log Control file NOMOUNT database
  • 38. 40 SHUTDOWN (NORMAL or IMMEDIATE) Shut down an Oracle Instance Oracle instance (identified by the SID and global database name) = background processes SGA Database buffer Redo logs buffer Meta data User data Data files online redo log Control file NOMOUNT database
  • 39. 41 Oracle DB storage structures Oracle instance (identified by the SID and global database name) = background processes What the Oracle instance sees What the OS sees 1..1 if you choose BigFile tablespace (for ASM or other logical volume managers) 1..n There can be multiple undo tablespaces, but only one can be active for an Oracleinstance. 3 groups of multiplexed online redo logs
  • 40. Temps filesTemps filesTemps filesTemps file 42 CDB and PDBs Control file online redo log Temps filesTemps filesTemps filesTemps file Undo data files Undo data files Undo data files Undo data file System data files for container n System data files for container n System data files for container n System data file for container n System data files for container n System data files for container n System data files for container n System data file for container 1 [1, *] sets of tem files One set of undo data files A set of system data files for every container Data filesData filesData filesData file From my understanding Zero or more sets of user- created data files
  • 41. Temps filesTemps filesTemps filesTemps file 43 CDB and PDBs Control file online redo log Temps filesTemps filesTemps filesTemps file Undo data files Undo data files Undo data files Undo data file System data files for container n System data files for container n System data files for container n System data file for container n System data files for container n System data files for container n System data files for container n System data file for container 1 [1, *] sets of tem files One set of undo data files A set of system data files for every container Zero or more sets of user- created data files Data filesData files From my understanding Legend: used by the CDB used by a PDB Data filesData file
  • 42. 44 logical structures seen by the Oracle instance Datafiles components Data file 1 Extent A contiguous set of data blocks within a segment. Oracle Database allocates space for segments in units of one extent. When the existing extents of a segment are full, the database allocates another extent for that segment. n Segment Contains a specific type of database object. For example, a table is stored in a table segment, and an index is stored in an index segment. 1..n 1 data block, a.k.a database block The smallest unit of I/O to database storage. An extent consists of several contiguous data blocks. The database uses a default block size at database creation. After the database has been created, it is not possible to change the default block size without re-creating the database. It is possible, however, to create a tablespace with a block size different than the default block size. Contiguous n
  • 43. 45 logical structures seen by the Oracle instance Datafiles components Data file 1 Extent A contiguous set of data blocks within a segment. Oracle Database allocates space for segments in units of one extent. When the existing extents of a segment are full, the database allocates another extent for that segment. n Segment Contains a specific type of database object. For example, a table is stored in a table segment, and an index is stored in an index segment. 1..n 1 data block, a.k.a database block The smallest unit of I/O to database storage. An extent consists of several contiguous data blocks. The database uses a default block size at database creation. After the database has been created, it is not possible to change the default block size without re-creating the database. It is possible, however, to create a tablespace with a block size different than the default block size. Contiguous n
  • 44. 46 logical structures seen by the Oracle instance Datafiles components Data file 1 Extent A contiguous set of data blocks within a segment. Oracle Database allocates space for segments in units of one extent. When the existing extents of a segment are full, the database allocates another extent for that segment. n Segment Contains a specific type of database object. For example, a table is stored in a table segment, and an index is stored in an index segment. 1..n 1 data block, a.k.a database block The smallest unit of I/O to database storage. An extent consists of several contiguous data blocks. The database uses a default block size at database creation. After the database has been created, it is not possible to change the default block size without re-creating the database. It is possible, however, to create a tablespace with a block size different than the default block size. Contiguous n
  • 45. Tablespaces • group related logical structures (such as tables, views, and other database objects). • For example, all application objects can be grouped into a single tablespace to simplify maintenance operations. • consists of one or more physical data files. • provide a means to physically locate data on storage. When you define the data files that comprise a tablespace, you specify a storage location for these files. • The backup and recovery features of Oracle Database enable you to back up or recover at the tablespace level. 47 Logical storage units
  • 46. 48 Some tablespaces included in the database Tablespace Description EXAMPLE This tablespace contains the sample schemas that are included with Oracle Database. The sample schemas provide a common platform for examples. Oracle documentation and educational materials contain examples based on the sample schemas. SYSTEM This tablespace is automatically created at database creation. Oracle Database uses it to manage the database. It contains the data dictionary, which is the central set of tables and views used as a read-only reference for a particular database. It also contains various tables and views that contain administrative information about the database. These are all contained in the SYS schema, and can be accessed only by the SYS user or other administrative users with the required privilege. SYSAUX This is an auxiliary tablespace to the SYSTEM tablespace. The SYSAUX tablespace contains data for some components and products, reducing the load on the SYSTEM tablespace. Every database using Oracle Database 10g release 1 (10.1) or later must have a SYSAUX tablespace. Components that use SYSAUX as their default tablespace during installation include Automatic Workload Repository, Oracle Streams, and Oracle Text. For more information, see Oracle Database Administrator's Guide. TEMP This tablespace stores temporary data generated when processing SQL statements. For example, this tablespace would be used for query sorting. Every database should have a temporary tablespace that is assigned to users as their temporary tablespace. In the preconfigured database, the TEMP tablespace is specified as the default temporary tablespace. If no temporary tablespace is specified when a user account is created, then Oracle Database assigns this tablespace to the user. UNDOTBS1 This is the undo tablespace used by the database to store undo information. See "Managing Undo Data" to understand how an Oracle database uses the undo tablespace. Every database must have an undo tablespace. USERS This tablespace is used to store permanent user objects and data. Similar to the TEMP tablespace, every database should have a tablespace for permanent user data that is assigned to users. Otherwise, user objects will be created in the SYSTEM tablespace, which is not good practice. In the preconfigured database, USERS is designated as the default tablespace for all new users.
  • 47. 49 Data dictionary read-only set of tables and views that provides information about the database SYSTEM Stored in the SYSTEM tablespace, probably in the SYS schema A data dictionary contains: • The definitions of all schema objects in the database (tables, views, indexes, clusters, synonyms, sequences, procedures, functions, packages, triggers, and so on) • How much space has been allocated for, and is currently used by, the schema objects (*except for locally managed tablespaces I guess) • Default values for columns • Integrity constraint information • The names of Oracle Database users • Privileges and roles each user has been granted • Auditing information, such as who has accessed or updated various schema objects • Other general database information
  • 48. 50 Locally managed tablespaces Locally managed tablespaces keep the space allocation information within the tablespace, not in the data dictionary, thus offering better performance. By default, Oracle Database sets all newly created tablespaces to be locally managed with automatic segment management (a feature that further improves performance). For a table to be recoverable using Flashback Drop, it must reside in a locally managed tablespace. Locally managed tablespace
  • 49. 51 3 types of tablespaces A database running in automatic undo management mode transparently creates and manages undo data in the undo tablespace. Oracle Database uses undo data to: • roll back transactions, • provide read consistency, • help with database recovery, • enable features such as Oracle Flashback Query and Oracle Flashback Table. A database instance can have only one active undo tablespace. The database maintains and automatically tunes an undo retention period. Committed undo data whose age is less than the undo retention period is retained for use by queries or Oracle Flashback operations. 1 Used for storing temporary data, as would be created when SQL statements perform sort operations. An Oracle database gets a temporary tablespace when the database is created. You would create another temporary tablespace if you were creating a temporary tablespace group. Under typical circumstances, you do not have to create additional temporary tablespaces. If you have an extremely large database, then you might configure additional temporary tablespaces. The physical files that comprise a temporary tablespace are called tempfiles, as opposed to data files. The TEMP tablespace is typically used as the default temporary tablespace for users who are not explicitly assigned a temporary tablespace. [1,*] Permanent You use permanent tablespaces to store your user and application data. Oracle Database uses permanent tablespaces to store permanent data, such as system data. Each user is assigned a default permanent tablespace.
  • 50. 52 Password file A database can use a password file to authenticate administrative users with SYSDBA, SYSOPER, and SYSBACKUP privileges. A password file is required for remote connections to the database with any of these privileges. These privileges enable a DBA to start and shut down the database, back up and recover the database, and perform other high-level administrative tasks. This password file is outside of the database itself, thereby enabling the authentication of a DBA when the database is not yet started. (A DBA must authenticate before starting the database.) When you invoke DBCA as part of the Oracle Database installation process, DBCA creates a password file with one entry: the SYS user. Granting SYSDBA, SYSOPER, or SYSBACKUP to a user adds that user to the password file automatically. Note: Oracle Database can also use operating system authentication to authenticate users with the SYSDBA, SYSOPER, and SYSBACKUPprivileges. Operating system authentication takes precedence over password file authentication
  • 52. 54 Users For users to access your database, you must create user accounts and grant appropriate database access privileges to those accounts. A user account is identified by a user name, and defines the attributes of the user, including the following: • Authentication method • Password for database authentication • Default tablespaces for permanent and temporary data storage • Tablespace quotas • Account status (locked or unlocked) • Password status (expired or not) When you create a user account, you must not only assign: • a user name, a password, default tablespaces for the account, • Grant the appropriate system privileges, object privileges, and roles to the account. • If the user will be creating database objects, then give the user account a space usage quota on each tablespace in which the objects will be created.
  • 53. 55 Schema = user When you create a user account, you are also implicitly creating a schema for that user. A schema is a logical container for the database objects (such as tables, views, triggers, and so on) that the user creates. The schema name is the same as the user name, and can be used to unambiguously refer to objects owned by the user. For example, hr.employees refers to the table named employees in the hr schema. (The employees table is owned by hr.) The terms database object and schema object are used interchangeably. When you delete a user, you must either simultaneously delete all schema objects of that user, or you must have previously deleted the schema objects in separate operations.
  • 54. User privileges The main types of user privileges are as follows: • System privileges—A system privilege gives a user the ability to perform a particular action, or to perform an action on any schema objects of a particular type. For example, the system privilege CREATE TABLE permits a user to create tables in the schema associated with that user, and the system privilege CREATE USER permits a user to create database users. • Object privileges—An object privilege gives a user the ability to perform a particular action on a specific schema object. Different object privileges are available for different types of schema objects. The privilege to select rows from the EMPLOYEES table or to delete rows from the DEPARTMENTS table are examples of object privileges. 56 System privileges vs Object privileges
  • 55. User common roles 57 Role Name Description CONNECT Enables a user to connect to the database. Grant this role to any user or application that needs database access. RESOURCE Enables a user to create, modify, and delete certain types of schema objects in the schema associated with that user. Grant this role only to developers and to other users that must create schema objects. This role grants a subset of the create object system privileges. For example, it grants the CREATE TABLE system privilege, but does not grant the CREATE VIEW system privilege. It grants only the following privileges: CREATE CLUSTER, CREATE INDEXTYPE, CREATE OPERATOR, CREATE PROCEDURE, CREATE SEQUENCE, CREATE TABLE, CREATE TRIGGER, CREATE TYPE. DBA Enables a user to perform most administrative functions, including creating users and granting privileges; creating and granting roles; creating, modifying, and deleting schema objects in any schema; and more. It grants all system privileges, but does not include the privileges to start or shut down the database instance. It is by default granted to users SYS and SYSTEM. Three widely used roles that are predefined in Oracle Database:
  • 57. SYS and SYSTEM users • SYS: Granted roles: DBA . Granted privilege: SYSDBA (all high level admin tasks such as backup and recovery) • SYSTEM: Granted roles: DBA (all admin functions except backup & recovery, and DB upgrade) 59
  • 58. SYSDBA and SYSOPER are system privileges 60
  • 61. Schema 63 Oracle Database stores a schema object logically within a tablespace. There is no relationship between schemas and tablespaces: a tablespace can contain objects from different schemas, and the objects for a schema can be contained in different tablespaces. The data of each object is physically contained in one or more data files. Tablespace 1 hr.object6 leo.object2 Tablespace 2 hr.object3 leo.object4 Data filesData filesData filesData filesData file Datafiles of the tablespace1 The data of each object is physically contained in one or more data files.
  • 62. Schema object types 64 The principal types of schema objects are: • Tables : A table stores data in rows. Tables are the most important schema objects in a relational database. • Indexes: Indexes are schema objects that contain an entry for each indexed row of the table or table cluster and provide direct, fast access to rows. Oracle Database supports several types of index. An index-organized table is a table in which the data is stored in an index structure. • Partitions: Partitions are pieces of large tables and indexes. Each partition has its own name and may optionally have its own storage characteristics. • Views: Views are customized presentations of data in one or more tables or other views. You can think of them as stored queries. Views do not actually contain data. • Sequences: A sequence is a user-created object that can be shared by multiple users to generate integers. Typically, you use sequences to generate primary key values. • Dimensions: A dimension defines a parent-child relationship between pairs of column sets, where all the columns of a column set must come from the same table. Dimensions are commonly used to categorize data such as customers, products, and time. • Synonyms: A synonym is an alias for another schema object. Because a synonym is simply an alias, it requires no storage other than its definition in the data dictionary. • PL/SQL subprograms and packages: PL/SQL is the Oracle procedural extension of SQL. A PL/SQL subprogram is a named PL/SQL block that can be invoked with a set of parameters. A PL/SQL package groups logically related PL/SQL types, variables, and subprograms. Other types of objects are also stored in the database and can be created and manipulated with SQL statements but are not contained in a schema. These objects include database user account, roles, contexts, and dictionary objects.
  • 63. Tables 1. relational table: structured with simple columns. It is the most common type. You can build relational tables in either: • heap structures: the rows are not stored in any particular order. • index-organized structures: the row order is determined by the values in one or more selected columns. For some applications, index-organized tables provide enhanced performance and more efficient use of disk space. 2. object tables 3. XMLType tables Any of the three can be defined as permanent or temporary tables. Temp tables hold session-private data that exists only for the duration of a transaction or session. 65 Three types of tables
  • 64. Static Data Dictionary Views The data dictionary views are called static views because they change infrequently, only when a change is made to the data dictionary. Examples of data dictionary changes include creating a new table or granting a privilege to a user. Many data dictionary tables have three corresponding views: • DBA_ : displays all relevant information in the entire database. • ALL_ : displays all the information accessible to the current user, including information from the schema of the current user, and information from objects in other schemas, if the current user has access to those objects • USER_ : displays all the information from the schema of the current user • Dynamic performance views (v$) Monitor ongoing database activity. They are available only to administrators. The names of dynamic performance views start with the characters V$. 66 Views 2 types of views
  • 66. 68 Files backed-up by RMAN Data filesData filesData filesData file Archived redo log Control file 010011 SPFILE I think the reason why this list doesn’t include online redo logs (active or inactive) is because they can be multiplexed (thus recoverable in case of hadware failure, without relying on backups).
  • 67. 69 Connect as TARGET Backup and recovery of the CDB $rman target '“leo as sysbackup"‘ Or leopold@hostname ~$ rman target / The DB user leo has SYSBACKUP (or SYSDBA) privilege You can connect to the root in one of the following ways: • Connect using OS authentication You are connected to the root as the SYS user with the SYSDBA privilege. • Connect locally as a common user (Leo: i.e. DB user; as opposed to OS user, belonging to a group which has been mapped with SYSDBA or SYSBACKUP privilege) • Connect as a common user through Oracle Net Services (you can connect with RMAN to a target on another host) The OS user leopold is in the OSBACKUPDBA group (typically the backupdba group on UNIX and Linux systems). When you do not explicitly specify SYSDBA or SYSBACKUP, you are connected to the target database with the SYSDBA privilege.
  • 68. 70 Restoring vs Recovering Backups mediums Data filesData filesData files Data files Archived redo log Control file 010011 SPFILE Restore: copy the physical files that comprise the database from a backup medium to their original or to new locations. Database recovery: the process of updating database files restored from a backup, with the changes made to the database after the backup. This updating is done by applying incremental backups and redo logs to the restored files. Δ Incremetal backups (only level 1?)
  • 69. 71 RMAN Repository a record of database files and backups for each database on which RMAN performs operations. RMAN uses the repository metadata to choose the most efficient backups needed for a restore and recovery. RMAN can restore files only if they are recorded in the RMAN repository. Control file RMAN’s metadata repo I think it is usually stored in the control file of the backed up DB.
  • 70. 72 Schema of a separate DB used for storing the RMAN repos of other DBs Recovery catalog RMAN’s metadata repo RMAN’s metadata repo RMAN’s metadata repo Recovery catalog (schema) In some installations, a second copy of the RMAN repository is stored in a schema called the recovery catalog. The recovery catalog is located in a separate database and can store metadata for multiple target databases. It is recommended that you use a recovery catalog. Because a recovery catalog stores metadata history for longer than the control file, you can perform a recovery that goes further back in time than the history in the control file. Also, if the target control file and all backups are lost, then the RMAN metadata in the recovery catalog can be used.
  • 71. Image Copies: Exact byte-for-byte copies of the files (like a “cp” command); and those copies are recorded in the RMAN repository. I think that 1 datafile => 1 image copy • Can only be created on disk • cannot use all RMAN features, • but you can apply incremental backups(Leo: level 1) to them(Leo: level 0) (synthetic full backups) • and you can use them directly in place without first copying them, for very fast restores. Backup Sets: Logical entities produced by the RMAN BACKUP command. 73 Image copies vs Backup sets Backups created by RMAN can be stored either as: Backup pieceBackup pieceBackup piece Backup set Backup pieceBackup pieceBackup piece Backup set produces RMAN-specific format • RMAN uses unused block compression to save space in backing-up data files. • Backup sets can also be compressed, encrypted, sent to tape, and use advanced unused- space compression. • Level 1 incremental backups can only be backup sets Full backups and level 0 incremental backups can be either image copies or backup sets, but image copies cannot be on tape.
  • 72. Unused space compression RMAN backs up only the blocks that contain data. 1. Only available with Backups Sets 2. I think it’s a built-in behavior, that doesn’t need to be configured Backup optimization excludes unchanged files, such as read-only files and offline data files, that were previously backed up. 1. I think it is also available for image copies. 2. Activate it with CONFIGURE BACKUP OPTIMIZATION ON; 74 Unused space compression VS Backup optimization
  • 73. Full backup • includes all used blocks of the data file. • can be either an image copy or backup set. Incremental backup • Level 0: the same as full backup; but is the starting point for an incremental backup strategy. • Level 1: copies only blocks that have changed since the previous level 0 or level 1 incremental backup. Level 1 backups can be: • Cumulative: all blocks changed since the most recent level 0 backup are included • Differential: only blocks changed since the most recent level 0 or level 1 backup (if one has been performed yet) are included. Level 1 backups can only be backup sets. 75 Full backups vs Incremental backups
  • 74. 76 Sum up Backup pieceBackup pieceBackup piece Backup set Full backup Level 0 incr backup Level 1 incr backup OR OR Images copies cannot use all RMAN features, but you can use them directly in place without first copying them, for very fast restores.
  • 75. Incremental Backups 77 Block-Change Tracking (Optional) Block changing tracking improves the performance of incremental backups by recording changed blocks in the block change tracking file. During an incremental backup, instead of scanning all data blocks to identify which blocks have changed, RMAN uses this file to identify the changed blocks that need to be backed up. Block-change-tracking file.chg - Block xxx in datafile yyy changed - ….
  • 76. Consistent • i.e. when backed up, the data files were in a transaction-consistent state; meaning that all committed changes had been written from the SGA to the data files. For this not to be just “luck”, the backups must be performed while the DB is shut down. => When you restore the data files, the DB can be opened immediately Inconsistent • Backups performed on data files where the some committed transactions had not been written (because they were still in the SGA). E.g. the DB was open during the backup. • Using archived redo logs ,<?> and then the online redo logs (which are multiplexed)</?>, you can recover the DB (i.e. make the restored datafiles consistent); to be able to open the DB. 78 Consistent vs Inconsistent backups Leo: But what if the data files are at a more advanced state than what is recorded in the archived/online redo logs ? It’s hard to roll back without the undo files… I assume that RMAN makes sure that online/archived redo logs are always as/more advanced as/than the data files it backs up. I think it is implied “[in]consistent with the <?>online or archived ? </?> redo logs”.
  • 77. Media recovery • It is the process by which inconsistent data files are made consistent with the archived and online redo logs. • requires a control file, data files (typically restored from backup), and online and archived redo log files containing changes since the time the data files were backed up. • Media recoveries an be of two types: • Complete recovery can apply to individual datafiles, tablespaces, or the entire database. You restore backup data files and apply all changes from the archived and online redo log files to the data files. • Point-in-time recovery applies to the whole database (and also sometimes to individual tablespaces, with automation help from RMAN). You return a database to its contents at a user-selected time in the past. You restore a backup of data files created before the target time and a complete set of archived redo log files from backup creation through the target time. • RMAN enables you to perform both a complete and a point-in-time recovery of your database. 79
  • 78. Fast Recovery Area • an Oracle-managed {file system directory, or ASM disk group} that provides a centralized storage location for: • backup files (image copies or backup sets) • and recovery files (archived redo logs and flashback logs). • Oracle Database automatically manages this storage, deleting files that are no longer needed (based on the retention policy window set for backups –which I believe is not specific to the FRA- : CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 31 DAYS). • When you issue the RMAN BACKUP command without specifying a backup destination, RMAN automatically backs up to the fast recovery area if it is configured. • You may specify it as an archived redo log file destination. • also acts as a disk cache for tape. You may also periodically copy backups to tape in order to free space for other files. • Even after files in the fast recovery area are obsolete (according to the retention policy), they are typically not deleted until space is needed for new files. If space permits, files recently moved to tape remain on disk to avoid restoring them from tape for a recovery. 80
  • 79. Flashback logs 81 For the Flashback Database feature Oracle instance (identified by the SID and global database name) = background processes Fast Recovery Area Flashback logs images of data blocks Occasionally logs images of data blocks Automatically creates, deletes, and resizes the flashback logs. Archived redo log You can specify the length of the desired flashback window (in minutes). The default value is one day.
  • 80. Backups to tape and media managers • For tape backups, on most platforms, you must integrate a media manager with the Oracle database to use sequential media for storage. • You can use Oracle Secure Backup, which supports both database and file system backups to tape, as your media manager. Oracle Secure Backup is an SBT interface, and provides services for RMAN. You can also use third-party SBT interfaces. • Oracle DB Cloud Backup Module (for OCI- Object Storage Classic)is an SBT interface too 83 E.g. Oracle Secure Backup RMAN SBT interface (teaches RMAN how to use sequential media)
  • 81. Rolling forward image copies of datafiles 84 Updating level 0 image copies over time, using level 1 backup sets Backup pieceBackup pieceBackup piece Backup set Level 1 incr backup You do this frequently, in order to keep the image copies as up to date as possible; so that you don’t have to apply too many differential level 1 backups if you need to perform a DB restore & recovery. Δ Note: this can only be done on disk, as image copies are only supported on disk
  • 82. 86 Oracle Suggested Strategy for disk Rolling forward image copies of datafiles Day 1 Job day 1: RMAN creates a level 0 image copy for each data file Day 2 Day 3 time
  • 83. 87 Oracle Suggested Strategy for disk Rolling forward image copies of datafiles Day 1 Job day 1: RMAN creates a level 0 image copy for each data file Archived redo logs are created in the FRA Day 2 Day 3 time
  • 84. 88 Oracle Suggested Strategy for disk Rolling forward image copies of datafiles Day 1 Job day 1: RMAN creates a level 0 image copy for each data file Archived redo logs are created in the FRA Day 2 Day 3 Job day 2: RMAN creates a differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set time
  • 85. 89 Oracle Suggested Strategy for disk Rolling forward image copies of datafiles Day 1 Job day 1: RMAN creates a level 0 image copy for each data file Archived redo logs are created in the FRA Day 2 Day 3 Job day 2: RMAN creates a differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set time Archived redo logs are created in the FRA
  • 86. 90 Oracle Suggested Strategy for disk Rolling forward image copies of datafiles Day 1 Job day 1: RMAN creates a level 0 image copy for each data file Archived redo logs are created in the FRA Day 2 Day 3 Job day 2: RMAN creates a differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set Job day 3: RMAN creates a new differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set time Archived redo logs are created in the FRA
  • 87. 91 Oracle Suggested Strategy for disk Rolling forward image copies of datafiles Day 1 Job day 1: RMAN creates a level 0 image copy for each data file Archived redo logs are created in the FRA Day 2 Day 3 Job day 2: RMAN creates a differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set Job day 3: RMAN creates a new differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set time Archived redo logs are created in the FRA Archived redo logs are created in the FRA
  • 88. 92 Oracle Suggested Strategy for disk Rolling forward image copies of datafiles Day 1 Job day 1: RMAN creates a level 0 image copy for each data file Archived redo logs are created in the FRA Day 2 Day 3 Job day 2: RMAN creates a differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set Job day 3: RMAN creates a new differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set time Archived redo logs are created in the FRA Archived redo logs are created in the FRA And so on…
  • 89. 93 Day 1 Job day 1: RMAN creates a level 0 image copy for each data file Day 2 Day 3 Job day 2: RMAN creates a differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set Δ Job day 8: RMAN applies Day 2’s level 1 Job day 3: RMAN creates a new differential incr backup level 1 time Oracle Suggested Strategy for disk Rolling forward image copies of datafiles
  • 90. 94 Day 1 Day 2 Day 3 Job day 2: RMAN creates a differential incr backup level 1 Job day 8: RMAN applies Day 2’s level 1 Job day 3: RMAN creates a new differential incr backup level 1 time Oracle Suggested Strategy for disk Rolling forward image copies of datafiles
  • 91. 95 Day 1 Day 2 Day 3 Job day 2: RMAN creates a differential incr backup level 1 Job day 8: RMAN applies Day 2’s level 1 Job day 3: RMAN creates a new differential incr backup level 1 Backup pieceBackup pieceBackup piece Backup set Job day 9: RMAN applies Day 3’s level 1 Δ time Oracle Suggested Strategy for disk Rolling forward image copies of datafiles
  • 92. 96 Day 1 Day 2 Day 3 Job day 2: RMAN creates a differential incr backup level 1 Job day 8: RMAN applies Day 2’s level 1 Job day 3: RMAN creates a new differential incr backup level 1 Job day 9: RMAN applies Day 3’s level 1 time Oracle Suggested Strategy for disk Rolling forward image copies of datafiles
  • 93. Validate datafiles and backups The main purpose of RMAN validation is to check for corrupt blocks and missing files. You can also use RMAN to determine whether backups can be restored. • The VALIDATE DATAFILE command validates the backup for a specific datafile. The VALIDATE command determines whether the backup exists and is not corrupted. • You can run RESTORE ... VALIDATE to test whether RMAN can restore a specific file or set of files from a backup. RMAN chooses which backups to use. • To determine if the whole database can be restored: RESTORE VALIDATE DATABASE; • To determine if a datafile can be restored to a specified SCN: RESTORE DATAFILE 1 VALIDATE UNTIL SCN 23456; • To determine if the datafiles for the specified tablespace can be restored : RESTORE TABLESPACE VALIDATE; 98 Checks whether the backups are intact, and can be used.
  • 94. Cross-checking Checking whether backups listed in the RMAN repository exist and are accessible, and marking as expired any backups not accessible at the time of the cross-check. Backup recorded in the RMAN repository has one of the following status values: • Available: the backup is still present on disk or tape, as recorded in the repository • Expired: the backup no longer exists on disk or tape, but is still listed in the repository • Unavailable: the backup is temporarily not available for data recovery operations (because, for example, it is stored on a tape that is stored offsite or on a disk that is currently not mounted) • Obsolete: based on the currently configured retention policy. 99
  • 95. Oracle advised recovery The Oracle advised recovery feature uses Data Recovery Advisor, which is an Oracle Database feature that: • automatically diagnoses data failures, • determines and presents appropriate repair options, • and performs repairs if requested by the user. In the example here, it restores from backups a data file that was unintentionally deleted 100
  • 96. Flashback 101 Rewind recent changes Flashback table Flashback drop Flashback database Description Rewind rows Recover deleted tables Rewind DB files, but faster than a point-in-time recovery Can the DB stay open ? Yes Yes No Logical level ? Yes Yes No, physical level What makes it possible ? undo data (stored in the undo tablespace). “The user’s”* recycling bin Flashback logs (and a bit of archived logs) And what is the retention period ? The retention period of undo data is decided dynamically by the instance I think it is unlimited, until you purge the recycling bin The default value for flashback logs is 1 day, but you can change it
  • 97. Flashback • Rewind accidental deletion or adding of row in one or more tables. • Unlike a point-in-time recovery, the DB remains open during the flashback • Uses undo data (from the undo tablespace). Its retention period is automatically tuned by the DB instance. • Before you use Flashback Table, you must ensure that row movement is enabled on the table you’re rewinding. Row movement indicates that rowids will change after the flashback occurs. This restriction exists because if rowids before the flashback were stored by an application, then there is no guarantee that the rowids will correspond to the same rows after the flashback. 102 Flashback table
  • 98. Flashback • return a dropped table to the database along with dependent objects such as indexes and triggers. • This feature stores dropped objects in a recycle bin, from which they can be retrieved until the recycle bin is purged, either explicitly or because space is needed. • You can do all this while the DB is available. • For a table to be recoverable using Flashback Drop, it must reside in a locally managed tablespace. Also, you cannot recover tables in the SYSTEM tablespaces (Leo: probably because the Data Dictionary is in this tablespace) • If the retrieved table had referential constraints before it was placed in the recycle bin, then you must re-create them manually. The recycle bin does not preserve referential constraints on a table. 103 Flashback Drop Stores (logically) dropped tables
  • 99. Flashback 104 Flashback Database Fast Recovery Area Flashback logs images of data blocks Archived redo log Data file Data file also uses some data in the archived redo log The result is similar to database point-in-time recovery, but Flashback Database can be much faster because it does not require you to restore and recover data files.
  • 101. • Wait classes are groupings of wait events based on the type of wait. • User I/O means that the workload originating from the user causes the database to read data from disk or write data to disk. • SQL statements are monitored only if they have consumed at least 5 seconds of CPU or I/O time. • An incident is an occurrence of a critical error in the database. Each incident is recorded in the Automatic Diagnostic Repository (ADR), a directory structure located outside the database, which is available for problem diagnosis even when the database is down. You can investigate critical errors using the ADR Command Interpreter (ADRCI) utility. 106
  • 102. SQL Tuning Advisor may suggest • Creating SQL profiles (a collection of information that enables the query optimizer to create an optimal execution plan for a SQL statement). A SQL profile contains additional SQL statistics that are specific to the SQL statement and enable the query optimizer to generate a significantly better execution plan at run time. • Creating new indexes • Refreshing the optimizer statistics • Restructuring the SQL statement 107
  • 104. • PDB: a portable collection of schemas, schema objects, and nonschema objects that appear to an Oracle Net client as a separate database. 109