Friday, July 10, 2009

dbConsole service won't start

The web-based Enterprise Manager tool was introduced in Oracle 10g and has significant functionality improvements over previous versions. Even so, it seems there is not a day goes by without someone asking how to solve an Enterprise Manager configuration issue, so this article explains the first things you should look at. It's not meant to be an all encompassing guide. Just a first shot.

First, check the listener is running correctly.
lsnrctl status
If you get something like the following, your listener is not running and you need to start it using the "lsnrctl start" command.
$ lsnrctl status

LSNRCTL for Linux: Version 11.1.0.7.0 - Production on 13-MAR-2009 13:32:49

Copyright (c) 1991, 2008, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel5-11g.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
$
Next, check the Enterprise Manager service is running.
emctl start dbconsole
Assuming the console is already running, or fails to start, the next thing to do is to reconfigure Enterprise Manager. This is done using the Enterprise Manager Configuration Assistant (EMCA). For a first attempt, run the following command.
emca -config dbcontrol db -repos recreate

If it all goes well you would expect to see something like this.

$ emca -config dbcontrol db -repos recreate

STARTED EMCA at Mar 13, 2009 11:32:35 AM
EM Configuration Assistant, Version 11.1.0.7.0 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: DB11G
Database Control is already configured for the database DB11G
You have chosen to configure Database Control for managing the database DB11G
This will remove the existing configuration and the default settings and perform a fresh configuration
Do you wish to continue? [yes(Y)/no(N)]: Y
Listener port number: 1521
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /u01/app/oracle/product/11.1.0/db_1

Local hostname ................ oel5-11g.localdomain
Listener port number ................ 1521
Database SID ................ DB11G
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Mar 13, 2009 11:33:19 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/DB11G/emca_2009_03_13_11_32_35.log.
Mar 13, 2009 11:33:20 AM oracle.sysman.emcp.util.PortManager isPortInUse
WARNING: Specified port 5540 is already in use.
Mar 13, 2009 11:33:20 AM oracle.sysman.emcp.util.PortManager isPortInUse
WARNING: Specified port 5520 is already in use.
Mar 13, 2009 11:33:20 AM oracle.sysman.emcp.util.PortManager isPortInUse
WARNING: Specified port 1158 is already in use.
Mar 13, 2009 11:33:20 AM oracle.sysman.emcp.util.PortManager isPortInUse
WARNING: Specified port 3938 is already in use.
Mar 13, 2009 11:33:20 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Mar 13, 2009 11:33:22 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Mar 13, 2009 11:35:12 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Mar 13, 2009 11:35:12 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Mar 13, 2009 11:40:06 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Mar 13, 2009 11:40:11 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Mar 13, 2009 11:41:01 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Mar 13, 2009 11:41:07 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Mar 13, 2009 11:41:07 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
Mar 13, 2009 11:41:16 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Mar 13, 2009 11:41:16 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Mar 13, 2009 11:41:28 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Mar 13, 2009 11:41:28 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Mar 13, 2009 11:42:31 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Mar 13, 2009 11:42:34 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>> The Database Control URL is https://oel5-11g.localdomain:1158/em <<<<<< Mar 13, 2009 11:42:48 AM oracle.sysman.emcp.EMDBPostConfig invoke WARNING:
************************  WARNING  ************************  Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted. 
The encryption key has been placed in the file: /u01/app/oracle/product/11.1.0/db_1/oel5-11g.localdomain_DB11G/sysman/config/emkey.ora.  
Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.
*********************************************************** Enterprise Manager configuration completed successfully FINISHED EMCA at Mar 13, 2009 11:42:48 AM $
If this fails, then de-configure and configure Enterprise Manager.
If this fails, then de-configure and configure Enterprise Manager.

emca -deconfig dbcontrol db -repos drop
emca -config dbcontrol db -repos create

Wednesday, July 1, 2009

Oracle Data Block corruption ORA-01578

Oracle Data Block corruption ORA-01578
----------------------------------------

ORA-01578 Oracle data Block corrupted ( File# num and Block# num)

To determine where the corruption is:

select * from sys.dba_extents
where file_id=filenum and
blocknum between block_id and (block_id+blocks-1);

The filenum and blocknum are the numbers in 01578 error.
This query should give the segment_name and segment_type
(ie the table and its name)

In order to salvage the uncorrupted part of the table you can
add an entry to init.ora.
event="10231 trace name context forever"
This will skip the corrupted block on a table scan.
Export the table,drop and recreate it from Import !!!

Tuesday, June 30, 2009

ORA-27101: Shared memory realm does not exist

ORA-27101: Shared memory realm does not exist
Cause: Unable to locate shared memory realm
Action: Verify that the realm is accessible

Usually occurs when trying to start an instance and you do not have enough memory or your memory offset is not such that you can run a large SGA.

My work around on this problem

Cause 1)
This error occurs when Oracle Home is not set properly.
Solution)
Check the Oracle Home is set properly. Check the registry and your Oracle installation product have same path

Cause 2)
Error occurs when Oracle SID is not set properly.
Solution)
Check the Oracle SID is set properly. Compare the OracleServices property have the SID and the SID given in your registry both are same.
SID is case sensitive so be careful.

Cause 3)
Sometimes it may so happen that the drive (C: or D:) you have install the Oracle product/database have not define the virtual memory.
Solution)
It needed to define the virtual memory where you have installed the Oracle product/database.

Solution)
Another Solution is that change

SQLNET.AUTHENTICATION_SERVICES=(NTS)
to
SQLNET.AUTHENTICATION_SERVICES=(NONE)

In sqlnet.ora file and restart your database service.

Wednesday, June 3, 2009

Lazy DBA

Well come to the world of Lazy DBA.

A lazy dba is a SMART dba. A lazy dba is too lazy to look after databases manually , so they've written their own scripts, or bought a 3rd party piece of software in stead. A lazy dba doesn't want to be woken up in the middle of the night by any mobile call, so they proactively monitor their databases to make sure that there are no surprises. Remember, power steering was invented by a lazy engineer.