0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Oracle Databaseのdockerでtimezoneを変更

Posted at

Oracle Databaseの設定変更というより、コンテナのOSのtimezone変更で行う。

手順

どちらのコンテナでもTZが意図通りになるのを確認した。以下のコマンド例はtimezone変更が分かりやすいようにEurope/Madrid (+01:00)で試している。

container-registry.oracle.com/database/free

https://container-registry.oracle.com/ords/ocr/ba/database/free の場合。

docker run --name my_oracle -p 11521:1521 -e ORACLE_PWD="Oracle23" -e TZ="Europe/Madrid" container-registry.oracle.com/database/free:23.5.0.0-lite

gvenzl/oracle-free

https://hub.docker.com/r/gvenzl/oracle-free の場合。

docker run --name my_oracle -p 11521:1521 -e ORACLE_PASSWORD="Oracle23" -e TZ="Europe/Madrid" gvenzl/oracle-free:23.5

確認

以下のように、SYSTIMESTAMPはコンテナOSのtimezoneに影響されて+01:00CURRENT_TIMESTAMPはsessionが日本なので+09:00になるのが確認できる。DBTIMEZONEの決定方法がイマイチ調べても良く分からないがこの環境ではデフォルト+00:00のままになるようだ。

select 
  DBTIMEZONE,       -- +00:00
  SESSIONTIMEZONE,  -- +09:00
  SYSTIMESTAMP,     -- 24-11-29 11:02:25.968674 +01:00
  CURRENT_TIMESTAMP -- 24-11-29 19:02:25.968681 +09:00
from dual;

コンテナの起動ログでも確認できる。

#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
Pluggable database FREEPDB1 with pdb id - 3 is now marked as NEW.
****************************************************************
2024-11-29T11:04:31.871810+01:00 <- これ
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?