Tuesday, September 3, 2013

Enterprise Manager 12c: AdminServer Could Not Be Started

I got an error when trying to start Oracle Enterprise Manager Cloud Control 12c. It says AdminServer couldn’t be started:
[oracle@oem12c bin]$./emctl start oms
Oracle Enterprise Manager Cloud Control 12c Release 3  
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Starting Oracle Management Server...
Starting WebTier...
WebTier Successfully Started
Oracle Management Server Already Started
AdminServer Could Not Be Started
Check Admin Server log file for details: /u01/oracle/gc_inst/user_projects/
domains/GCDomain/servers/EMGC_ADMINSERVER/logs/EMGC_ADMINSERVER.out
When I examined the EMGC_ADMINSERVER.out file, I see that “<BEA-141281> <unable to get file lock, will retry …> weblogic.management.ManagementException: Unable to obtain lock” message. As you know, Enterprise Manager Cloud Control uses Weblogic. Weblogic uses “lock” (*.lok) files to prevent a server to run multiple times. I checked if EMGC_ADMINSERVER is running:
ps -ef | grep EMGC_ADMINSERVER
and see that it’s not up, so it’s obvious that somehow locks files were not properly cleaned. I shutdown the rest of OMS processes:
[oracle@oem12c bin]$./emctl stop oms -all
Oracle Enterprise Manager Cloud Control 12c Release 3  
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Stopping WebTier...
WebTier Successfully Stopped
Stopping Oracle Management Server...
Oracle Management Server Successfully Stopped
AdminServer Already Stopped
Oracle Management Server is Down
then searched for the lock files and removed them
[root@oem12c ~]# locate *.lok | grep EMGC_ADMINSERVER
/u01/oracle/gc_inst/user_projects/domains/GCDomain/servers/
EMGC_ADMINSERVER/data/ldap/ldapfiles/EmbeddedLDAP.lok
/u01/oracle/gc_inst/user_projects/domains/GCDomain/servers/
EMGC_ADMINSERVER/tmp/EMGC_ADMINSERVER.lok

[root@oem12c ~]# rm /u01/oracle/gc_inst/user_projects/domains/GCDomain/servers/
EMGC_ADMINSERVER/data/ldap/ldapfiles/EmbeddedLDAP.lok
[root@oem12c ~]# rm /u01/oracle/gc_inst/user_projects/domains/GCDomain/servers/
EMGC_ADMINSERVER/tmp/EMGC_ADMINSERVER.lok
After removing the lock files, I succesfully started OMS including AdminServer.

ORA-01264, ORA-19800 Permission denied

Error Description:
----------------------------------

Whenever you try to use Oracle Managed file systems while creating any objects like in this case tablespace it fails with error ORA-01264, ORA-19800 Permission denied. On Solaris the test is,
SQL> create tablespace tbs16k blocksize 16K;
create tablespace tbs16k blocksize 16K
*
ERROR at line 1:
ORA-01264: Unable to create datafile file name
ORA-19800: Unable to initialize Oracle Managed Destination
Solaris-AMD64 Error: 13: Permission denied

Or in linux the error stuck is,

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01264: Unable to create logfile file name
ORA-19800: Unable to initialize Oracle Managed Destination
Linux Error: 13: Permission denied

Cause of The problem:
-------------------------------------

The user don't have the permission to write in the specified location. This is Operating system permission.

Solution of The problem:
----------------------------------

Give the necessary permission to the user so that OS user who is running oracle can create file in the specified directory.
First Scenario:
------------------------------------------

In the first case, it is db_create_file_dest destination where create tablespace will try to create datafile.
We can see the location of db_create_file_dest by
SQL> show parameter db_create_file_dest

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string /oradata2/arju
So , now change permission of /oradata2/arju to 777 or change the ownership.

Log on as root and chnage ownership by following.
-bash-3.00$ su
Password:
# chown -R oracle /backup1
# -bash-3.00$ logout

Now try to create tablespace and hopefully it will work fine.

Second Scenario:
--------------------------------
In the second scenario user don't have permission on flash recovery area.
You can see flash recovery area location by,
SQL> show parameter db_recovery
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /oracle
Now either change permission(chmod 777) or change ownership of the specified location by,
-bash-3.00$ su
Password:
# chown -R oracle /oracle
# -bash-3.00$ logout

Now try to do operation and hopefully it will work.