Wednesday, 15 August 2007

OCP Oracle Database 11g : New Features for Administrators Exam Guide

Topics related to above exam follows.....

For now... here are some of the cool new features of 11g

Case Sensitive Passwords

Beginning with Oracle Database 11g Release 1, database passwords are case sensitive.
You can disable this features by setting the SEC_CASE_SENSITIVE_LOGON initialization parameter to FALSE.

Automatic Stats Collection on Tables

As you know that you can enable DBMS_STATS to automatically gather statistics for a table by specifying the MONITORING keyword in the CREATE (or ALTER) TABLE statement. But, starting with Oracle Database 11g, the MONITORING and NOMONITORING keywords have been deprecated and statistics are collected automatically. If you do specify these keywords, they are ignored.

Monitoring tracks the approximate number of INSERT, UPDATE, and DELETE operations for the table since the last time statistics were gathered. Information abouthow many rows are affected is maintained in the SGA, until periodically (about everythree hours) SMON incorporates the data into the data dictionary. This data dictionary information is made visible through the DBA_TAB_MODIFICATIONS,ALL_TAB_MODIFICATIONS, or USER_TAB_MODIFICATIONS views. The database uses these views to identify tables with stale statistics.

Readonly Tables

To place a table in read-only mode, you must have the ALTER TABLE privilege on thetable or the ALTER ANY TABLE privilege. In addition, the COMPATIBILE initializationparameter must be set to 11.1.0 or greater.

The following example places the EMP table in read-only mode:


The following example returns the table to read/write mode:


Invisible Indexes

An invisible index is an index that is ignored by the optimizer unless you explicitly set the OPTIMIZER_USE_INVISIBLE_INDEXES initialization parameter to TRUE at the session or system level. Making an index invisible is an alternative to making it unusable or dropping it.

Using invisible indexes, you can do the following:

Test the removal of an index before dropping it.

Altering Indexes

Use temporary index structures for certain operations or modules of an application without affecting the overall application.

To create an invisible index, use the SQL statement CREATE INDEX with theINVISIBLE clause. The following statement creates an invisible index named IND_EMP_DEPT for the DEPT column of the EMP table:

CREATE INDEX ind_emp_dept ON emp(dept)INVISIBLE;

To make an invisible index visible, issue this statement:


To make a visible index invisible, issue this statement:


To check whether an index is visible or invisible, query the dictionary views


For example, to determine if above index is invisible, issue the following query:


------------- ----------

Tuesday, 14 August 2007

Partitioning Limitations

I was trying to reverse engineer the schema using Visual Paradigm for UML 6.0 Professional Edition and identified that it doesn't work with partitioned tables. However, this is a restriction / bug in Visual Paradigm.
To list out few limitations of Partitioning :

  • In 9i, you can not create index organized table with List Partitioning (however in 10g, you can)
  • In 9i, you can not Fast Refresh materialized views after truncating partitions on base table. You have to have range or composite (implies range) especially in this case. But In 10g, you can i.e. range OR list (or composite)
  • You have to disable referential integrity between partitioned tables if you want to drop old partitions. Even if you drop child partition first, followed by its parent table partition, currently results in Oracle error ORA-02266: unique/primary keys in table referenced by enabled foreign keys.
  • We can not move partitions to tablespace with different block size using ALTER TABLE MOVE command

Drop partitions

Back to basics...

"I want to drop the partitions however I dont want to rebuild the local indexes. I have enforced referential integrity on tables.. How can I achive this?"

1. Use deferrable FK constraints
2. disable the constraints before dropping partitions
3. Enable constraint with 'NOVALIDATE' clause after dropping partitions.

But what if I have indexes on FK constraints?
You can use 'KEEP INDEX' caluse at the time of disabling the constraints.