Professional Documents
Culture Documents
Enhancements in Oracle
Compiler enhancements (Real Native Compilation) Oracle 11g PL/SQL
compiler is no more dependent on third part C compiler but it can use
PL/SQL source code to directly generate the native code. This improves
compilation time and results in faster execution. The newly added
SQL> ALTER SYSTEM SET PLSQL_CODE_TYPE=NATIVE SCOPE=SPFILE;
SQL> ALTER PROCEDURE MY_PROC COMPILE PLSQL_CODE_TYPE=NATIVE;
Invisible Indexes:
Oracle 11g provides flexibility in query performance testing by introducing
Invisible Indexes.
CREATE INDEX IDX_EMP_NAME ON EMP (ENAME) INVISIBLE;
SELECT /*+ index (ENAME IDX_EMP_NAME) */
FROM EMP WHERE ENAME LIKE %DBA%;
Virtual Columns
Oracle 11g allows a user to create virtual columns in a table whose
values are derived automatically from other actual columns of the
same table. They show same behavior as other columns in the table
in terms of indexing and statistics.
Currently, Oracle does not support LOB and RAW values in virtual
columns.
column [datatype] [GENERATED ALWAYS] AS ()[VIRTUAL]
[( inline_constraint [,...] )]
Here, GENERATED ALWAYS and VIRTUAL are optional keywords, but
included for more clarity.
A table ORDERS is created with ORDER_VAL_ANN as virtual column,
whose value is derived from ORDER_VAL column of the ORDERS table
CREATE TABLE ORDERS(ORDER_ID NUMBER PRIMARY
KEY,ORDER_VAL NUMBER
ORDER_VAL_ANN AS (ORDER_VAL*12));
Compound Trigger
In compound trigger logic, all timing point logics are clubbed in one
single body
resolves the issue where same set of session variables share common
data and the famous mutating table error(ORA-04091).
The compound trigger is useful when you want to accumulate facts that
characterize the "for each row" changes and then act on them as a body
at "after statement" time. Sometimes you are forced to use this approach
(to avoid the mutating table error). Sometimes this approach gives better
performance;
for example, when maintaining a denormalized aggregate value in a
master table in response to changes in a detail table, or when
maintaining an audit table.
tools
LOB ([COLUMN]) STORE AS SECUREFILE (LOB storage
parameters);
Partitioning Enhancements
This is a new 11g partitioning scheme that automatically creates timebased partitions as new data is added. We can now partition by date, one
partition per month for example, with automatic partition creation.
Partitioning Enhancements
Coding Enhancements
Fast DML triggers In Oracle 11g, DML triggers have shown
performance upgrade by 25%.
Default Value in Table ALTER command In the Oracle version earlier
than 11g, if a table has to be altered to add a column, the very next
step was to update the existent rows to some default value.
Oracle 11g allows providing DEFAULT value for a column during table
alteration. This has resolved the overhead of updating column with
default value.
ALTER TABLE [TABLE NAME] ADD [COLUMN] [DATA TYPE] [NOT NULL]
DEFAULT [DEFAULT VALUE]
Sequence Assignment
Prior to Oracle 11g, sequence assignment to a number variable could
be done through a SELECT statement only.
This was the gray area which could have degraded performance due to
context switching from PL/SQL engine to SQL engine. Oracle 11g has
transformed this feature of Sequence assignment to a PL/SQL construct.
In Oracle 11g, the INSERT statements which use other table to load the data can
make use of the hint IGNORE_ROW_ON_DUPKEY_INDEX to avoid the unique key conflict
with the existing row. It ignores the unique key violation during insertion.
It is similar to handling of DUP_VAL_ON_INDEX exception, but comparatively it is slower
than a single INSERT statement and carries the overhead of creating a PL/SQL block.
NO_DATA_NEEDED new exception For parallel access and pipelined table functions,
ORA-06528 exception was included in predefined exception list as NO_DATA_NEEDED.
Encrypted Tablespace
Encryption of Tablespace was introduced with Oracle 10g version but was deprecated
due to multiple existing issues. Tablespace encryption in Oracle 11g extends the concept
of Transparent Data Encryption and resolves the limitations of range scan and primary
key issues. A new tablespace can be created in Encrypted form, with all of its tables and
indexes in Encrypted form.
CREATE TABLESPACE
[ENCRYPTION [USING ]] DEFAULT STORAGE(ENCRYPT)
First select the data in recyclebin and then insert into original table as
below