Monday 3 October 2016

OEM Agent Down after Daylight Time changes

Issue: Received Agent is Unreachable (REASON = masisa01) but the host is reachable
Verified agent logs,It is down after daylight saving time changed last night 


Tried to start agent, it got failed
[oracle@Hostname bin]$ ./emctl start agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
Starting agent ...... failed.
The agentTZRegion value in /oracle/agent11g/agent11g/sysman/config/emd.properties is not in agreement with what agent thinks it should be.Please verify your environment to make sure that TZ setting has not changed since the last start of the agent.
If you modified the timezone setting in the environment, please stop the agent and exectute 'emctl resetTZ agent' and also execute the script mgmt_target.set_agent_tzrgn(<agent_name>, <new_tz_rgn>) to get the value propagated to repository.
Consult the log files in: /oracle/agent11g/agent11g/sysman/log

 Tried to reset time zone , failed
[oracle@Hostname bin]$./emctl resetTZ agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
Updating /oracle/agent11g/agent11g/sysman/config/emd.properties...
----- Mon Oct  3 12:06:01 2016::tzOffset for Australia/Sydney is 600(min), but agent is runnning with tzOffset 660(min)
-----
----- Mon Oct  3 12:06:01 2016::trying again after waiting for 1 sec to account for daylight transition
-----
----- Mon Oct  3 12:06:01 2016::tzOffset for Australia/Sydney is 600(min), but agent is runnning with tzOffset 660(min)
-----
resetTZ failed.
The agentTZRegion in:
/oracle/agent11g/agent11g/sysman/config/emd.properties
is not in agreement with what the agent thinks it should be.
Fix your environment.
Pick a TZ value that corresponds to time zone settings listed in:
/oracle/agent11g/agent11g/sysman/admin/supportedtzs.lst

Changed TZ environment variable
grep TZ /oracle/agent11g/agent11g/sysman/config/emd.properties
agentTZRegion=Australia/Sydney

[oracle@Hostname bin]$ export TZ=Australia/Sydney+1

Reset TIMEZONE completed successfully
[oracle@Hostname bin]$ ./emctl resetTZ agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
Updating /oracle/agent11g/agent11g/sysman/config/emd.properties...
Successfully updated /oracle/agent11g/agent11g/sysman/config/emd.properties.
Login as the em repository user and run the  script:
exec mgmt_target.set_agent_tzrgn('Hostname:3872','GMT')
and commit the changes
This can be done for example by logging into sqlplus and doing
SQL> exec mgmt_target.set_agent_tzrgn('Hostname:3872','GMT')
SQL> commit

Started Agent
[oracle@Hostname bin]$ ./emctl start agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
Starting agent .... started.


[oracle@Hostname bin]$  ./emctl status agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 11.1.0.1.0
OMS Version       : 11.1.0.1.0
Protocol Version  : 11.1.0.0.0
Agent Home        : /oracle/agent11g/agent11g
Agent binaries    : /oracle/agent11g/agent11g
Agent Process ID  : 28284
Parent Process ID : 28264
Agent URL         : https://Hostname:3872/emd/main/
Started at        : 2016-10-03 01:18:51
Started by user   : oracle
Last Reload       : 2016-10-03 01:18:51
Last successful upload                       : 2016-10-03 01:19:26
Total Megabytes of XML files uploaded so far :     1.11
Number of XML files pending upload           :        0
Size of XML files pending upload(MB)         :     0.00
Available disk space on upload filesystem    :    50.19%
Last successful heartbeat to OMS             : 2016-10-03 01:19:24
---------------------------------------------------------------
Agent is Running and Ready


Monday 1 August 2016

Unable to Open database after database clone or Recover from backup

SQL> ALTER DATABASE OPEN RESETLOGS;
ALTER DATABASE OPEN RESETLOGS
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/ora_sys/TFSU/system01_TFS.dbf'


SQL> RECOVER DATABASE UNTIL CANCEL;
ORA-00283: recovery session canceled due to errors
ORA-16433: The database must be opened in read/write mode.


SQL> ALTER DATABASE OPEN NORESETLOGS;
ALTER DATABASE OPEN RESETLOGS
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/ora_sys/TFSU/system01_TFS.dbf'


SQL>alter system set _ALLOW_RESETLOGS_CORRUPTION=true
***Hidden parameter _ALLOW_RESETLOGS_CORRUPTION=TRUE  which will allow us to 
open database even though it’s not properly recovered   ***

SQL> ALTER DATABASE OPEN  RESETLOGS;

Database altered.

ORA-01031: insufficient privileges on Windows sqlplus "/as sysdba"

Issue: 
C:\Windows\system32>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 1 20:43:55 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.

ERROR:
ORA-01031: insufficient privileges

Solution:
รจ Verified user to be part of ORA_DBA group, which is missing below
c:\Oracle>echo %username%
surajarajuj

C:\Windows\system32>NET LOCALGROUP ORA_DBA
Alias name     ORA_DBA
Comment        Oracle DBA Group
Members
----------------------------------------------------------
NT AUTHORITY\SYSTEM
The command completed successfully.

C:\Windows\system32>NET LOCALGROUP ORA_DBA  suraparajuj /add
The command completed successfully.

C:\Windows\system32>NET LOCALGROUP ORA_DBA
Alias name     ORA_DBA
Comment        Oracle DBA Group
Members
--------------------------------------------------------
NT AUTHORITY\SYSTEM
DBHOST\suraparajuj
The command completed successfully.


c:\Oracle>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 1 20:43:55 2016

Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>