--

Tuesday, August 30, 2011

Invisible Indexes in Oracle 11g


Always wanted this – the ability to create an index on production without impacting the queries being fired by application but at the same time test the impact an index creation can cause. Invisible indexes are useful alternative to making an index unusable or to drop it. 
The optimizer ignores the index that are marked “Invisible” unless you set the initialization parameter “OPTIMIZE_USE_INVISIBLE_INDEXES” to TRUE. This parameter can be set both at a session level as well as system level.
Usage of Invisible Indexes
One can use invisible index for testing the impact of removing an index. Instead of dropping the index we can make it invisible and its effect.
One can speed up operations by creating invisible indexes for infrequent scenarios. Invisible index will make sure that the overall performance of the application is not affected.
Gives you the flexibility to have both b-tree (to guarantee unique PK) as well as bitmap indexes (on FK columns) in a data warehouse application.
How to create?
Multiple options – either mention “INVISIBLE” clause at the time of index creation or use ALTER command to make an index “INVISIBLE”.

CREATE INDEX emp_ename ON emp(ename)
      TABLESPACE users
      STORAGE (INITIAL 20K
      NEXT 20k
      PCTINCREASE 75)
      INVISIBLE;
ALTER INDEX index INVISIBLE;

To make the Index “VISIBLE”

ALTER INDEX index VISIBLE;

A new column “VISIBILITY” is available in *_INDEXES data dictionary views to know if an index is visible or invisible.

Example
SQL> create index indx_job on emp1(job);

Index created.

SQL> explain plan for select * from emp1 where job='CLERK';

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
Plan hash value: 3449298850

----------------------------------------------------------------------------------------
| Id  | Operation                   | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
----------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |          |     4 |   348 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| EMP1     |     4 |   348 |     2   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | INDX_JOB |     4 |       |     1   (0)| 00:00:01 |
----------------------------------------------------------------------------------------


SQL> explain plan for select * from emp1 where job='CLERK';

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
Plan hash value: 2226897347

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     4 |   348 |     3   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| EMP1 |     4 |   348 |     3   (0)| 00:00:01 |
--------------------------------------------------------------------------


SQL> ALTER SESSION SET optimizer_use_invisible_indexes=TRUE;

Session altered.

SQL> select index_name,visibility from user_indexes where table_name='EMP1';

INDEX_NAME                     VISIBILIT
------------------------------ ---------
INDX_JOB                       INVISIBLE

SQL>  explain plan for select * from emp1 where job='CLERK';

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
Plan hash value: 3449298850

----------------------------------------------------------------------------------------
| Id  | Operation                   | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
----------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |          |     4 |   348 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| EMP1     |     4 |   348 |     2   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | INDX_JOB |     4 |       |     1   (0)| 00:00:01 |
----------------------------------------------------------------------------------------

Friday, July 22, 2011

Oracle Database Firewall - What is it?


It all started with acquisition of Secerno, a database firewall vendor, in 2010. Secerno's product “DataWall” helped analyze how databases are accessed so that DBA’s can set up policies to control the access.
The database firewall has the ability to analyze SQL statements sent from database clients and determine whether to pass, block, log, alert, or substitute SQL statements, based on a defined policy. Users can set whitelist and blacklist policies to control the firewall. It can detect injected SQL’s and block them.  According to Oracle, the database firewall can do the following -
  • Monitors and blocks SQL traffic on the network with white list, black list and exception list policies
  • Protects against application bypass, SQL injection and similar threats
  • Reports on database activity for SOX, PCI, HIPAA and other regulations, choosing from dozens of out-of-the-box reports
  • Supports other Databases as well - MS SQL Server, IBM DB2 , and Sybase
The Database Firewall joins other database-security products offered by Oracle such as Oracle Advanced Security, Audit Vault, Database Vault, Secure backup etc.
Oracle Database firewall comes in 2 components:-
Database Firewall:
  • Record and analyze SQL transaction requests and responses from one or more Oracle, Microsoft SQL Server, or Sybase databases, and Sybase SQL Anywhere.
  • Categorizes SQL transactions
  • Enforces data policies
  • Enables real-time alerting and event propagation
Database Firewall Management Server:
  • Aggregates SQL data from one or more Database Firewalls
  • Serves as a reporting platform for business reports
  • Centralizes the distribution of data control policies, but still enables the use of different policies for specific databases
  • Stores and manages log files, including archiving and restoring the log files
  • Remotely manages all Database Firewalls to which it connects
  • Integrates with third-party applications, such as Crystal Reports
However there are some key issues that it does not address and hence would need use of other security options such as Audit Vault, VPD etc. For example, Privileged users can login to the OS directly and make local connections to the database. This bypasses the database firewall.
Pricing
The two components are priced separately.  The Database Firewall comes at a cost of $5,000 per processor and Database Firewall Management Server component is priced at $57,500 per processor. 

Thursday, July 14, 2011

Pre-packaged Oracle VM's for Developers

Interesting. I remember that in order to make development effort faster, we used to make images of our development boxes with all the required software / applications installed on it. This was pre-virtualization era. But with virtualization, it became a common norm and easier. Now Oracle has also started packaging different development stack on a pre-built Oracle VM which one can simply download and start using it.

All you need to do is install VirtualBox to get these pre-built VM's working. Currently Oracle has the following development stacks bundled in a VM with more coming in future -

  • Java Development
  • Database App Development 
  • SOA & BPM Development
  • Oracle WebLogic Server Hands-on
  • Oracle WebCenter Portal Framework 11g Hands-on
  • Oracle Solaris 11 Express Developer
  • Oracle Solaris 11 Express Network Virtualization 
  • Oracle Solaris 10 9/10
  • Enterprise PHP Development
  • Oracle Tuxedo Web Application Server Demo
