Comparison of ohasd daemon of oracle 11.2 and 12c RAC

Source: Internet
Author: User
Tags data structures diff reserved

We have explained the startup process of 11.2 RAC. You can note that the root daemon of RAC is/etc/init. d/init. ohasd, then/etc/init. d/init. how does ohasd start?
Note: the startup process of 12.1 Non-Flex Cluster is the same as that of 11.2 RAC. However, according to the test results of RAC of version 12.2beta, OUI installation from version 12.2 may only have Flex Cluster, but does not have the common RAC of Version 11.2.
.
In Linux4 and Linux5, after completing the kernel boot (the kernel is loaded into the memory and runs, initializing all the device drivers and data structures, start a user-level program/sbin/init to start other user-level processes or services.
Therefore, init is always the first process, and its PID is always 1 (ps-aux | less). It is the parent process of all processes in the system.
[Root @ lunarnew1 grid] # ps-ef | grep init | grep-v grep
Root 1 0 0 Jan14? 00:00:00 init [5]
Root 2987 1 0 Jan14? 00:00:00/bin/sh/etc/init. d/init. ohasd run
[Root @ lunarnew1 grid] #
[Root @ lunarnew1 grid] # which init
/Sbin/init
[Root @ lunarnew1 grid] #
Next,/sbin/init reads the content of/etc/inittab./etc/inittab contains many commands to start other user processes and services:
The format is as follows:
Identifier: run_level: action: process
Therefore, the script for starting/etc/init. d/init. ohasd automatically at startup is also configured in/etc/inittab.
My environment is Linux5.10. Check the ohasd startup script details:
[Root @ lunarnew1 grid] # cat/etc/issue
Oracle Linux Server release 5.10
Kernel \ r on an \ m
 
[Root @ lunarnew1 grid] #
[Root @ lunarnew1 grid] # ll/etc/inittab. orig
Ls:/etc/inittab. orig: No such file or directory
[Root @ lunarnew1 grid] # ll/etc/inittab *
-Rw-r -- 1 root 1671 Mar 21 2015/etc/inittab. no_crs
-Rw-r -- 1 root 1740 Mar 21 2015/etc/inittab. crs
-Rw-r -- 1 root 1740 Mar 21 2015/etc/inittab
[Root @ lunarnew1 grid] #
Let's take a look at the differences between the three files:
[Root @ lunarnew1 grid] # diff/etc/inittab. crs/etc/inittab
[Root @ lunarnew1 grid] # diff/etc/inittab. no_crs/etc/inittab
58a59, 60
>
> H1: 35: respawn:/etc/init. d/init. ohasd run>/dev/null 2> & 1 </dev/null
[Root @ lunarnew1 grid] #
It can be seen that/etc/inittab. the content of no_crs is the/etc/inittab backup file before GI is installed, and/etc/inittab. the crs content is the/etc/inittab backup file after GI is installed.
That is to say, after RAC (10.2 or 11.2) is installed in Linux 5, the script adds the script for starting the ohasd daemon process in the previous line. If you want to start crs at system startup, you need to include the following startup command in the/etc/inittab:
H1: 35: respawn:/etc/init. d/init. ohasd run>/dev/null 2> & 1 if you want to disable crs when the system is started, the above line cannot be included. Of course, this method is not supported by Oracle. It is recommended that you use crsctl disable has to disable HAS from startup.
(Note: If the rac environment is used, use the crsctl disable crs command)
The full content of/etc/inittab is as follows (note that only versions of Linux 5 and Linux 5 are as follows ):
[Root @ lunarnew1 grid] # cat/etc/inittab
#
# Inittab This file describes how the INIT process shocould set up
# The system in a certain run-level.
#
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#
 
# Default runlevel. The runlevels used by RHS are:
#0-halt (Do NOT set initdefault to this)
#1-Single user mode
#2-Multiuser, without NFS (The same as 3, if you do not have networking)
#3-Full multiuser mode
#4-unused
#5-X11
#6-reboot (Do NOT set initdefault to this)
#
Id: 5: initdefault:
 
# System initialization.
Si: sysinit:/etc/rc. d/rc. sysinit
 
L0: 0: wait:/etc/rc. d/rc 0
L1: 1: wait:/etc/rc. d/rc 1
L2: 2: wait:/etc/rc. d/rc 2
L3: 3: wait:/etc/rc. d/rc 3
L4: 4: wait:/etc/rc. d/rc 4
L5: 5: wait:/etc/rc. d/rc 5
L6: 6: wait:/etc/rc. d/rc 6
 
# Trap CTRL-ALT-DELETE
Ca: ctrlaltdel:/sbin/shutdown-t3-r now
 
# When our UPS tells us power has failed, assume we have a few minutes
# Of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.
Pf: powerfail:/sbin/shutdown-f-h + 2 "Power Failure; System Shutting Down"
 
# If power was restored before the shutdown kicked in, cancel it.
Pr: 12345: powerokwait:/sbin/shutdown-c "Power Restored; Shutdown Cancelled"
 
 
# Run gettys in standard runlevels
1: 2345: respawn:/sbin/mingetty tty1
2: 2345: respawn:/sbin/mingetty tty2
3: 2345: respawn:/sbin/mingetty tty3
4: 2345: respawn:/sbin/mingetty tty4
5: 2345: respawn:/sbin/mingetty tty5
6: 2345: respawn:/sbin/mingetty tty6
 
# Run xdm in runlevel 5
X: 3: respawn:/etc/X11/preofdm-nodaemon
 
 
H1: 35: respawn:/etc/init. d/init. ohasd run>/dev/null 2> & 1 </dev/null
[Root @ lunarnew1 grid] #
In Linux 6, init only reads configuration files, processes dependencies between various services and applications, starts these functions and services based on events, and dynamically manages them.
In Linux 6, events are managed by the "Upstart event manager" and these events are controlled by the initctl tool. The initctl function is similar to the chkconfig tool in Linux 5.
Here is a set of 11.2.0.4 single-host ASM environment (Standalone) installed in Linux 6.6. We can see that there is no/etc/inittab. orig file in Linux 5:
[Root @ lunarlib rootwork] # ll/etc/inittab. orig
Ls: cannot access/etc/inittab. orig: No such file or directory
[Root @ lunarlib rootwork] #
That is to say, in Linux 6, Oracle no longer uses/etc/init. d/init. the ohasd startup will not write the/etc/inittab file (the ohasd script cannot be started by the/sbin/init process based on inittab ):
[Root @ lunarlib rootwork] # ll/etc/inittab *
-Rw-r -----. 1 root 884 Apr 6 2015/etc/inittab
[Root @ lunarlib rootwork] #
[Root @ lunarlib rootwork] # tail/etc/inittab
# Default runlevel. The runlevels used are:
#0-halt (Do NOT set initdefault to this)
#1-Single user mode
#2-Multiuser, without NFS (The same as 3, if you do not have networking)
#3-Full multiuser mode
#4-unused
#5-X11
#6-reboot (Do NOT set initdefault to this)
#
Id: 3: initdefault:
[Root @ lunarlib rootwork] #
In Linux 6, how does the Oracle RAC daemon start?
Because the upstart event boot mechanism (as a unique feature of Linux 6) is adopted in the system from Linux 6 ), determine which services the system runs at startup based on the event management configuration file in the/etc/init/directory:
[Root @ lunarlib init. d] # cat/etc/init/oracle-ohasd.conf
# Copyright (c) 2001,201 1, Oracle and/or its affiliates. All rights reserved.
#
# Oracle OHASD startup
 
