6. Database Consolidation - Prior to Oracle 12c
6
Server Consolidation
Multiple databases reside on a single server
7. Database Consolidation - Prior to Oracle 12c
7
Schema Consolidation
Single database with multiple schemas
8. Schema Consolidation - Challenges
8
Name Collisions
Same schema name or same public synonym name
Security
DBA can access data of both applications
Upgrades
You cannot patch/upgrade only one schema
Point-In-Time Recovery
Impossible to perform schema level point-in-time recovery
9. Database to Instance Relationship
9
Version < 12c
1:1 - One Database:One Instance
1:N - One Database:Many Instances
Version = 12c (Multitenant)
N:1 - Many Databases:One Instance
N:N - Many Databases:Many Instances
11. 11
One set of background processes
One SGA
One root container
Multiple Pluggable Databases
Up to 252 PDBs
Oracle 12c - Multitenant Architecture
12. Multitenant Architecture cont’d
12
Pluggable Databases share the following files:
Undo Tablespace
Redo Logs
Control Files
(S)Pfile
Temporary tablespace
Note: PDBs may create their own temporary tablespaces
13. Multitenant Advantages - Manage Many as One
13
Data Guard
Multitenant supports Data Guard at CDB-Level
Commands executed when connected to root container
14. Multitenant Advantages - Manage Many as One
14
Upgrades
Upgrade or apply a patch at CDB-Level
https://blogs.oracle.com/UPGRADE/entry/upgrade_pdbs_everything_at_once1
Unplug/plug PDB into another container database
https://blogs.oracle.com/UPGRADE/entry/upgrade_pdbs_one_at_a
15. Multitenant Advantages - Unplug/Plug
15
Moving PDB from one container to another is straightforward
s
16. Multitenant Advantages - Fast Cloning
Clone PDB from another PDB within the same CDB
Requires source PDB to be OPEN READ ONLY
s
16
17. Clone PDB from another PDB in remote CDB
Requires source PDB to be OPEN READ ONLY
Multitenant Advantages - Fast Cloning
s
17
18. s
Multitenant Advantages - Manage Many as One
18
RMAN
Backup entire container as one or at PDB level
Recover entire container as one or at PDB level
s
19. CDB-Level vs. PDB-Level
CDB-Level
• Oracle Software
• SGA & Background Processes
• RMAN Scheduled Backups
• Data Guard
• Some Parameters
(IsPDB_Modifiable= 'FALSE')
• Control Files, Redo and Undo
• (S)Pfile, Password File
• Flashback Database
PDB-Level
• FLUSH SHARED_POOL
• FLUSH BUFFER_CACHE
• Point In-Time Recovery
• RMAN Ad hoc Backups
• Some Parameters
(IsPDB_Modifiable= 'TRUE')
19
20. s
Multitenant Architecture - CDB_* Prefix
20
CDB_* All objects in CDB across all PDBs
DBA_* All objects in specific container
ALL_* Objects accessible by current user
USER_* Objects owned by current user
22. Oracle 12c - Deployment Options
22
DB CDB$ROOT CDB$ROOT
PDB1 PDB1 PDB2 PDB252…
Non-CDB
Same as before 12c
Single Tenant
• No additional license
• One active PDB
Multitenant
• Requires Multitenant License
• Requires Enterprise Edition
• Supports up to 252 PDBs
23. Oracle 12c - Deployment Options cont’d
23
Why use Single Tenant instead of Non-CDB?
Unplug/Plug
Fast Cloning
And most important …
25. Rows vs. Columns
Row format stores all values of data record as one entity
Column format stores each column as separate entity
25
26. Rows vs. Columns cont’d
Which format provides better performance for the following queries?
ORDER_LINE table has 40M rows
EMPLOYEE_ID column is a Primary Key
26
27. The Problem
Columnar = high performance for OLAP queries
Row format = high performance for OLTP queries
In Mixed-Workload, both OLAP and OLTP queries are running
Trade-off between columnar format and row format
27
28. Oracle 12c Solution - In Memory Option
Why not benefit from both approaches?
Solution: Additional column store memory pool in the SGA
Oracle optimizer will automatically decide which option to use
28
32. In Memory Option - Additional Notes
It is possible to enable the feature for the following levels:
Tablespace Table Partition Sub Partition Column
What will be loaded and when?
It depends on the object prioritization:
CRITICAL HIGH MEDIUM NONE (Default)
Populates into the column store only
when someone queries the table
32
33. In Memory Option - Summary
Oracle 12.1.0.2 New Feature
Extra Cost Option
It is not column store Database
It is not In Memory Database
Boost performance for some queries
33
35. Invisible Columns
35
Mark a specific column or set of columns as invisible
Will not be seen by the application
However, they can be explicitly referenced
Make changes without affecting the application!
38. Improved Defaults
Identity Columns
Default value when using a sequence
Default value when NULL is inserted
39. Identity Columns
39
Automatically generates an auto increment value upon row insertions
Uses sequence “behind the scenes”
Identity columns are NOT NULL
Has the following options:
ALWAYS (default)
BY DEFAULT
BY DEFAULT ON NULL
47. 47
Improved Column Addition
Version < 11g
Adding new column with default value = All rows to be updated
Entire table lock, long operation
Version = 11g
Metadata-only when adding NOT NULL column with default value
Allows adding column within milliseconds
Version = 12c
Metadata-only support for nullable column with default value
50. 50
Extended Data Types
Increased size limit for VARCHAR, NVARCHAR, RAW data types
Can go up to 32K!
Consistent with the VARCHAR data type in PL/SQL
Allows using string functions that can return 32K VARCHAR2 type
Disabled by default
Enabling this feature requires short downtime
53. Enhanced Syntax for Top-N Queries
53
Examples:
Query top 2 employees with highest salaries
Query first 3 employees who have joined the company
Version < 12c
Implemented via ROWNUM pseudo column
Not a straightforward way to implement Top-N queries
Version = 12c
New enhanced and straightforward syntax
58. Online Data File Move Operation
58
Version < 12c
Requires downtime
Pre 12c Common solution
Take tablespace to OFFLINE state
Move data file to new location
Change location of data file in control file
Take tablespace back to ONLINE state
Version = 12c
Online operation
61. Multiple indexes on same set of columns
61
Oracle 11g introduced “Invisible Indexes” feature
Oracle 12c allows creating multiple indexes on same set of columns
Only 1 index is visible
All indexes are different, i.e. B*Tree & Bitmap
Test indexes’ performance without dropping and creating them
64. Table Point In-Time Recovery
64
Useful when flashback table cannot be used to recover the table
Oracle 12c provides a simple RECOVER TABLE command which
automates the entire process we had to do manually prior to 12c
65. Support for 12c Multitenant Architecture
65
Back up the whole CDB - Connect to root and execute
Back up several PDBs - Connect to root and execute
Back up a specific PDB
Back up several tablespaces - Connect to root and execute
Back up root container
66. 66
Version < 12c
SYSDBA was used for backup & restore operations
The Problem
The user who runs RMAN can access the user data
Oracle 12c Solution
SYSBACKUP privilege for backup & restore operations
Separation of Duty - SYSBACKUP Privilege
68. Additional Features Worth Mentioning…
68
• Temporary Undo
• Adaptive Execution Plans
• Information Lifecycle Management
• Enhanced Statistics
Administration
& Performance
• Data Redaction
• Unified Auditing
• Privilege Analysis
Security
• Calling PL/SQL from SQL
• Partitioning Enhancements
Development
69. Stuff on the web …
69
12c Articles (My Blog)
http://OracleDBPro.BlogSpot.com/search/label/12c%20New%20Features
12c Articles (ORACLE-BASE Website)
https://oracle-base.com/articles/12c/articles-12c
Top 12 Features of Oracle Database 12c (Video by Tom Kyte)
https://youtu.be/ekTTXoHBmWw?list=PLDqEn-pc6UNsYEINEdaO3ni0EBVVmZqGK
70. References
70
Oracle 12.1.0.1 New Features (Oracle Documentation)
https://docs.oracle.com/database/121/NEWFT/chapter12101.htm#NEWFT002
Oracle 12.1.0.2 New Features (Oracle Documentation)
http://docs.oracle.com/database/121/NEWFT/chapter12102.htm#NEWFT003
Oracle Database In-Memory (White Paper)
www.oracle.com/technetwork/database/in-memory/overview/twp-oracle-database-in-memory-2245633.html
Oracle Multitenant (White Paper)
http://www.oracle.com/technetwork/database/multitenant-wp-12c-1949736.pdf
Note: All diagrams and illustrations are used by permission of Oracle
72. You may complete the session evaluation via the mobile app
Thank You.
Please complete the session evaluation
We appreciate your feedback and insight
Notes de l'éditeur
The invisible columns feature which allows you to mark a specific column or set of columns as invisible. This means that If you will execute a SELECT * from the table, the invisible columns will not be displayed in the output of the select statement; however, if you will explicitly specify these columns as part of the SELECT statement they will be displayed in the output of the select statement.The Invisible columns is a very simple and straight-forward feature which can be useful if you would like to add a new column to a table but at the first stage you don't want that the application will be affected by the new column. SELECT * and INSERT statements will continue to function normal (unless an integrity constraint on the invisible column was violated).
You can either mark the columns as invisible as part of the CREATE TABLE command, or as part of the ALTER TABLE command.
If you will execute an INSERT statement and you don't specify the columns, the INSERT will work; however, you can insert value to the invisible columns if you will explicitly specify the invisible columns as part of the INSERT statement.
In the moment that you decide that you want to make the column visible, you can manage to do so in a single command (ALTER TABLE table_name MODIFY column_name VISIBLE).
New Type of column which automatically generates an auto increment value upon every row insertion. It has the following options:
ALWAYS (default option) - In this option, Oracle forces the usage of the sequence generator. If an insert or update statements reference the identity column, Oracle raises an error.
BY DEFAULT - This option allows to explicitly assign a value for the column as part of an INSERT or UPDATE statements.
BY DEFAULT ON NULL - In the previous option (BY DEFAULT), If you will attempt to reference the identity column, and assign it a NULL value, you will encounter an error. Using the BY DEFAULT ON NULL option tells Oracle to use the identity generator when there is an attempt to insert a NULL to the table.
In the first demonstration, I will create a sample table named "PRODUCTS" with an identity column for the primary key, that uses the ALWAYS option. In this option, Oracle forces the usage of the sequence generator. If an insert or update statements reference the identity column, Oracle raises an error.
The "BY DEFAULT" clause is used for the identity column, which allows us to explicitly assign a value for the identity column (as long as it is not NULL), as follows:
- In the previous option (BY DEFAULT), If you will attempt to reference the identity column, and assign it a NULL value, you will encounter an error. Using the BY DEFAULT ON NULL option tells Oracle to use the identity generator when there is an attempt to insert a NULL to the table.
When creating an identity column, Oracle "behind the scenes" creates a sequence. This means that all the options that available for sequences (e.g. START WITH , INCREMENT BY, MAX_VALUE, etc.) are available for identify columns as well, as you can see in the following example
Click
It is possible to query the [CDB|DBA|ALL|USER]_tab_identity_cols dictionary view to obtain all of the table identity columns, as follows
Another enhacement in the improved defaults which was introduced in Oracle 12c, it the ability to use a sequence as a default value for a column. It can be either CURRVAL or NEXTVAL. The following is a demonstration of this feature
Demo
As you can see in this demo, Oracle will use the sequence as a default value if the column is not referenced, or if it is referenced and the value "DEFAULT" is specified. When an explicit NULL value was inserted, the default sequence value is not being used, instead, a NULL was inserted to the table.
In order to use a default sequence number even when an explicit NULL is being inserted, you can use the ON NULL clause. Let us see a demonstration of this feature
Before Oracle 11g
Prior to Oracle 11g, adding a new column with a default value to an existing table, requires updating all the rows in the table which generates lots of redo and undo, and can impact the entire database performance. Obviously, it is a very long and high consuming operation, especially if the table is big.
Oracle 11g
In Oracle 11g a new feature named "Metadata-only value" was introduced. This means that upon every new column addition with a default value, Oracle will not update every row in a table, but rather make a small metadata-only change in the data dictionary. As a result, every time that a user queries the table, Oracle will obtain the default value from the data dictionary. This feature allows us to add a new column with a default value within milliseconds instead of waiting for a long time and without generating lots of redo and undo which may impact the entire database.
In the following example, a table named "TEST" is being created and populated with 100,000 rows.Click
Now, we will test how much time it takes to add a new column with a default value
Click
As you can see in the above demonstration, the column addition operation completed instantly.However, this feature works only if the column was added with the NOT NULL constraint.Let us see what will happen if we will try to add a nullable column with a default value (i.e. a column that doesn't have the NOT NULL constraint)
Click
Now, the operation took more than 1 minute! This table is only populated with 100K rows. Imagine how much time it would take if a table contains hundreds of millions of rows ...
Click
As you can see, in Oracle 12c adding a column with a default value is an instant operation, regardless of the the nullable attribute.
Before Oracle 12c in order to support strings longer than 4000 bytes we mainly used LOB. If you decide to enable this feature you will need to take into account that internally Oracle is storing these extended types in out-of-line LOB segments but you can't manage these lob segments using DBMS_LOB as Oracle is managing them internally.
From my point of view I think this feature can be useful although its biggest disadvantage is that it requires downtime to enable it which can be problematic for many Oracle customers.
Limiting the number of rows returned from ordered sets of data, which is also known as Top-N queries is a common use-case. Examples of Top-N queries could be:
Query the top 3 employees with the highest salaries
Query the first 2 employees who have joined the company
Click
Prior to Oracle 12c we had to use the ROWNUM pseudo column in order to implement Top-N reporting. Using the ROWNUM pseudo column had worked well, however it had major disadvantages:
It's not a straight-forward syntax, especially if you need to implement query paging such as query the second block of the top 3 employees with the highest salaries.
It allows us specifying the Top-N rows but it doesn't allows specifying the Top-N percent (for example, query the top 25% percent of employees with the highest salaries.
Moving data files is a common use-case, for example, when DBA wants to move data file to a faster disk or larger disk. Or DBA wants to migrate the data files from traditional file system to ASM. Before Oracle 12c, this task was a painful because it required a downtime.
Common Solution
Take tablespace offline
Move data file to a new location using OS command
Change the location of data file using DB command “ALTER DATABASE” command
A common workaround to improve the downtime was to take the tablespace to a READ ONLY state which make the process less painful, but a shortdown was still required.
Oracle 11g Introduced a nice feature named "Invisible Indexes" which allows us to mark an index as invisible. This index will still be maintained by Oracle during DML operations like a "regular" index but it is being ignored by the optimizer, i.e. execution plans will not use the invisible indexes.
Click
Oracle 12c leverages the "Invisible Indexes" feature by allowing us create multiple indexes on the same column or set of columns, as long as only one index is visible and all the indexes are different, i.e. it is impossible to create 2 B-Tree indexes on the same column, even if one of them is invisible.
This can be useful when you want to test the impact of different indexes easily without dropping and creating a new index. However, it is important to bear in mind that additional indexes means additional overhead during DML operations. This additional overhead is necessary in order to maintain the indexes, therefore use this feature with cautious
RMAN Table point-in-time recovery can be very useful in the following cases :
The table was truncated - so you can't use the 10g Flashback Table feature as the undo is not available
The table was dropped with the purge clause -so you can't use the 10g Flashback Drop feature
Table was logically corrupted and no undo is available - so you can't use the 10g Flashback Table feature
Table was logically corrupted and a DDL operation modified the structure of the table - so you can't use the 10g Flashback Table feature in order to flashback the table prior to the DDL
This feature requires minimum work and effort from the DBA
Due to the fact that as part of the recovery process RMAN needs to restore an auxiliary instance, and also export and import the relevant table/s, this whole process has an overhead (mainly in terms of I/O load), therefore If you can use other options for recovering the table (such as Flashback Table/Flashback Drop) you should use them and avoid using this feature. Also, table-recovery using this feature takes much longer than using the Flashback drop/Flashback table
When you can't use Flashback drop/Flashback table to recover the table, you may find this feature very useful.
This feature is available with the Enterprise Edition only
Problem: Oracle 11gR2 required that a user account had been granted the SYSDBA privilege to perform any RMAN backup, restoration, or recovery operation. The problem with this approach is that the user who is responsible to backup the database has an access to the data and in some companies it is important to have a separation of duty.
Solution: Oracle 12cR1 now provides the SYSBACKUP privilege that limits a user account to handle just these tasks.
SYSBACKUP administrative privilege allows performing backup and recovery operations. This includes performing STARTUP and SHUTDOWN operations.