NTP client configuration for Oracle Linux Servers








NTP client configuration for Oracle Linux Servers
                                                  


Maaz Khan



October 24, 2018

Version 1.0

Status:












Document Control
Revision History
Revision Number
Date
Author
Change Summary
1.0
October 24, 2018
Maaz Khan

Reviewers

Name
Role
Document Version
Date Reviewed
Comments










Approvers

Name
Role
Document Version
Date Reviewed
Comments










Contributors

Name
Role
Document Version
Comments Incorporated



















About this Document
Background
This document will cover use of ntp service to synchronize time with ntp servers.

Intended Audience
This document is primarily meant for database administrators, system administrators, Team Leaders, Technical Managers, etc.

References
https://docs.oracle.com/cd/E37670_01/E41138/html/section_m5p_j1h_pp.html
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s1-checking_the_status_of_ntp
https://www.ntppool.org/zone/om
https://www.howtogeek.com/tips/how-to-sync-your-linux-server-time-with-network-time-servers-ntp/
https://www.akadia.com/services/ntp_synchronize.html

Attachments






















Table of Contents




























 Summary-

NTP stands for Network Time Protocol. NTP is organized in a hierarchical client-server model. Top hierarchy contains reference clocks. A reference clock also known as stratum 0 is cesium clock or a Global Positioning System (GPS) that receives time from satellites.
Attached to these machines there are the so-called stratum 1 servers (that is, stratum 0 clients), which are the top level time servers available to the Internet, that is, they are the best NTP servers available.
Following this hierarchy, the next level in the structure are the stratum 2 servers which in turn are the clients for stratum 1 servers.
The lowest level of the hierarchy is made up by stratum 16 servers.
Every server that is synchronized with a stratum n server is termed as being at stratum n+1 level.













Choosing NTP Server for DCF –

As we do not have our own NTP server, we will be using ntp server to check time on periodic basis over internet for on-prem servers which are ntp clients in this case –
pool.ntp.org project is a big virtual cluster of timeservers providing reliable easy to use NTP service for millions of clients. From list of servers across globe, this open source project has suggested below ntp server list for Oman –
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
These servers are in Asia zone








Steps to configure ntp (tested in Clone)


Shutting down services-

1.       Shut down apps services
adstpall apps/appspwd

Manually check and make sure if all application services are down.
ps -ef | grep applmgr

2.    Shut down database and listener
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

3.    Shut down ASM
[oraprod@clone ~]$ source /home/oraprod/asm.env
[oraprod@clone ~]$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'clone'
CRS-2673: Attempting to stop 'ora.CLONE.lsnr' on 'clone'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'clone'
CRS-2677: Stop of 'ora.CLONE.lsnr' on 'clone' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'clone' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'clone'
CRS-2677: Stop of 'ora.asm' on 'clone' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'clone'
CRS-2677: Stop of 'ora.evmd' on 'clone' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'clone'
CRS-2677: Stop of 'ora.cssd' on 'clone' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'clone' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[oraprod@clone ~]$











NTP Configuration -

 

1.       Update NTP File –
vi /etc/ntp.conf
We will be using asia ntp servers to synchronize them. This is because there are 0 servers assigned for Oman and we did not find any server for UAE either.
Refer - https://www.ntppool.org/zone/om
Backup file - /etc/ntp.conf
Comment below lines -
#server 0.rhel.pool.ntp.org
#server 1.rhel.pool.ntp.org
#server 2.rhel.pool.ntp.org

Add below lines -
#### new lines for Oman ntp servers
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org


2.       Start ntpd service on Clone –
Service ntpd start
3.       Stop ntpd service to synchronize time
Service ntpd stop
4.       Update ntpd using ntpdate
/usr/sbin/ntpdate asia.pool.ntp.org






















Synchronizing time every day using cron scheduler –

For security reasons, we have disabled internet to our server and hence real time synchronization is not possible. In such case, we will be scheduling synchronization after mid night 2 am using a script.
The script will –
1.    Enable internet by adding gateway
2.    Stop ntpd service
3.    Run ntpdate command
4.    Start ntpd service
5.    Disable internet by deleting gateway

Script Details –
[root@prod3 scripts]# cat ntp_sync.sh
#!/bin/bash
route add default gw 195.1.1.8 eth0
service ntpd stop
/usr/sbin/ntpdate asia.pool.ntp.org
service ntpd start
route del  default gw 195.1.1.8 eth0
exit



Post steps –

Startup services-

1.       Startup asm
[oraprod@clone ~]$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[oraprod@clone ~]$ crsctl stat res -t
----------------------------------------------------------------------------
Name           Target  State        Server                   State details
----------------------------------------------------------------------------
Local Resources
----------------------------------------------------------------------------
ora.CLONE.lsnr
               ONLINE  OFFLINE      clone                    STABLE
ora.DATA.dg
               ONLINE  ONLINE       clone                    STABLE
ora.asm
               ONLINE  ONLINE       clone                    Started,STABLE
ora.ons
               OFFLINE OFFLINE      clone                    STABLE
----------------------------------------------------------------------------
Cluster Resources
----------------------------------------------------------------------------
ora.clone.db
      1        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.cssd
      1        ONLINE  ONLINE       clone                    STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       clone                    STABLE
----------------------------------------------------------------------------

Manually check and make sure if all application services are down.
ps -ef | grep applmgr

2.    Start database and listener
SQL> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 2.1475E+10 bytes
Fixed Size                  3722144 bytes
Variable Size            1543504992 bytes
Database Buffers         1.9864E+10 bytes
Redo Buffers               63385600 bytes
Database mounted.
Database opened.
[oraprod@clone ~]$ lsnrctl start CLONE

3.  Start apps node
[applprod@clone ~]$ adstrtal.sh apps/appspwd






















Validation-

1.       Logon to Oracle Applications and validate –

2.       Logon to Backend server and validate –




Issue faced -

[root@clone ~]# /usr/sbin/ntpdate pool.ntp.org
24 Oct 10:26:16 ntpdate[730]: no server suitable for synchronization found

Solution -
Make sure server is accessible to internet.