タイム・ゾーンの管理
コンソールおよびAPIの「タイムゾーン」フィールドでは、UTC (デフォルト)以外のタイム・ゾーンでDB Systemリソースを起動できます。
データベース・システムの作成時に指定したタイム・ゾーンは、ホストおよびOracle Grid Infrastructure (システムにGrid Infrastructureがある場合)に適用され、データベース・ログ・ファイルのタイム・ゾーンを制御します。 データベース自体のタイムゾーンは影響を受けません。 ただし、データベースのタイムゾーンはtimestampデータ型にのみ影響します。 データベース・タイムゾーンは手動で変更できますが、Oracleでは、データ変換を回避し、データベース間でデータが転送される際のパフォーマンスを向上させるために、UTC (デフォルト)として保持することをお薦めします。 この構成は、分散データベース、レプリケーション、エクスポートおよびインポート操作で特に重要です。
UTCを使用することをお薦めしますが、データベース・クライアントおよびアプリケーション・ホストに共通のタイム・ゾーンを設定すると、データベース管理者の管理およびトラブルシューティングが簡素化されます。
ノート:
タイム・ゾーンは、主に表示目的またはユーザー入力の処理に使用されます。 タイムゾーンを変更しても、システム・クロックの時間は変更されません。関連トピック
タイムゾーン・オプション
コンソールとAPIのどちらを使用する場合でも、選択可能なタイム・ゾーン・オプションは名前付きリージョン形式で表示されます(例: America/Los_Angeles)。 コンソールでは、UTC、ブラウザで検出されたタイム・ゾーン(ブラウザでタイム・ゾーン検出がサポートされている場合)、または代替タイム・ゾーンを選択できます。
代替タイムゾーン(「別のタイムゾーンの選択」オプション)を指定するには、最初に「リージョンまたは国」フィールドで値を選択して、「タイムゾーン」フィールドで選択するタイムゾーンのリストを絞り込みます。 America/Los_Angelesの例では、「アメリカ」が時間リージョンで、Los_Angelesがタイム・ゾーンです。 これらの2つのフィールドに表示されるオプションは、Java.util.TimeZoneクラスとLinuxオペレーティング・システムの両方でサポートされるタイムゾーンとほぼ相関します。 探しているタイムゾーンが表示されない場合は、「リージョンおよび国」フィールドで「その他」を選択してみてください。
ヒント:
APIを使用していて、サポートされているタイムゾーンのリストを表示する場合は、コンソールでタイム・ゾーン・オプションを調べることができます。 これらのオプションは、DBシステム・シェイプを選択した後に拡張オプションを表示すると、「DBシステムの作成」ページに表示されます。現在のタイムゾーンを表示
タイム・ゾーン情報を表示するには、次のステップを実行します。
-
gridユーザーとしてホストにログオンします。
例:[opc@rc ~]$ sudo su - grid -
タイム・ゾーンを表示するには、次のコマンドを使用します。
timedatectl例:[grid@rc ~]$ timedatectl Local time: Thu 2023-03-16 08:00:25 UTC Universal time: Thu 2023-03-16 08:00:25 UTC RTC time: Thu 2023-03-16 08:00:21 Time zone: UTC (UTC, +0000) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: n/aシステムは現在UTCタイム・ゾーンであることに注意してください。
-
データベースにログオンします。
例:[grid@rc ~]$ sqlplus / as sysdba SQL*Plus: Release 21.0.0.0.0 - Production on Thu Mar 16 08:00:33 2023 Version 21.9.0.0.0 Copyright (c) 1982, 2022, Oracle. All rights reserved. Connected to: Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 -Production Version 21.9.0.0.0 -
次のコマンドを使用して、現在のデータベース時間を表示できます。
sysdate例:SQL> select to_char(sysdate,'DD-MON-YYYY HH24:MI:SS') from dual; TO_CHAR(SYSDATE,'DD- -------------------- 16-MAR-2023 08:00:40 -
終了します。
DB Systemのタイム・ゾーンの変更
次のステップを実行して、DB Systemのタイム・ゾーンを設定します。
-
ルート・ユーザーとしてホストにログオンします。
例:[opc@rc ~]$ sudo su - -
次のコマンドを使用して、正しいタイム・ゾーン(TZ)値を設定します。 たとえば、米国東部タイム・ゾーン(EST/EDT)の正しいTZ値を識別する場合は、
tzselectコマンドを使用し、Americas/United States/Easternを選択できます。tzselect例:[root@rc ~]# tzselect Please identify a location so that time zone rules can be set correctly. Please select a continent or ocean. 1) Africa 2) Americas 3) Antarctica 4) Arctic Ocean 5) Asia 6) Atlantic Ocean 7) Australia 8) Europe 9) Indian Ocean 10) Pacific Ocean 11) none - I want to specify the time zone using the Posix TZ format. #? 2 Please select a country. 1) Anguilla 19) Dominican Republic 37) Peru 2) Antigua & Barbuda 20) Ecuador 38) Puerto Rico 3) Argentina 21) El Salvador 39) St Barthelemy 4) Aruba 22) French Guiana 40) St Kitts & Nevis 5) Bahamas 23) Greenland 41) St Lucia 6) Barbados 24) Grenada 42) St Maarten (Dutch) 7) Belize 25) Guadeloupe 43) St Martin (French) 8) Bolivia 26) Guatemala 44) St Pierre & Miquelon 9) Brazil 27) Guyana 45) St Vincent 10) Canada 28) Haiti 46) Suriname 11) Caribbean NL 29) Honduras 47) Trinidad & Tobago 12) Cayman Islands 30) Jamaica 48) Turks & Caicos Is 13) Chile 31) Martinique 49) United States 14) Colombia 32) Mexico 50) Uruguay 15) Costa Rica 33) Montserrat 51) Venezuela 16) Cuba 34) Nicaragua 52) Virgin Islands (UK) 17) Curaçao 35) Panama 53) Virgin Islands (US) 18) Dominica 36) Paraguay #? 49 Please select one of the following time zone regions. 1) Eastern (most areas) 16) Central - ND (Morton rural) 2) Eastern - MI (most areas) 17) Central - ND (Mercer) 3) Eastern - KY (Louisville area) 18) Mountain (most areas) 4) Eastern - KY (Wayne) 19) Mountain - ID (south); OR (east) 5) Eastern - IN (most areas) 20) MST - Arizona (except Navajo) 6) Eastern - IN (Da, Du, K, Mn) 21) Pacific 7) Eastern - IN (Pulaski) 22) Alaska (most areas) 8) Eastern - IN (Crawford) 23) Alaska - Juneau area 9) Eastern - IN (Pike) 24) Alaska - Sitka area 10) Eastern - IN (Switzerland) 25) Alaska - Annette Island 11) Central (most areas) 26) Alaska - Yakutat 12) Central - IN (Perry) 27) Alaska (west) 13) Central - IN (Starke) 28) Aleutian Islands 14) Central - MI (Wisconsin border) 29) Hawaii 15) Central - ND (Oliver) #? 1 The following information has been given: United States Eastern (most areas) Therefore TZ='America/New_York' will be used. Local time is now: Thu Mar 16 04:01:39 EDT 2023. Universal Time is now: Thu Mar 16 08:01:39 UTC 2023. Is the above information OK? 1) Yes 2) No #? 1 You can make this change permanent for yourself by appending the line TZ='America/New_York'; export TZ to the file '.profile' in your home directory; then log out and log in again. Here is that TZ value again, this time on standard output so that you can use the /bin/tzselect command in shell scripts: America/New_York [root@rc ~]#tzselectコマンドで、EDTタイム・ゾーンのTZ値をAmerica/New_Yorkとして識別しました。 -
次のコマンドを更新して、新しいタイムゾーンを設定します。
timedatectl set-timezone <new_time_zone>例:[root@rc ~]# timedatectl set-timezone America/New_York -
次のコマンドを使用して、タイム・ゾーンが更新されたかどうかを確認します。
timedatectl例:[root@rc ~]# timedatectl Local time: Thu 2023-03-16 04:02:15 EDT Universal time: Thu 2023-03-16 08:02:15 UTC RTC time: Thu 2023-03-16 08:02:10 Time zone: America/New_York (EDT, -0400) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: yes Last DST change: DST began at Sun 2023-03-12 01:59:59 EST Sun 2023-03-12 03:00:00 EDT Next DST change: DST ends (the clock jumps one hour backwards) at Sun 2023-11-05 01:59:59 EDT Sun 2023-11-05 01:00:00 ESTシステムがAmerica/New_York (EDT)タイム・ゾーンになっていることを確認します。
-
終了します。
Grid Infrastructureを使用するDBシステムでのホストのタイム・ゾーンの変更
Oracle Grid Infrastructureのタイム・ゾーンによって、データベース・ログ・ファイルのタイム・ゾーンが決まります。
ストレージ管理にグリッド・インフラストラクチャを使用するDBシステムのホストのタイム・ゾーン情報を更新するには、次のステップを実行します。
ノート:
- RACクラスタ内のすべてのノードに対して、ステップ1から10を実行する必要があります。
- RACクラスタ内の任意のノードに対してステップ11から15を実行できます。
- この手順は、ストレージ管理にGrid InfrastructureではなくLogical Volume Managerを使用する、高速プロビジョニングされたDBシステムには適用されません。
-
gridユーザーとしてホストにログオンします。例:[opc@rc ~]$ sudo su - grid -
次のコマンドを使用して、正しいタイム・ゾーン(TZ)値を設定します。 たとえば、米国太平洋時間帯(PST/PDT)の正しいTZ値を識別する場合は、
tzselectコマンドを使用し、Americas/United States/Pacificを選択できます。tzselect例:[grid@rc ~]$ tzselect Please identify a location so that time zone rules can be set correctly. Please select a continent or ocean. 1) Africa 2) Americas 3) Antarctica 4) Arctic Ocean 5) Asia 6) Atlantic Ocean 7) Australia 8) Europe 9) Indian Ocean 10) Pacific Ocean 11) none - I want to specify the time zone using the Posix TZ format. #? 2 Please select a country. 1) Anguilla 19) Dominican Republic 37) Peru 2) Antigua & Barbuda 20) Ecuador 38) Puerto Rico 3) Argentina 21) El Salvador 39) St Barthelemy 4) Aruba 22) French Guiana 40) St Kitts & Nevis 5) Bahamas 23) Greenland 41) St Lucia 6) Barbados 24) Grenada 42) St Maarten (Dutch) 7) Belize 25) Guadeloupe 43) St Martin (French) 8) Bolivia 26) Guatemala 44) St Pierre & Miquelon 9) Brazil 27) Guyana 45) St Vincent 10) Canada 28) Haiti 46) Suriname 11) Caribbean NL 29) Honduras 47) Trinidad & Tobago 12) Cayman Islands 30) Jamaica 48) Turks & Caicos Is 13) Chile 31) Martinique 49) United States 14) Colombia 32) Mexico 50) Uruguay 15) Costa Rica 33) Montserrat 51) Venezuela 16) Cuba 34) Nicaragua 52) Virgin Islands (UK) 17) Curaçao 35) Panama 53) Virgin Islands (US) 18) Dominica 36) Paraguay #? 49 Please select one of the following time zone regions. 1) Eastern (most areas) 16) Central - ND (Morton rural) 2) Eastern - MI (most areas) 17) Central - ND (Mercer) 3) Eastern - KY (Louisville area) 18) Mountain (most areas) 4) Eastern - KY (Wayne) 19) Mountain - ID (south); OR (east) 5) Eastern - IN (most areas) 20) MST - Arizona (except Navajo) 6) Eastern - IN (Da, Du, K, Mn) 21) Pacific 7) Eastern - IN (Pulaski) 22) Alaska (most areas) 8) Eastern - IN (Crawford) 23) Alaska - Juneau area 9) Eastern - IN (Pike) 24) Alaska - Sitka area 10) Eastern - IN (Switzerland) 25) Alaska - Annette Island 11) Central (most areas) 26) Alaska - Yakutat 12) Central - IN (Perry) 27) Alaska (west) 13) Central - IN (Starke) 28) Aleutian Islands 14) Central - MI (Wisconsin border) 29) Hawaii 15) Central - ND (Oliver) #? 21 The following information has been given: United States Pacific Therefore TZ='America/Los_Angeles' will be used. Local time is now: Thu Mar 16 01:08:57 PDT 2023. Universal Time is now: Thu Mar 16 08:08:57 UTC 2023. Is the above information OK? 1) Yes 2) No #? 1 You can make this change permanent for yourself by appending the line TZ='America/Los_Angeles'; export TZ to the file '.profile' in your home directory; then log out and log in again. Here is that TZ value again, this time on standard output so that you can use the /bin/tzselect command in shell scripts: America/Los_Angeles [grid@rc ~]$tzselectコマンドで、TZ値をPDTタイム・ゾーンのAmerica/Los_Angelesとして識別しました。 -
次のコマンドを実行して、ホスト名を取得します。
hostname例:[grid@rc ~]$ hostname rc -
次のコマンドを実行して、データベース名を取得します。
srvctl config database -v例:[grid@rc ~]$ srvctl config database -v SMDB0316_iad1cx /u01/app/oracle/product/21.0.0.0/dbhome_1 21.0.0.0.0 -
gridユーザーとしてログアウトし、rootユーザーとしてサインインします。
例:[grid@rc ~]$ exit logout [opc@rc ~]$ sudo su - -
次のディレクトリに移動します。
cd $GRID_HOME/crs/install例:[root@rc ~]# cd /u01/app/21.0.0.0/grid/crs/install/ -
次のファイルのTZコンテンツを編集します。 編集後にファイルを保存して閉じます。
vim s_crsconfig_<hostname>_env.txt例:[root@rc install]# vim s_crsconfig_rc_env.txt -
ファイルのTZエントリが更新されているかどうかを確認します。
cat s_crsconfig_<hostname>_env.txt例:[root@rc install]# cat s_crsconfig_rc_env.txt ######################################################################### #This file can be used to set values for the NLS_LANG and TZ environment #variables and to set resource limits for Oracle Clusterware and #Database processes. #1. The NLS_LANG environment variable determines the language and # characterset used for messages. For example, a new value can be # configured by setting NLS_LANG=JAPANESE_JAPAN.UTF8 #2. The Time zone setting can be changed by setting the TZ entry to # the appropriate time zone name. For example, TZ=America/New_York #3. Resource limits for stack size, open files and number of processes # can be specified by modifying the appropriate entries. # #Do not modify this file except as documented above or under the #direction of Oracle Support Services. ######################################################################### TZ=America/Los_Angeles NLS_LANG=AMERICAN_AMERICA.AL32UTF8 CRS_LIMIT_STACK=2048 CRS_LIMIT_OPENFILE=65536 CRS_LIMIT_NPROC=65536 TNS_ADMIN= [root@rc install]# -
次のコマンドを使用して、新しいタイムゾーンを設定します。
timedatectl set-timezone <new_time_zone>例:[root@rc install]# timedatectl set-timezone America/Los_Angelesノート:
- ステップ1から9は、RACクラスタ内のすべてのノードで実行する必要があります。
- RACクラスタ内の任意のノードに対してステップ10から15を実行できます。
-
次のディレクトリに移動します。
cd $GRID_HOME/bin例:[root@rc install]# cd /u01/app/21.0.0.0/grid/bin/ -
次のコマンドを使用して、データベース・レベルのTZ値を目的のタイム・ゾーンに変更します。
srvctl setenv database -d <database_name> -t "TZ=<new_time_zone>"例:[root@rc bin]# ./srvctl setenv database -d SMDB0316_iad1cx -t "TZ=America/Los_Angeles" -
次のコマンドを使用して、TZ値セットを確認します。
srvctl getenv database -d <database_name>例:[root@rc bin]# ./srvctl getenv database -d SMDB0316_iad1cx SMDB0316_iad1cx: TZ=America/Los_Angeles -
すべてのコンピュート・ノードでCRSスタックを停止します。
crsctl stop cluster例:[root@rc bin]# ./crsctl stop cluster CRS-2673: Attempting to stop 'ora.crsd' on 'rc' . . . CRS-2673: Attempting to stop 'ora.cssd' on 'rc' CRS-2677: Stop of 'ora.cssd' on 'rc' succeeded [root@rc bin]# -
すべてのコンピュート・ノードでCRSスタックを起動します。
crsctl start cluster例:[root@rc bin]# ./crsctl start cluster CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rc' . . . CRS-2672: Attempting to start 'ora.crsd' on 'rc' CRS-2676: Start of 'ora.crsd' on 'rc' succeeded [root@rcbin]# -
次のコマンドを使用して、タイム・ゾーンが更新されたかどうかを確認します。
timedatectl例:[root@rc bin]# timedatectl Local time: Thu 2023-03-16 01:19:15 PDT Universal time: Thu 2023-03-16 08:19:15 UTC RTC time: Thu 2023-03-16 08:19:10 Time zone: America/Los_Angeles (PDT, -0700) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: yes Last DST change: DST began at Sun 2023-03-12 01:59:59 PST Sun 2023-03-12 03:00:00 PDT Next DST change: DST ends (the clock jumps one hour backwards) at Sun 2023-11-05 01:59:59 PDT Sun 2023-11-05 01:00:00 PSTシステムがAmerica/Los_Angeles (PDT)タイム・ゾーンになっていることを確認します。