SlideShare a Scribd company logo
1 of 86
DBA Commands and Concepts
That Every Developer Should
Know
Presented by: Alex Zaballa, Oracle DBA
Alex Zaballa
http://alexzaballa.blogspot.com/
@alexzaballa206 and counting…
https://www.linkedin.com/in/alexzaballa
Worked for 7 years in Brazil as an Oracle Developer.
2000 - 2007
Worked for 8 years in Angola as an Oracle DBA
for the Ministry of Finance.
2007 - 2015
Availability of Oracle Database 12.2
Oracle Announces Beta Availability of Oracle Database 12c Release 2 - Oct 26,
2015
• PLUGGABLE DATABASES
From 252 to 4096
• HOT CLONING
Don’t need to put the source in read-only for cloning
• SHARDING
It’s like partitioning in a shared nothing database
The data is split into multiple databases
• In-Memory
In-Memory column Store on Active Data Guard
Heat Map
• APPLICATION CONTAINER
Pluggable Databases will share application objects
• More isolation, resource manager will limit the memory in addition to CPU and I/O.
• AWR will work on Active Data Guard Database: you can tune your reporting database
Availability of Oracle Database 12.2
Source: https://blogs.oracle.com/UPGRADE/entry/oracle_database_12_2_just
Oracle Database Release Status
MOS Note:742060.1
DBA Commands and Concepts That Every
Developer Should Know
No DBA access to the Database?
No DBA access to the Database?
eDB360 sample
No DBA access to the Database?
No DBA access to the Database?
SQLD360 sample
insert /*+ append parallel */ into tab1 select /*+
parallel */ * from tab2 nologging;
15 minutes to complete.
create table tab1 as select /*+ parallel */ * from
tab2 nologging;
2 minutes to complete.
Parallel
Parallel
Source: https://docs.oracle.com/database/121/VLDBG/GUID-5EB01FA8-030B-45BB-9B16-2D13881F6010.htm
Parallel
Parallel
Update I$_2258193201
set IND_UPDATE = 1
where exists (
select 1
from XX T
where I$_2258193201.X_REF_DT = T.X_REF_DT
and I$_2258193201XX.X_ACCT_KEY = T.X_ACCT_KEY
);
60 minutes to complete.
Parallel
Update /*+ PARALLEL */ I$_2258193201_NEW I$_2258193201
set IND_UPDATE = 1
where exists (
select /*+ PARALLEL */ 1
from XX_NEW T
where I$_2258193201.X_REF_DT = T.X_REF_DT
and I$_2258193201XX.X_ACCT_KEY = T.X_ACCT_KEY
);
3 minutes to complete.
***Duplicate tables “_NEW”
Parallel
Update /*+ PARALLEL */ I$_2258193201
set IND_UPDATE = 1
where exists (
select /*+ PARALLEL */ 1
from XX T
where I$_2258193201.X_REF_DT = T.X_REF_DT
and I$_2258193201XX.X_ACCT_KEY = T.X_ACCT_KEY
);
240 minutes to complete.
Parallel
Full Table Scan: db file scattered read
Parallel
Parallel
Parallel
Row chaining/Migration
"A migrated row is a row that was moved to another block due to an update making it too
large to fit on its original block with the other rows there”
"Any table with a long/long raw will have chained rows”
"Any table with more than 255 columns will have chained rows”
"Any table whose rowsize exceeds the blocksize will have chained rows"
Increasing PCTFREE can help to avoid migrated rows.
Explain Plan
How many people are using
Explain Plan ?
Explain Plan
Explain Plan Lies
Explain Plan
Explain Plan just try to predict the Plan.
AUTOTRACE experiences a similar "problem”, especially when
the SQL statement uses bind variables.
Explain Plan
Solution ?
DBMS_XPLAN.DISPLAY_CURSOR
DEMO
Oracle Flashback Query
• Flashback Query (SELECT AS OF)
 AS OF TIMESTAMP
• Flashback Version Query
 VERSIONS BETWEEN { SCN | TIMESTAMP } start
AND end
• Flashback Transaction Query
 SELECT FROM flashback_transaction_query
