6. 6
Full Database Caching
DB size > Buffer Cache
Little tables:
• Allocated in memory If the table size < 2% of the Buffer Cache size
Medium tables:
• Allocated in memory if table size [2%,10%] of Buffer Cache size (No official
information)
• Oracle analyze the date when the table was used last time
• Free space in Buffer Cache
• Etc
Big Tables
• Big tables are not allocated in Buffer Cache
• Use "KEEP” to advice Oracle to allocate a big table in Buffer Cache
7. 7
Full Database Caching
Buffer Cache > DB size
Little tables:
• Allocated in memory If the table size < 2% of the Buffer Cache size
Medium tables:
• Allocated in memory if table size [2%,10%] of Buffer Cache size (No official
information)
• Oracle analyze the date when the table was used last time
• Free space in Buffer Cache
• Etc
Big Tables
• Big tables are not allocated in Buffer Cache
• Use "KEEP” to advice Oracle to allocate a big table in Buffer Cache
10. PDB File Placement in OMF
• FILE_NAME_CONVERT clause of CREATE PLUGGABLE DATABASE
• CREATE_FILE_DEST clause of CREATE PLUGGABLE DATABASE
• DB_CREATE_FILE_DEST (root level)
• PDB_FILE_NAME_CONVERT initialization parameter
11. PDB Logging Clause
• Table Level – Logging
• Index Level – Logging
• Tablespace Level – Logging
• Tablespace Level - Force Logging
• PDB Level – Logging
• PDB Level - Force No logging
• CDB - Force Logging
12. PDB Metadata Clone
NO DATA clause of the CREATE PLUGGABLE DATABASE
“This clause is useful for quickly creating clones of a PDB with
only the object definitions and no data.”
27. JSON
OTN Article by Alex Zaballa
http://www.oracle.com/technetwork/pt/articles
/sql/json-oracle-database-12c-2378776-
ptb.html
28. JSON
• Oracle Database 12.1.0.2 has now native
support for JSON.
• “JSON (JavaScript Object Notation) is a
lightweight data-interchange format. It is easy
for humans to read and write. It is easy for
machines to parse and generate.”
Source: http://json.org/
32. Data Redaction
OTN Article in English by Alex Zaballa
http://www.oracle.com/technetwork/articles/d
atabase/data-redaction-odb12c-2331480.html
33. Data Redaction
• One of the new features introduced in Oracle
Database 12c
• Part of the Advanced Security option
• Enables the protection of data shown to the
user in real time, without requiring changes to
the application
37. SQL Query Row Limits
and Offsets
create table tabela_teste (codigo number, nome varchar2(20), salario
number);
insert into tabela_teste values (1,'Alex' ,100);
insert into tabela_teste values (2,'Joao' ,200);
insert into tabela_teste values (3,'Maria' ,300);
insert into tabela_teste values (4,'Pedro',400);
insert into tabela_teste values (5,'Paulo',500);
insert into tabela_teste values (6,'Fernando',600);
insert into tabela_teste values (7,'Rafael',700);
insert into tabela_teste values (8,'Samuel',700);
insert into tabela_teste values (9,'Daniel',800);
insert into tabela_teste values (10,'Luciano',1000);
38. SQL Query Row Limits
and Offsets
Top-N Queries – Pré 12c
select * from ( select codigo, nome, salario
from tabela_teste
order by salario desc)
where rownum <= 5
39. SQL Query Row Limits
and Offsets
select codigo, nome, salario
from tabela_teste
order by salario desc
FETCH FIRST 5 ROWS ONLY
40. SQL Query Row Limits
and Offsets
select codigo, nome, salario
from tabela_teste
order by salario
FETCH FIRST 30 PERCENT ROWS ONLY
41. SQL Query Row Limits
and Offsets
select codigo, nome, salario
from tabela_teste
order by salario desc
OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY;
42. Invisible Columns
CREATE TABLE tabela_teste
(
coluna1 NUMBER,
coluna2 NUMBER,
coluna3 NUMBER INVISIBLE,
coluna4 NUMBER
);
SQL> desc tabela_teste
Name
-----------------------------------------
COLUNA1 NUMBER
COLUNA2 NUMBER
COLUNA4 NUMBER
43. Invisible Columns
INSERT INTO tabela_teste
(coluna1,coluna2,coluna3,coluna4) VALUES
(1,2,3,4);
INSERT INTO tabela_teste VALUES (1,2,4);
44. Invisible Columns
SET COLINVISIBLE ON
SQL> desc tabela_teste
Name
-----------------------------------------
COLUNA1 NUMBER
COLUNA2 NUMBER
COLUNA4 NUMBER
COLUNA3 (INVISIBLE) NUMBER
48. PL/SQL From SQL
with
function Is_Number
(x in varchar2) return varchar2 is
Plsql_Num_Error exception;
pragma exception_init(Plsql_Num_Error, -06502);
begin
if (To_Number(x) is NOT null) then
return 'Y';
else
return '';
end if;
exception
when Plsql_Num_Error then
return 'N';
end Is_Number;
select rownum, x, is_number(x) is_num from t;
49. Session Level Sequences
Session level sequences are used to produce
unique values in a session. Once the session
ends, the sequence is reset.
Generating Primary Keys for a Global Temporary
Table would be a field where those kinds of
sequences could be used.
52. Extended Data Types
SQL> create table tabela_teste(campo01
varchar2(4001));
*
ERROR at line 1:
ORA-00910: specified length too long for its
datatype
53. Extended Data Types
- VARCHAR2 : 32767 bytes
- NVARCHAR2 : 32767 bytes
- RAW : 32767 bytes
54. Extended Data Types
SHUTDOWN IMMEDIATE;
STARTUP UPGRADE;
ALTER SYSTEM SET max_string_size=extended;
@?/rdbms/admin/utl32k.sql
SHUTDOWN IMMEDIATE;
STARTUP;
**Once you switch to extended data types you can't switch back