Oracle がインストール時に自動設定するタイムゾーンと、サーバーのタイムゾーンの不一致で、Oracle Database が起動しない場合があります。
環境情報
- Oracle Database 11g R2
- Microsoft Azure 仮想マシン Windows Server 2008 R2 SP1
現象
インストール時に以下のような警告が表示されます。
Enterprise manager configuration succeeded with the following warning-
Error starting Database Control. Please execute the following command(s).
- Set environment variable ORACLE_UNQNAME to Database unique name
- C:\app<username>\product\11.2.0\dbhome_1\bin\emctl.bat start dbconsole
インストールが環境しても、 Enterprise Manager に接続はできるものの、データベースが起動しません。 リスナーやエージェントにも接続できません。
上記の警告にあるように、環境変数 ORACLE_UNIQNAME
を設定して、 emctl start dbconsole
を実行しても、 dbconsole
は起動しません。。
原因
C:\app\<username>\product\11.2.0\dbhome_1\<servicename>_<SID>\sysman\log\emdb.nohup
を確認すると、以下のようなログが確認できました。
----- Tue Jun 9 07:33:30 2015::tzOffset for -04:00 is -240(min), but agent is runnning with tzOffset 0(min)
Oracle のインストール時に、自動的にタイムゾーンが設定されるのですが、この設定と、サーバーのタイムゾーンがミスマッチしているため、起動しないようです。
自動設定されるタイムゾーンは、以下のコマンドで確認できます。
emctl config agent getTZ
手元の環境では、ローカルのタイムゾーンは UTC なのですが、上記コマンドは America/Rio_Branco
(-04:00) を返していました。
対応方法
Oracle のインストール時に設定される C:\app\<username>\product\11.2.0\dbhome_1\<servicename>_<SID>\sysman\config\emd.properties
をローカルのタイムゾーンに設定します。
agentTZRegion=+00:00
以下のコマンドで、 dbconsole が無事に起動すれば OK です。
emctl start dbconsole
念のため、 OS を再起動して、 Oracle が正常に自動起動するか確認しておきましょう。