DEMO
• Retrieve old versions of procedures:
select text from dba_source
as of timestamp systimestamp - interval '5' minute
where name='MY_PROC' order by line;
Oracle Flashback Query
DEMO
Oracle Flashback Query
The maximum available versions are dependent on the
UNDO_RETENTION parameter.
The default is 900 seconds (15 minutes).
Oracle Flashback Table
Reinstating an accidentally dropped table.
Parameter recyclebin = on (default).
SELECT OWNER,OBJECT_NAME,
ORIGINAL_NAME, TYPE, DROPTIME
FROM DBA_RECYCLEBIN
WHERE ORIGINAL_NAME='TAB_TEST';
FLASHBACK TABLE TAB_TEST TO BEFORE DROP;
Oracle Flashback Table
DEMO
RMAN Table Recovery in 12c
RMAN enables you to recover one or more
tables or table partitions to a specified point in
time.
RMAN Table Recovery in 12c
RMAN> RECOVER TABLE HR.REGIONS
UNTIL TIME "TO_DATE('01/10/2013
09:33:39','DD/MM/RRRR HH24:MI:SS')"
AUXILIARY DESTINATION '/tmp/backups'
Schema Management
DDL Wait Option
SQL> alter table invoice add (code number);
alter table invoice add (code number)
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT
specified or timeout expired
Schema Management
DDL Wait Option
Parameter DDL_LOCK_TIMEOUT (default = 0)
It will wait for N seconds.
In that N seconds, it continually re-tries the DDL
operation until it's successful or this time
expires.
DEMO
Schema Management
Adding Columns with a Default Value
Table T1  3 millions rows
10.2.0.4.0 > alter table t1 add C_DDL number default 42 not null;
Table altered.
Elapsed: 00:00:48.53
11.2.0.3.0> alter table t1 add C_DDL number default 42 not null;
Table altered.
Elapsed: 00:00:00.04
http://www.oracle.com/technetwork/pt/articles/sql/otimizacao-comandos-ddl-oracle-11g-2226731-ptb.html
DEMO
Rollback
How much longer?
select *
from v$session_longops
where sid = sid_of_the_session_doing_rollback
Rollback
Source: https://docs.oracle.com/cloud/latest/db121/REFRN/refrn30227.htm#REFRN30227
Rollback
SID : 26
SERIAL# : 30832
OPNAME : Transaction Rollback
TARGET :
TARGET_DESC : xid:0x000e.01c.00000012
SOFAR : 1211
TOTALWORK : 21244
UNITS : Blocks
START_TIME : 15-nov-2015 16:20:07
LAST_UPDATE_TIME : 15-nov-2015 16:21:24
TIME_REMAINING : 55
ELAPSED_SECONDS : 5
CONTEXT : 0
MESSAGE : Transaction Rollback: .... USERNAME
: alex_zaballa
SQL_ADDRESS : 00000000DF79A840
SQL_HASH_VALUE : 72257521
SQL_ID : 4wv9a0h24x3zj
Pending Statistics
We have the option of keeping the newly gathered statistics in a pending
state for testing purposes, until you choose to publish them.
Set table preferences:
begin
dbms_stats.set_table_prefs (
ownname => 'SCOTT',
tabname => 'EMP',
pname => 'PUBLISH',
pvalue => 'FALSE'
);
end;
Collect the statistics.
Pending Statistics
select num_rows,
to_char(last_analyzed,'dd/mm/rrrr hh24:mi:ss')
from all_tab_pending_stats
where table_name = 'EMP';
Pending Statistics
alter session set
optimizer_use_pending_statistics = true;
Test the queries.
Pending Statistics
If it’s ok:
dbms_stats.publish_pending_stats('SCOTT', 'EMP');
Or:
dbms_stats.delete_pending_stats(’SCOTT',’EMP');
Restore Statistics from History
Check the retention:
select
DBMS_STATS.GET_STATS_HISTORY_RETENTION
from dual;
Default is 31 days.
Restore Statistics from History
Statistics available for the table:
SELECT OWNER,
TABLE_NAME,
STATS_UPDATE_TIME
FROM dba_tab_stats_history
WHERE table_name='MY_TABLE';
Restore Statistics from History
Begin
dbms_stats.restore_table_stats(
'SCOTT',
'EMP',
‘08-NOV-15 11.38.05.015640 AM +08:00’);
End;
Export and Import schema statistics
begin
dbms_stats.CREATE_STAT_TABLE( ownname=>user
, stattab=>'MY_STATS_TABLE'
);
end;
begin
dbms_stats.export_schema_stats( ownname=>user
, stattab=>'MY_STATS_TABLE'
, statid=>'CURRENT_STATS'
);
End;
EXPDP / IMPDP
begin
dbms_stats.import_schema_stats( ownname=>user
, stattab=>'MY_STATS_TABLE'
, statid=>'CURRENT_STATS'
);
End;
DBMS_APPLICATION_INFO
Allows programs to add information to the
V$SESSION.
Use SET_MODULE to set the name for the program that
the user is currently executing. Optionally you can also
set an action name.
Use SET_ACTION for subsequent processing.
Use SET_CLIENT_INFO for any additional information.
DEMO
Row-by-Row Processing vs Bulk
Processing
Instead of fetching a single row at a time it is
possible to use the bulk features.
DEMO
Oracle Virtual Private Database (VPD)
• VPD enables you to create security policies to control
database access at the row and column level.
• VPD adds a dynamic WHERE clause to a SQL statement.
• VPD enforces security directly on database tables,
views, or synonyms.
Oracle Virtual Private Database (VPD)
Original Select:
SELECT * FROM ORDERS;
VPD policy dynamically appends:
SELECT * FROM ORDERS
WHERE COMPANY_ID = 1;
DEMO
More on 12c
Extended Data Types
SQL> create table tabela_teste(campo01
varchar2(4001));
*
ERROR at line 1:
ORA-00910: specified length too long for its
datatype
Extended Data Types
- VARCHAR2 : 32767 bytes
- NVARCHAR2 : 32767 bytes
- RAW : 32767 bytes
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
SQL Text Expansion
SQL> variable retorno clob
SQL> begin
dbms_utility.expand_sql_text( input_sql_text
=> 'select * from emp', output_sql_text=>
:retorno );
end;
SQL Text Expansion
• Views
• VPDs
DEMO
Identity Columns
CREATE TABLE tabela_teste (
id NUMBER GENERATED ALWAYS AS IDENTITY,
coluna1 VARCHAR2(30));
Identity Columns
CREATE TABLE tabela_teste (
id NUMBER GENERATED BY DEFAULT AS IDENTITY,
coluna1 VARCHAR2(30));
DEMO
READ Object Privilege and READ ANY
TABLE System Privilege
What is the difference to SELECT and SELECT
ANY TABLE?
READ Object Privilege and READ ANY
TABLE System Privilege
SELECT and SELECT ANY TABLE provides the
ability to lock rows:
LOCK TABLE table_name IN EXCLUSIVE MODE;
SELECT ... FROM table_name FOR UPDATE;
READ Object Privilege and READ ANY
TABLE System Privilege
SQL> grant select on scott.emp to teste;
Grant succeeded.
SQL> lock table scott.emp in exclusive mode;
Table(s) Locked.
READ Object Privilege and READ ANY
TABLE System Privilege
SQL> grant read on scott.emp to teste;
Grant succeeded.
SQL> lock table scott.emp in exclusive mode;
lock table scott.emp in exclusive mode
*
ERROR at line 1:
ORA-01031: insufficient privileges
DEMO
Virtual Columns
“Virtual columns appear to be normal table
columns, but their values are derived rather
than being stored on disc.”
DEMO
UTL_CALL_STACK
This package allow programmatic access to the call
stack and error stack.
Before 12c: DBMS_UTILITY.FORMAT_CALL_STACK
DEMO
Online Table Redefinition
(DBMS_REDEFINITION)
You can change the structure of a table that is
already in use and is impossible to get a
maintenance downtime.
DEMO
SQLcl
http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
Thank You
Slides Available: http://www.slideshare.net/