Refer to the following link for components that have been bundled in the above listed VM's and download them. Go download and speed up your development effort.

http://www.oracle.com/technetwork/community/developer-vm/index.html

In a previous post, I had covered the Oracle VM images with pre-installed Oracle Database (10g and 11g) and Oracle RAC (10g, 11g, and 11gR2) software.

Friday, July 8, 2011

Oracle Pre-upgrade utility


The Pre-upgrade tool provides a list of items which should be reviewed before upgrading the database (just like a pre-requisites checklist). Basically it reports about the database configuration and parameters etc. that need attention prior to upgrade. The best thing is this script can be run while the database is running on the existing version that means no shutdown required.  This allows you to properly plan your upgrade process and avoid unnecessary down time due to pre-requisites missed for the upgrade.
Note: - A few registry$ tables will be created and data would be inserted into them.
The snapshot (taken from Metalink note 884522.1) explains which script should be used based on the version you are on and the version you are intending to upgrade to. You can download the scripts from the same metalink note as well.
 
You can find these scripts under $ORACLE_HOME/rdbms/admin directory of the version you are planning to upgrade to.
The following snapshot gives a sample output of the script executed on a 10g database.
While you will refer to an upgrade guide / companion available from Oracle to note down all the pre-requisite steps and get them rectified. This script gives you a consolidated output of the pre-requisites and one can fix and re-run the script to check if it complies with most.

Tuesday, July 5, 2011

Database Upgrade Guide – 10g to 11g


I came across this useful upgrade advisor/guide on Metalink(ID 251.1) so thought I should share this. I think it was available earlier as well but in some crude format. It’s a nice step-by-step guide / reference for anyone who wants to upgrade to 11g. It explains you the benefits of 11g and guides you through a 6-step approach (Evaluate, Plan, Configure, Test, Implement and Accept) to get to 11g. It explains each phase with expected deliverables/outcomes and lists a host of referenceable material – documents / guides, ppts, multimedia trainings, metalink notes etc. one can refer to.
It’s very handy guide for anyone who wants to migrate from 10g to 11gR2.




Thursday, June 23, 2011

Virtathon - A virtual conference for Oracle community


BrainSurface is organizing an online, virtual conference for the Oracle community called “VirtaThon” which includes Java and MySQL communities as well. I like the idea of online and virtual conference since personally I have not attended many conferences like Oracle Open World or IOUG etc. being in a part of the world where such conferences happen very less. I have always rued that I haven’t been able to attend such conferences organized for my community but now I’m very excited and looking forward to participate in VirtaThon.
I feel this is definitely a great way to learn about the latest and listen to experts in your domain. And the best part is that it’s FREE. So just go and register yourself for VirtaThon.
Dates – 16th to 21st July 
Venue – Online
Cost – Registration is Free
Speakers (names listed in alphabetical order) – Arup Nanda, Brian Huff, Colin Charles, Dan Hotka, Dario Laverde, David Koelle, Dr. Bert Scalzo, Guy Harrison, Lewis Cunningham, Matt Warman, Mike Ault, Riyaj Shamsudeen, Syed Jaffar Hussain, Tariq Farooq, Vinod Haval
Topics being covered – I’m listing only the topics that would be of interest for a DBA.
  • Oracle (Database, Cloud Computing, Virtualization, Oracle Linux, Data Modeling and Exadata etc.)
  • MySQL (Replication and Scale out, High availability and Clustering, Enterprise database administration and Security, Database Performance Tuning, Storage Engine Development and Optimization, Partition Strategies, Cloud computing etc.)
  • Java (details can be found on the VirtaThon site)
Being a virtual conference, you don't have to travel anywhere to attend the sessions; you can simply attend from the comfort of your home or office. This is not a webcasts rather much like normal conferences you can participate by asking questions, interact via chat and have follow ups after talks. All you need is a computer with an internet connection.

Request all to participate, contribute and learn from this conference. As far as I know, this is one of the first Oracle-centric virtual conference. Look forward to more such online oriented conferences. Great effort and move by BrainSurface; Hats off to entire group and Tariq Farooq - the main man behind Brainsurface and this conference.
Enhanced by Zemanta

Monday, June 20, 2011

Pre-packaged Oracle VM Images for Oracle Database and RAC


Oracle has made available pre-configured virtual machines containing pre-installed Oracle enterprise software stacks. These Oracle VM templates can be downloaded from Oracle's E-Delivery site.
Pre-packaged VM’s would greatly useful if you need to quickly test out or do a POC etc. You would anyways download the software so why not download a pre-installed VM image and get started immediately as opposed to going through painstaking process of installing it unless your POC is about installation and configuration.
All you would need is Oracle VM already installed on your server/desktop. Then you can simply download the VM images, import and deploy the template VM’s. However you do need to provide some basic information such IP (DHCP or static), passwords etc. and you will have a fully installed / configured Oracle environment ready without having to install products from scratch.
Currently, I could find the following templates for Oracle Database and RAC on both 32-bit and 64-bit (x86 platforms). All of these are based on Oracle Enterprise Linux version 5.2 onward. No pre-packaged VM’s are available for Windows or other UNIX flavors.
Database VM Templates for x86 (32-bit)

There are pre-installed/configured VM’s for other products as well e.g. Grid control, Fusion middle-ware, E-business suite etc. Get them @ Oracle E Delivery - https://edelivery.oracle.com/EPD/GetUserInfo/get_form?caller=LinuxWelcome