Tuesday, March 3, 2009

SQL prompt takes long time to open while starting the database

whenever we start our database through sqlplus, the sqlplus hangs for some time at "Database Mounted" stage, but in the alert log everything looks fine and we are able to connect the database from other session, but the session which we used to start takes long time to prompt the Database opened and SQL.

Database Version: 10.2.0.2
Application Version: 12.0.4


The following query will let you know whether the instance uses the PFILE or SPFILE.

SQL> SELECT name,value FROM v$parameter WHERE name = 'spfile';

NAME VALUE
---------- --------------------------------------------------
spfile /u01/oracle/product/9.2.0/spfileTEST.ora


or

SQL> show parameter spfile
NAME TYPE VALUE
----------------------------------- ----------- ------------------------------
spfile string /u01/oracle/NGIND/db/tech_st/1
0.2.0/dbs/spfileNGIND.ora


The following query is used to check the current size, minimum size and maximum size of the initialization parameters.

select component, current_size, min_size, max_size, granule_size from v$sga_dynamic_components

COMPONENT CURRENT_SIZE MIN_SIZE MAX_SIZE GRANULE_SIZE
shared pool 419430400 419430400 0 4194304
large pool 0 0 0 4194304
java pool 8388608 8388608 0 4194304
streams pool 16777216 0 0 4194304


SGA_TARGET specifies the total size of all SGA components
If SGA_TARGET is set the values for the following parameters are set dynamically.
Buffer cache (DB_CACHE_SIZE)

Shared pool (SHARED_POOL_SIZE)
Large pool (LARGE_POOL_SIZE)
Java pool (JAVA_POOL_SIZE)
Streams pool (STREAMS_POOL_SIZE)

Solution:
In order to overcome this issue.We need to diasable the SGA_TARGET parameter and specify the minimal values for the following components

Buffer cache (DB_CACHE_SIZE)
Shared pool (SHARED_POOL_SIZE)
Large pool (LARGE_POOL_SIZE)
Java pool (JAVA_POOL_SIZE)
Streams pool (STREAMS_POOL_SIZE)

Before specifying the manual values for the following parameters the database should be taken down
If the instance is using the pfile. We can directly change the values of these parameters using the VI editor.
If the instance uses the spfile. It has to be convereted to pfile using the following script.

Sql> create pfile from spfile.

Now the values of the pfile are edited and again converted back to spfile.
We need to comment are remove the SGA_TARGET parameter form the pfile and need to set the minimal values for the above parameters.
You can find out the minimal values of the initialization parameters using the following query.

select component, current_size, min_size, max_size, granule_size from v$sga_dynamic_components

Recreate the spfile using the following command.
Sql> create spfile from pfile;

Start the database.

2 comments:

Unknown said...

Thanks for this

is there a metalink note or anything that documents this ?

I am having the same problem.

Anonymous said...

you can quickly reproduce the kernel mdf repair process with another utility for data recovery