More Related Content

What's hot

Oracle Database 12c - Data Redaction
Oracle Database 12c - Data RedactionOracle Database 12c - Data Redaction
Oracle Database 12c - Data RedactionAlex Zaballa
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for DevelopersCompleteITProfessional
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14Alex Zaballa
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Alex Zaballa
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data RedactionAlex Zaballa
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cDavid Yahalom
 
Flex Cluster e Flex ASM - GUOB Tech Day - OTN TOUR LA Brazil 2014
Flex Cluster e Flex ASM - GUOB Tech Day - OTN TOUR LA Brazil 2014Flex Cluster e Flex ASM - GUOB Tech Day - OTN TOUR LA Brazil 2014
Flex Cluster e Flex ASM - GUOB Tech Day - OTN TOUR LA Brazil 2014Alex Zaballa
 
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015Alex Zaballa
 
Sql Server 2008 New Programmability Features
Sql Server 2008 New Programmability FeaturesSql Server 2008 New Programmability Features
Sql Server 2008 New Programmability Featuressqlserver.co.il
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsNirav Shah
 
Oracle Data redaction - GUOB - OTN TOUR LA - 2015
Oracle Data redaction - GUOB - OTN TOUR LA - 2015Oracle Data redaction - GUOB - OTN TOUR LA - 2015
Oracle Data redaction - GUOB - OTN TOUR LA - 2015Alex Zaballa
 
