시간대 관리

콘솔 및 API의 Time Zone 필드를 사용하면 UTC(기본값)가 아닌 시간대로 DB 시스템 리소스를 실행할 수 있습니다.

데이터베이스 시스템을 생성할 때 지정한 시간대는 호스트 및 Oracle Grid Infrastructure(시스템에 Grid Infrastructure가 있는 경우)에 적용되고 데이터베이스 로그 파일의 시간대를 제어합니다. 데이터베이스 자체의 시간대는 영향을 받지 않습니다. 그러나 데이터베이스의 시간대는 timestamp 데이터 유형에만 영향을 줍니다. 데이터베이스 시간대를 수동으로 변경할 수 있지만 Oracle에서는 데이터베이스 간에 데이터가 전송될 때 데이터 변환을 방지하고 성능을 향상시키기 위해 데이터베이스 시간대를 UTC(기본값)로 유지할 것을 권장합니다. 이 구성은 분산 데이터베이스, 복제 및 엑스포트/임포트 작업에 특히 중요합니다.

UTC는 사용할 권장 시간대이지만 데이터베이스 클라이언트와 응용 프로그램 호스트에 대해 공통 시간대를 갖추면 데이터베이스 관리자의 관리 및 문제 해결이 간소화됩니다.

주: 시간대는 주로 표시 목적으로 사용되거나 사용자 입력을 처리하는 데 사용됩니다. 시간대를 변경해도 시스템 시계의 시간은 변경되지 않습니다.

시간대 옵션

콘솔 또는 API 사용 여부에 관계없이 선택할 수 있는 시간대 옵션은 이름이 지정된 영역 형식(예: America/Los_Angeles)으로 표시됩니다. 콘솔에서는 UTC, 브라우저에서 감지된 시간대(브라우저에서 시간대 감지를 지원하는 경우) 또는 대체 시간대를 선택할 수 있습니다.

대체 시간대(다른 시간대 선택 옵션)를 지정하려면 먼저 지역 또는 국가 필드에서 값을 선택하여 시간대 필드에서 선택할 시간대 목록을 제한합니다. America/Los_Angeles 예에서 America는 시간대이고 Los_Angeles는 시간대입니다. 이 두 필드에 표시되는 옵션은 Java.util.TimeZone 클래스 및 Linux 운영 체제에서 지원되는 시간대와 대략 관련이 있습니다. 원하는 시간대가 보이지 않으면 지역 및 국가 필드에서 "기타"를 선택하십시오.

참고: API를 사용 중이고 지원되는 시간대 목록을 보려면 콘솔에서 시간대 옵션을 검사할 수 있습니다. 이러한 옵션은 DB 시스템 구성을 선택한 후 고급 옵션을 표시하면 DB 시스템 생성 페이지에 나타납니다.

현재 시간대 보기

시간대 정보를 보려면 다음 단계를 수행합니다.

  1. Grid 유저로 호스트에 로그온합니다.

    예제:

    [opc@rc ~]$ sudo su - grid
  2. 다음 명령을 사용하여 시간대를 봅니다.

    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 시간대입니다.

  3. 데이터베이스에 로그온합니다.

    예제:

    [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
  4. 다음 명령을 사용하여 현재 데이터베이스 시간을 확인할 수 있습니다.

    sysdate

    예제:

    SQL> select to_char(sysdate,'DD-MON-YYYY HH24:MI:SS') from dual;
    
    TO_CHAR(SYSDATE,'DD-
    --------------------
    16-MAR-2023 08:00:40
  5. 종료.

DB 시스템의 시간대 변경

DB 시스템의 시간대를 설정하려면 다음 단계를 수행합니다.

  1. 루트 사용자로 호스트에 로그온합니다.

    예제:

    [opc@rc ~]$ sudo su -
  2. 다음 명령을 사용하여 설정할 올바른 시간대(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 명령에서 TZ 값을 EDT 시간대에 대한 America/New_York로 식별했습니다.

  3. 다음 명령을 업데이트하여 새 시간대를 설정합니다.

    timedatectl set-timezone <new_time_zone>

    예제:

    [root@rc ~]# timedatectl set-timezone America/New_York
  4. 다음 명령을 사용하여 시간대가 업데이트되었는지 확인합니다.

    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) 시간대에 있습니다.

  5. 종료.

Grid Infrastructure를 사용하는 DB 시스템에서 호스트의 시간대 변경

Oracle Grid Infrastructure의 시간대는 데이터베이스 로그 파일의 시간대를 결정합니다.

다음 단계를 수행하여 스토리지 관리에 Grid Infrastructure를 사용하는 DB 시스템 호스트의 시간대 정보를 업데이트합니다.

참고:

  1. grid 사용자로 호스트에 로그온합니다.

    예제:

    [opc@rc ~]$ sudo su - grid
  2. 다음 명령을 사용하여 설정할 올바른 시간대(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로 식별했습니다.

  3. 다음 명령을 실행하여 호스트 이름을 가져옵니다.

    hostname

    예제:

    [grid@rc ~]$ hostname
    rc
  4. 다음 명령을 실행하여 데이터베이스 이름을 가져옵니다.

    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
  5. 그리드 사용자로 로그아웃하고 루트 사용자로 사인인합니다.

    예제:

    [grid@rc ~]$ exit
    logout
    [opc@rc ~]$ sudo su -
  6. 다음 디렉토리로 이동합니다.

    cd $GRID_HOME/crs/install

    예제:

    [root@rc ~]# cd /u01/app/21.0.0.0/grid/crs/install/
  7. 다음 파일의 TZ 내용을 편집합니다. 파일을 편집한 후 저장하고 닫습니다.

    vim s_crsconfig_<hostname>_env.txt

    예제:

    [root@rc install]# vim s_crsconfig_rc_env.txt
  8. 파일의 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]#
  9. 다음 명령을 사용하여 새 시간대를 설정합니다.

    timedatectl set-timezone <new_time_zone>

    예제:

    [root@rc install]# timedatectl set-timezone America/Los_Angeles

    참고:

    • RAC 클러스터의 모든 노드에서 1-9단계를 수행해야 합니다.
    • RAC 클러스터의 모든 노드에서 10~15단계를 수행할 수 있습니다.
  10. 다음 디렉토리로 이동합니다.

    cd $GRID_HOME/bin

    예제:

    [root@rc install]# cd /u01/app/21.0.0.0/grid/bin/
  11. 다음 명령을 사용하여 데이터베이스 레벨의 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"
  12. 다음 명령을 사용하여 TZ 값 세트를 확인합니다.

    srvctl getenv database -d <database_name>

    예제:

    [root@rc bin]# ./srvctl getenv database -d SMDB0316_iad1cx
    SMDB0316_iad1cx:
    TZ=America/Los_Angeles
  13. 모든 컴퓨트 노드에서 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]#
  14. 모든 컴퓨트 노드에서 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]#
  15. 다음 명령을 사용하여 시간대가 업데이트되었는지 확인합니다.

    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) 시간대에 있습니다.