Pages

Tuesday, December 16, 2014

PL/SQL Reference V - New stuff in Oracle 11G

===========================================
Sequence in PL/SQL
===========================================
Pre Oracle 11G:
SELECT my_seq.NEXTVAL INTO v_new_id FROM DUAL;
Starting in Oracle 11G
v_new_id := my_seq.NEXTVAL;

===========================================
CONTINUE
===========================================
New command in PL/SQL in Oracle 11G.
Used in FOR LOOP, to jump to the end or current iteration.

===========================================
Passing parameters to a routine with Named and Mixed Notation.
===========================================
Positional Notation:
SELECT my_func(10,7) FROM DUAL;

Named Notation:
SELECT my_func(param1 => 10,param2 => 7) FROM DUAL;

Mixed Notation
SELECT my_func(param1 => 10,7) FROM DUAL;

===========================================
Dependency Management
===========================================
Prior to Oracle 11G, Oracle did not have Fine Grained Dependency Management.
Meaning that adding a new column to a table, would cause invalidation of all dependent objects.

With Fine Grained Dependency Management, only objects dependent on the actual change, are invalidates.

When compiling only the Package Body, there is no invalidation.

===========================================
Asynchronous commit
===========================================
In the normal flow, when DML takes place, Oracle generates redo entries.
These redo changes are buffered in memory while transaction is occurring.
When there is a COMMIT, Oracle immediately writes the redo buffer to disk.
Oracle does not return from the commit until the redo data has been completely written to the online redo log.

The full regular COMMIT full syntax is:
COMMIT WRITE IMMEDIATE WAIT;
IMMEDIATE  - The redo information is written to disk immediately.
WAIT - Oracle waits until the commit has completed successfully.

The alternative is Asynchronous commit
COMMIT WRITE BATCH NOWAIT;
BATCH The redo information is written to disk in batches - i.e. not in sync with commit statements.
NOWAIT - Oracle does NOT wait until the commit has completed successfully. it returns immediately.

The Asynchronous commit might be useful when there are many indexes on the updated table.
The problem, is that the commit might be lost, if DB crashes before buffered log is written.
Very bad idea in RAC/Failover/Load Balancing environment.


No comments:

Post a Comment