Oracle Data Redaction - EOUC
Oracle Data Redaction - EOUCOracle Data Redaction - EOUC
Oracle Data Redaction - EOUCAlex Zaballa
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015Yury Velikanov
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsDave Stokes
 

What's hot (18)

Oracle Database 12c - Data Redaction
Oracle Database 12c - Data RedactionOracle Database 12c - Data Redaction
Oracle Database 12c - Data Redaction
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for Developers
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should Know
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data Redaction
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12c
 
Flex Cluster e Flex ASM - GUOB Tech Day - OTN TOUR LA Brazil 2014
Flex Cluster e Flex ASM - GUOB Tech Day - OTN TOUR LA Brazil 2014Flex Cluster e Flex ASM - GUOB Tech Day - OTN TOUR LA Brazil 2014
Flex Cluster e Flex ASM - GUOB Tech Day - OTN TOUR LA Brazil 2014
 
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
 
Sql Server 2008 New Programmability Features
Sql Server 2008 New Programmability FeaturesSql Server 2008 New Programmability Features
Sql Server 2008 New Programmability Features
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tips
 
Oracle Data redaction - GUOB - OTN TOUR LA - 2015
Oracle Data redaction - GUOB - OTN TOUR LA - 2015Oracle Data redaction - GUOB - OTN TOUR LA - 2015
Oracle Data redaction - GUOB - OTN TOUR LA - 2015
 
Oracle Data Redaction - EOUC
Oracle Data Redaction - EOUCOracle Data Redaction - EOUC
Oracle Data Redaction - EOUC
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query Optimizations
 

Similar to OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know

DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2Alex Zaballa
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2Alex Zaballa
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
 
SQL/MX 3.6 Select for update feature
SQL/MX 3.6 Select for update featureSQL/MX 3.6 Select for update feature
SQL/MX 3.6 Select for update featureFrans Jongma
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features IDenish Patel
 
Oracle 12c Automatic Data Optimization (ADO) - ILM
Oracle 12c Automatic Data Optimization (ADO) - ILMOracle 12c Automatic Data Optimization (ADO) - ILM
Oracle 12c Automatic Data Optimization (ADO) - ILMMonowar Mukul
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01Karam Abuataya
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11gfcamachob
 
Introduction to Oracle Database.pptx
Introduction to Oracle Database.pptxIntroduction to Oracle Database.pptx
Introduction to Oracle Database.pptxSiddhantBhardwaj26
 
Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2nesmaddy
 
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...Jürgen Ambrosi
 

Similar to OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know (20)

DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 
Less09 Data
Less09 DataLess09 Data
Less09 Data
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
 
SQL/MX 3.6 Select for update feature
SQL/MX 3.6 Select for update featureSQL/MX 3.6 Select for update feature
SQL/MX 3.6 Select for update feature
 
DOODB_LAB.pptx
DOODB_LAB.pptxDOODB_LAB.pptx
DOODB_LAB.pptx
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features I
 
Sherlock holmes for dba’s
Sherlock holmes for dba’sSherlock holmes for dba’s
Sherlock holmes for dba’s
 
Msql
Msql Msql
Msql
 
