Wednesday 18 June 2014

Datafile deleted how to recover database

Datafile deleted how to recover database :
Scenario : By any chance datafile deleted and backup  has not been taken any backup for Database , now need to recover Database
Solution :
For the solution we need to know datafile name which is missing and we can come to know from control file
So we have to follow below steps to recover database.
1.Create a new datafile as named in control file.
2.Restore Database backup or if there is no backup taken and archive log mode on we can recover from archive log. 

Wednesday 11 June 2014

tablespace segment space management

Tablespace segment space management :
Tablespace segment space management has two options auto and manual and by default segment space management is manual.
Find below description for auto and manual SSM:
Manual:
Manual segment space management uses freelist for future utilization of tables.Data blocks are being added up to freelist then data insertion into table being possible.
To add blocks to freelist oracle database system compares PCT_USED and PCT_FREE
PCTUSED
PCTUSED is a block storage parameter used to specify when Oracle should consider a database block to be empty enough to be added to the freelist. Oracle will only insert new rows in blocks that is enqueued on the freelist. For example, if PCTUSED=40, Oracle will not add new rows to the block unless sufficient rows are deleted from the block so that it falls below 40% used.
That means when database block usespace <PCT_USED then the block being available to freelist and allow to insert row into tables.By default value for pct_used is 40

PCTFREE

PCTFREE is a block storage parameter used to specify how much space should be left in a database block for future updates. For example, for PCTFREE=10, Oracle will keep on adding new rows to a block until it is 90% full. This leaves 10% for future updates (row expansion).
When using Oracle Advanced Compression, Oracle will trigger block compression when the PCTFREE is reached. This eliminates holes created by row deletions and maximizes contiguous free space in blocks.
That means when database block freespace < PCT_FREE then the block being unavailable  to free list and does not allow to insert row. Because,pst_free specified space available only for future row expansion on update. By default value for pct_free is 10.

PCTINCREASE

PCTINCREASE refers to the percentage by which each next extent (beginning with the third extend) will grow. The size of each subsequent extent is equal to the size of the previous extent plus this percentage increase.
Auto:
Its unlike manual SSM it uses bitmap instead of freelist and not using pct_used and pct_free parameter.

It is not available for temporary and system tablespace and only available for tablespace configured for local extend management .Automatic segment management performs better and reduces maintenance task.
Below shown picture Describes SSM and parameters :


Tuesday 10 June 2014

oracle database upgradation from 11.2.0.3 to 11.2.0.4 (11.2.0.3-11.2.0.4)


Oracle Database Upgradation(from 11.2.0.3 to 11.2.0.4 )

Steps to follow:
1.Download patch  13390677 (11.2.0.4) from metalink  or any provided link for 11.2.0.4 DB 
2.Take backup of old DB(11.2.0.3)
3.Start installing 11.2.0.4 DB on server with separate home .
4.export new ORACLE_HOME in bash_profile  for permanent setting.
note:Since database version is same no need to create listener for new DB.
6.Start ./dbua from $ORACLE_HOME/bin(Check whether the database is up or not from old home)
PATH to Upgrade:
Old DB: 11.2.0.3--> 11(DB version).2(Release).0(application release).3(component release/patch release)
New DB: 11.2.0.4-->11(DB version).2(Release).0(application release).4(component release/patch release)
It clearly says need to upgrade patch release with component.
as shown in example below:

Installation of new DB software only and upgrade to new patch version:




























To resolve the above error  :
Root cause database was not started start DB and proceed
'













































After upgradation check for INVALID object for dba_objects check before and after run utlrp.sql scripts.
utlrp.sql script to recompile invalid object.