4.13.2 Change Time Zone Settings on the Database Servers

After modifying the time zone setting on the storage cells, you can change the time zone setting on the database servers.

This procedure follows on from the procedure to modify the time zone on the storage servers as described in Change Time Zone Settings on Storage Servers.

Before starting this procedure, ensure that Oracle Clusterware is shut down on all of the database servers in the cluster.

  1. Log in to the database server as the root user.
  2. Take note of the Oracle Linux version used on the database server.

    For example:

    # cat /etc/system-release
    Oracle Linux Server release 8.8
    
  3. Change the operating system time zone configuration.

    Choose the appropriate method based on the Oracle Linux version used on the database server.

    • If the database server uses Oracle Linux 6 or earlier, then copy /etc/localtime and /etc/sysconfig/clock from any of the storage cells to the database server.

      # scp root@cell_name:/etc/localtime /etc/localtime
      # scp root@cell_name:/etc/sysconfig/clock /etc/sysconfig/clock
      
    • If the database server uses Oracle Linux 7 or later, then use the timedatectl command to change the operating system time zone configuration.

      • To view the current time zone configuration, run /usr/bin/timedatectl with no additional options. For example:

        # /usr/bin/timedatectl
                       Local time: Tue 2024-04-02 15:24:16 NZDT
                   Universal time: Tue 2024-04-02 02:24:16 UTC
                         RTC time: Tue 2024-04-02 02:24:17
                        Time zone: Antarctica/McMurdo (NZDT, +1300)
        System clock synchronized: yes
                      NTP service: active
                  RTC in local TZ: no
      • To change the time zone setting, run timedatectl with the set-timezone option. For example:

        # /usr/bin/timedatectl set-timezone America/New_York
      • To view a list of available time zones, run timedatectl with the list-timezones option. For example:

        # /usr/bin/timedatectl list-timezones
        ...
        America/Monterrey
        America/Montevideo
        America/Montserrat
        America/Nassau
        America/New_York
        America/Nipigon
        America/Nome
        America/Noronha
        America/North_Dakota/Beulah
        America/North_Dakota/Center
        America/North_Dakota/New_Salem
        America/Ojinaga
        America/Panama
        America/Pangnirtung
        America/Paramaribo
        America/Phoenix
        ...
  4. Change the time zone setting in /opt/oracle.cellos/cell.conf.

    Edit the <Timezone> entry.

    For example:

    ...
    <Timezone>America/New_York</Timezone>
    ...
  5. Change the Oracle Clusterware time zone configuration.

    Edit the TZ entry in $GRID_HOME/crs/install/s_crsconfig_<nodename>_env.txt.

    For example:

    TZ=America/New_York
  6. Change the time zone environment variable (TZ) setting in the oracle OS user profile. Also change the grid OS user profile, if applicable.

    The following example shows the time zone environment variable (TZ) setting in the bash profile (.bash_profile) associated with the oracle OS user.

    # cat /home/oracle/.bash_profile | grep TZ
    export TZ=America/New_York
  7. Change the Oracle Clusterware settings to prevent the CRS stack from starting automatically after restarting the database server.
    # Grid_home/bin/crsctl disable crs
  8. Reboot the database server.
    # shutdown -r now
  9. Verify that the time zone has been changed on the database server.

    Use the date command verify the time zone change.

    For example:

    # date
    Mon Apr 1 22:26:00 EDT 2024

    If the database server uses Oracle Linux 7 or later, you can also use the timedatectl command.

    For example:

    # /usr/bin/timedatectl
                   Local time: Mon 2024-04-01 22:26:30 EDT
               Universal time: Tue 2024-04-02 02:26:30 UTC
                     RTC time: Tue 2024-04-02 02:26:31
                    Time zone: America/New_York (EDT, -0400)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no
  10. After verifying the new time zone setting on the database server, enable and restart Oracle Clusterware.
    # Grid_home/bin/crsctl enable crs
    # Grid_home/bin/crsctl start crs
  11. Verify that the database time stamp matches the operating system time.
    On each database, compare output from the operating system date command with output from the following SQL command:
    SQL> SELECT systimestamp FROM dual;
  12. Repeat the previous steps on all of the database servers in the cluster.