Oracle 12c Automatic Data Optimization (ADO) - ILM
Oracle 12c Automatic Data Optimization (ADO) - ILMOracle 12c Automatic Data Optimization (ADO) - ILM
Oracle 12c Automatic Data Optimization (ADO) - ILM
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11g
 
Introduction to Oracle Database.pptx
Introduction to Oracle Database.pptxIntroduction to Oracle Database.pptx
Introduction to Oracle Database.pptx
 
Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2
 
Beginbackup
BeginbackupBeginbackup
Beginbackup
 
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
 

Recently uploaded

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Recently uploaded (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know

  • 1. DBA Commands and Concepts That Every Developer Should Know Presented by: Alex Zaballa, Oracle DBA
  • 2. Alex Zaballa http://alexzaballa.blogspot.com/ @alexzaballa206 and counting… https://www.linkedin.com/in/alexzaballa
  • 3. Worked for 7 years in Brazil as an Oracle Developer. 2000 - 2007 Worked for 8 years in Angola as an Oracle DBA for the Ministry of Finance. 2007 - 2015
  • 4.
  • 5. Availability of Oracle Database 12.2
  • 6. Oracle Announces Beta Availability of Oracle Database 12c Release 2 - Oct 26, 2015 • PLUGGABLE DATABASES From 252 to 4096 • HOT CLONING Don’t need to put the source in read-only for cloning • SHARDING It’s like partitioning in a shared nothing database The data is split into multiple databases • In-Memory In-Memory column Store on Active Data Guard Heat Map • APPLICATION CONTAINER Pluggable Databases will share application objects • More isolation, resource manager will limit the memory in addition to CPU and I/O. • AWR will work on Active Data Guard Database: you can tune your reporting database
  • 7. Availability of Oracle Database 12.2 Source: https://blogs.oracle.com/UPGRADE/entry/oracle_database_12_2_just
  • 8. Oracle Database Release Status MOS Note:742060.1
  • 9. DBA Commands and Concepts That Every Developer Should Know
  • 10. No DBA access to the Database?
  • 11. No DBA access to the Database? eDB360 sample
  • 12. No DBA access to the Database?
  • 13. No DBA access to the Database? SQLD360 sample
  • 14. insert /*+ append parallel */ into tab1 select /*+ parallel */ * from tab2 nologging; 15 minutes to complete. create table tab1 as select /*+ parallel */ * from tab2 nologging; 2 minutes to complete. Parallel
  • 17. Parallel Update I$_2258193201 set IND_UPDATE = 1 where exists ( select 1 from XX T where I$_2258193201.X_REF_DT = T.X_REF_DT and I$_2258193201XX.X_ACCT_KEY = T.X_ACCT_KEY ); 60 minutes to complete.
  • 18. Parallel Update /*+ PARALLEL */ I$_2258193201_NEW I$_2258193201 set IND_UPDATE = 1 where exists ( select /*+ PARALLEL */ 1 from XX_NEW T where I$_2258193201.X_REF_DT = T.X_REF_DT and I$_2258193201XX.X_ACCT_KEY = T.X_ACCT_KEY ); 3 minutes to complete. ***Duplicate tables “_NEW”
  • 19. Parallel Update /*+ PARALLEL */ I$_2258193201 set IND_UPDATE = 1 where exists ( select /*+ PARALLEL */ 1 from XX T where I$_2258193201.X_REF_DT = T.X_REF_DT and I$_2258193201XX.X_ACCT_KEY = T.X_ACCT_KEY ); 240 minutes to complete.
  • 20. Parallel Full Table Scan: db file scattered read
  • 24. Row chaining/Migration "A migrated row is a row that was moved to another block due to an update making it too large to fit on its original block with the other rows there” "Any table with a long/long raw will have chained rows” "Any table with more than 255 columns will have chained rows” "Any table whose rowsize exceeds the blocksize will have chained rows" Increasing PCTFREE can help to avoid migrated rows.
  • 25. Explain Plan How many people are using Explain Plan ?
  • 27. Explain Plan Explain Plan just try to predict the Plan. AUTOTRACE experiences a similar "problem”, especially when the SQL statement uses bind variables.
  • 29. DEMO
  • 30. Oracle Flashback Query • Flashback Query (SELECT AS OF)  AS OF TIMESTAMP • Flashback Version Query  VERSIONS BETWEEN { SCN | TIMESTAMP } start AND end • Flashback Transaction Query  SELECT FROM flashback_transaction_query
  • 31. DEMO
  • 32. • Retrieve old versions of procedures: select text from dba_source as of timestamp systimestamp - interval '5' minute where name='MY_PROC' order by line; Oracle Flashback Query
  • 33. DEMO
  • 34. Oracle Flashback Query The maximum available versions are dependent on the UNDO_RETENTION parameter. The default is 900 seconds (15 minutes).
  • 35. Oracle Flashback Table Reinstating an accidentally dropped table. Parameter recyclebin = on (default).
  • 36. SELECT OWNER,OBJECT_NAME, ORIGINAL_NAME, TYPE, DROPTIME FROM DBA_RECYCLEBIN WHERE ORIGINAL_NAME='TAB_TEST'; FLASHBACK TABLE TAB_TEST TO BEFORE DROP; Oracle Flashback Table
  • 37. DEMO
  • 38. RMAN Table Recovery in 12c RMAN enables you to recover one or more tables or table partitions to a specified point in time.
  • 39. RMAN Table Recovery in 12c RMAN> RECOVER TABLE HR.REGIONS UNTIL TIME "TO_DATE('01/10/2013 09:33:39','DD/MM/RRRR HH24:MI:SS')" AUXILIARY DESTINATION '/tmp/backups'
  • 40. Schema Management DDL Wait Option SQL> alter table invoice add (code number); alter table invoice add (code number) * ERROR at line 1: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
  • 41. Schema Management DDL Wait Option Parameter DDL_LOCK_TIMEOUT (default = 0) It will wait for N seconds. In that N seconds, it continually re-tries the DDL operation until it's successful or this time expires.
  • 42. DEMO
  • 43. Schema Management Adding Columns with a Default Value Table T1  3 millions rows 10.2.0.4.0 > alter table t1 add C_DDL number default 42 not null; Table altered. Elapsed: 00:00:48.53 11.2.0.3.0> alter table t1 add C_DDL number default 42 not null; Table altered. Elapsed: 00:00:00.04 http://www.oracle.com/technetwork/pt/articles/sql/otimizacao-comandos-ddl-oracle-11g-2226731-ptb.html
  • 44. DEMO
  • 45. Rollback How much longer? select * from v$session_longops where sid = sid_of_the_session_doing_rollback
  • 47. Rollback SID : 26 SERIAL# : 30832 OPNAME : Transaction Rollback TARGET : TARGET_DESC : xid:0x000e.01c.00000012 SOFAR : 1211 TOTALWORK : 21244 UNITS : Blocks START_TIME : 15-nov-2015 16:20:07 LAST_UPDATE_TIME : 15-nov-2015 16:21:24 TIME_REMAINING : 55 ELAPSED_SECONDS : 5 CONTEXT : 0 MESSAGE : Transaction Rollback: .... USERNAME : alex_zaballa SQL_ADDRESS : 00000000DF79A840 SQL_HASH_VALUE : 72257521 SQL_ID : 4wv9a0h24x3zj
  • 48. Pending Statistics We have the option of keeping the newly gathered statistics in a pending state for testing purposes, until you choose to publish them. Set table preferences: begin dbms_stats.set_table_prefs ( ownname => 'SCOTT', tabname => 'EMP', pname => 'PUBLISH', pvalue => 'FALSE' ); end; Collect the statistics.
  • 49. Pending Statistics select num_rows, to_char(last_analyzed,'dd/mm/rrrr hh24:mi:ss') from all_tab_pending_stats where table_name = 'EMP';
  • 50. Pending Statistics alter session set optimizer_use_pending_statistics = true; Test the queries.
  • 51. Pending Statistics If it’s ok: dbms_stats.publish_pending_stats('SCOTT', 'EMP'); Or: dbms_stats.delete_pending_stats(’SCOTT',’EMP');
  • 52. Restore Statistics from History Check the retention: select DBMS_STATS.GET_STATS_HISTORY_RETENTION from dual; Default is 31 days.
  • 53. Restore Statistics from History Statistics available for the table: SELECT OWNER, TABLE_NAME, STATS_UPDATE_TIME FROM dba_tab_stats_history WHERE table_name='MY_TABLE';
  • 54. Restore Statistics from History Begin dbms_stats.restore_table_stats( 'SCOTT', 'EMP', ‘08-NOV-15 11.38.05.015640 AM +08:00’); End;
  • 55. Export and Import schema statistics begin dbms_stats.CREATE_STAT_TABLE( ownname=>user , stattab=>'MY_STATS_TABLE' ); end; begin dbms_stats.export_schema_stats( ownname=>user , stattab=>'MY_STATS_TABLE' , statid=>'CURRENT_STATS' ); End; EXPDP / IMPDP begin dbms_stats.import_schema_stats( ownname=>user , stattab=>'MY_STATS_TABLE' , statid=>'CURRENT_STATS' ); End;
  • 56. DBMS_APPLICATION_INFO Allows programs to add information to the V$SESSION. Use SET_MODULE to set the name for the program that the user is currently executing. Optionally you can also set an action name. Use SET_ACTION for subsequent processing. Use SET_CLIENT_INFO for any additional information.
  • 57. DEMO
  • 58. Row-by-Row Processing vs Bulk Processing Instead of fetching a single row at a time it is possible to use the bulk features.
  • 59. DEMO
  • 60. Oracle Virtual Private Database (VPD) • VPD enables you to create security policies to control database access at the row and column level. • VPD adds a dynamic WHERE clause to a SQL statement. • VPD enforces security directly on database tables, views, or synonyms.
  • 61. Oracle Virtual Private Database (VPD) Original Select: SELECT * FROM ORDERS; VPD policy dynamically appends: SELECT * FROM ORDERS WHERE COMPANY_ID = 1;
  • 62. DEMO
  • 64. Extended Data Types SQL> create table tabela_teste(campo01 varchar2(4001)); * ERROR at line 1: ORA-00910: specified length too long for its datatype
  • 65. Extended Data Types - VARCHAR2 : 32767 bytes - NVARCHAR2 : 32767 bytes - RAW : 32767 bytes
  • 66. 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
  • 67. SQL Text Expansion SQL> variable retorno clob SQL> begin dbms_utility.expand_sql_text( input_sql_text => 'select * from emp', output_sql_text=> :retorno ); end;
  • 68. SQL Text Expansion • Views • VPDs
  • 69. DEMO
  • 70. Identity Columns CREATE TABLE tabela_teste ( id NUMBER GENERATED ALWAYS AS IDENTITY, coluna1 VARCHAR2(30));
  • 71. Identity Columns CREATE TABLE tabela_teste ( id NUMBER GENERATED BY DEFAULT AS IDENTITY, coluna1 VARCHAR2(30));
  • 72. DEMO
  • 73. READ Object Privilege and READ ANY TABLE System Privilege What is the difference to SELECT and SELECT ANY TABLE?
  • 74. READ Object Privilege and READ ANY TABLE System Privilege SELECT and SELECT ANY TABLE provides the ability to lock rows: LOCK TABLE table_name IN EXCLUSIVE MODE; SELECT ... FROM table_name FOR UPDATE;
  • 75. READ Object Privilege and READ ANY TABLE System Privilege SQL> grant select on scott.emp to teste; Grant succeeded. SQL> lock table scott.emp in exclusive mode; Table(s) Locked.
  • 76. READ Object Privilege and READ ANY TABLE System Privilege SQL> grant read on scott.emp to teste; Grant succeeded. SQL> lock table scott.emp in exclusive mode; lock table scott.emp in exclusive mode * ERROR at line 1: ORA-01031: insufficient privileges
  • 77. DEMO
  • 78. Virtual Columns “Virtual columns appear to be normal table columns, but their values are derived rather than being stored on disc.”
  • 79. DEMO
  • 80. UTL_CALL_STACK This package allow programmatic access to the call stack and error stack. Before 12c: DBMS_UTILITY.FORMAT_CALL_STACK
  • 81. DEMO
  • 82. Online Table Redefinition (DBMS_REDEFINITION) You can change the structure of a table that is already in use and is impossible to get a maintenance downtime.
  • 83. DEMO
  • 85.
  • 86. Thank You Slides Available: http://www.slideshare.net/