Start on runlevel [35]
Stop on runlevel [! 35]
Respawn
Exec/etc/init. d/init. ohasd run>/dev/null 2> & 1 </dev/null
[Root @ lunarlib init. d] #
Therefore, Oracle also adopts this method. When GI is installed, oracle configures a configuration file for the/etc/init. d/init. ohasd pilot process, that is, the/etc/init/oracle-ohasd.conf configuration file.
That is to say, in Linux 6, the use of the oracle-ohasd.conf configuration file under the/etc/init directory to start the way, instead of the configuration in Linux5 using/etc/inittab.
This is why Oracle conforms to the development of Linux and changes in different versions of Linux based on the system boot and service startup mechanism.
[Root @ lunarlib rootwork] # ll/etc/init
Total 72
-Rw-r --. 1 root 412 Jul 22 2014 control-alt-delete.conf
-Rw-r --. 1 root 130 Mar 12 2014 init-system-dbus.conf
-Rw-r --. 1 root 463 Jul 22 2014 kexec-disable.conf
-Rw-r -- 1 root 220 Oct 11 oracle-ohasd.conf
-Rw-r --. 1 root 560 Jul 22 2014 plymouth-shutdown.conf
-Rw-r --. 1 root 357 Jul 22 2014 preofdm. conf
-Rw-r --. 1 root 505 Jul 22 2014 quit-plymouth.conf
-Rw-r --. 1 root 417 Jul 22 2014 rc. conf
-Rw-r --. 1 root 1046 Jul 22 2014 rcS. conf
-Rw-r --. 1 root 430 Jul 22 2014 rcS-emergency.conf
-Rw-r --. 1 root 725 Jul 22 2014 rcS-sulogin.conf
-Rw-r --. 1 root 2915 Nov 21 2013 readahead-collector.conf
-Rw-r --. 1 root 1559 Nov 21 2013 readahead. conf
-Rw-r --. 1 root 726 Nov 21 2013 readahead-disable-services.conf
-Rw-r --. 1 root 1302 Jul 22 2014 serial. conf
-Rw-r --. 1 root 791 Jul 22 2014 splash-manager.conf
-Rw-r --. 1 root 473 Jul 22 2014 start-ttys.conf
-Rw-r --. 1 root 335 Jul 22 2014 tty. conf
[Root @ lunarlib rootwork] #
[Root @ lunarlib rootwork] # ls-l/etc/init/oracle-ohasd.conf
-Rw-r -- 1 root 220 Oct 11 01:30/etc/init/oracle-ohasd.conf
[Root @ lunarlib rootwork] #
In Linux 6, you can use the/sbin/initctl tool (similar to the chkconfig tool of Linux5) to manage the startup of/etc/init. d/init. ohasd.
(Note: you cannot use chkconfig in Linux5 to manage the/etc/init. d/init. ohasd process)
[Root @ lunarlib rootwork] # initctl list
Rc stop/waiting
Tty (/dev/tty3) start/running, process 4353
Tty (/dev/tty2) start/running, process 4349
Tty (/dev/tty1) start/running, process 4347
Tty (/dev/tty6) start/running, process 4365
Tty (/dev/tty5) start/running, process 4361
Tty (/dev/tty4) start/running, process 4359
Plymouth-shutdown stop/waiting
Control-alt-delete stop/waiting
RcS-emergency stop/waiting
Readahead-collector stop/waiting
Kexec-disable stop/waiting
Quit-plymouth stop/waiting
RcS stop/waiting
Preofdm stop/waiting
Init-system-restart stop/waiting
Readahead stop/waiting
Splash-manager stop/waiting
Start-ttys stop/waiting
Readahead-disable-services stop/waiting
RcS-sulogin stop/waiting
Serial stop/waiting
Oracle-ohasd start/running, process 12661
[Root @ lunarlib rootwork] #
View the oracle-ohasd service information:
[Root @ lunarlib rootwork] #/sbin/initctl list | grep oracle-ohasd
Oracle-ohasd start/running, process 2897
[Root @ lunarlib rootwork] #
[Root @ lunarlib rootwork] # ps-ef | grep ohasd
Root 2897 1 0 06:05? 00:00:01/bin/sh/etc/init. d/init. ohasd run
Root 6651 6336 0 00:00:00 pts/0 grep ohasd
[Root @ lunarlib rootwork] #
In Linux 7, the system adopts the systemd mechanism and uses socket and D-Bus to start the service in parallel, provides a daemon-demand startup policy based on the Daemon. There is no running level concept (but fully compatible with sysvinit ).
The configuration files of the services to be started are stored in the/lib/systemd/system/directory and named *. service, which is similar to the following:
In Linux7, the ohasd unit used to start and load Oracle RAC must be configured as follows (during installation, run root. sh will configure the ohasd service unit. If it is not configured, you can manually configure it ):
[Root @ lunar system] # ll/etc/systemd/system/| grep ohasd
-Rw-r -- 1 root 361 Oct 9 oracle-ohasd.service
[Root @ lunar system] #
[Root @ lunar system] # systemctl list-units-t service | grep ohasd
Ohasd. service loaded active exited ohasd. service
Oracle-ohasd.service loaded active running Oracle High Availability Services
[Root @ lunar system] #
In fact, it is installed on Linux 7 (the current version is only Linux 7.1 and 7.2), and Oracle 11.2.0.4 (in version 11.2, only 11.2.0.4 supports Linux 7, when the remaining 11.2 versions support Linux versions earlier than 7) and 12c (the current version is 12.1 and 12.2beta) RAC, the file cannot be root due to a bug. sh created by yourself.
For details, see the format of the service definition file:
[Root @ lunar system] # cat/etc/systemd/system/oracle-ohasd.service
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
#
# Oracle OHASD startup
 
[Unit]
Description = Oracle High Availability Services
After1_syslog.tar get network.tar get remote-fs.target
 
[Service]
ExecStart =/etc/init. d/init. ohasd run>/dev/null 2> & 1 </dev/null
Type = simple
Restart = always
 
[Install]
Wantedbypolicmulti user.tar get graphical.tar get
[Root @ lunar system] #
In the cell definition of systemd, if "After =" is specified, the service depends on the service specified by "After. If there is no After, the service can be started in parallel with other services.
This defines that oracle-ohasd.servicestarts after syslog.tar get network.tar get remote-fs.target is started.
Run the following command:/etc/init. d/init. ohasd run>/dev/null 2> & 1. The startup type is simple.
Finally, we can view all the units currently loaded by the system:
[Root @ lunar system] # ll/etc/systemd/system/
Total 16
Drwxr-xr-x. 2 root 30 Oct 8 07:17 basic.tar get. wants
Drwxr-xr-x. 2 root 30 Oct 7 20.th.tar get. wants
Lrwxrwxrwx. 1 root 41 Oct 7 dbus-org.bluez.service->/usr/lib/systemd/system/bluetooth. service
Lrwxrwxrwx. 1 root 44 Oct 7 dbus-org.freedesktop.ModemManager1.service->/usr/lib/systemd/system/ModemManager. service
Lrwxrwxrwx. 1 root 46 Oct 7 dbus-org.freedesktop.NetworkManager.service->/usr/lib/systemd/system/NetworkManager. service
Lrwxrwxrwx. 1 root 57 Oct 7 dbus-org.freedesktop.nm-dispatcher.service->/usr/lib/systemd/system/NetworkManager-dispatcher.service
Lrwxrwxrwx 1 root 41 Oct 8 default.tar get->/usr/lib/systemd/system/multi-user.target
Drwxr-xr-x. 2 root 85 Oct 7 default.tar get. wants
Lrwxrwxrwx. 1 root 35 Oct 7 display-manager.service->/usr/lib/systemd/system/TPD. service
Drwxr-xr-x. 2 root 31 Oct 7 23:02 getty.tar get. wants
Drwxr-xr-x. 2 root 90 Oct 9 :29 graphical.tar get. wants
Drwxr-xr-x. 2 root 4096 Oct 9 multi-user.target.wants
Lrwxrwxrwx. 1 root 38 Oct 7 mysql. service->/usr/lib/systemd/system/mysqld. service
-Rw-r -- 1 root 361 Oct 9 oracle-ohasd.service
Drwxr-xr-x. 2 root 25 Oct 7 23:05 printer.tar get. wants
Drwxr-xr-x. 2 root 4096 Oct 8 07:32 sockets.tar get. wants
Drwxr-xr-x. 2 root 35 Oct 7 spice-vdagentd.target.wants
Drwxr-xr-x. 2 root 4096 Oct 8 22:19 sysinit.tar get. wants
Drwxr-xr-x. 2 root 83 Oct 7 system-update.target.wants
[Root @ lunar system] #
[Root @ lunar system] # ps-ef | grep ohasd
Root 1132 1 0? 00:00:00/bin/sh/etc/init. d/init. ohasd run>/dev/null 2> & 1 </dev/null
Grid 4017 1 0? 00:00:59/u01/app/12.1.0.2/grid/bin/ohasd. bin reboot
Root 11362 8874 0 00:00:00 pts/1 grep -- color = auto ohasd
[Root @ lunar system] #

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.