How to change default boot entry in RHEL7

by Jephe Wu

https://access.redhat.com/solutions/1605183

Check default kernel configured 

grubby --default-kernel


Check default kernel is kernel or kernel-uek


cat /etc/sysconfig/kernel

Check entry numbering


awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
or
grep ^menu  /etc/grub2.cfg | awk -F\'   '{print $2}'

setup default entry to reboot


grub2-set-default 1

Note: this will change /boot/grub2/grubenv

change /etc/default/grub requires to rebuild /etc/grub2.cfg


grub2-mkconfig -o /boot/grub2/grub.cfg





Installing Oracle database 19c on Oracle Linux 7


by Jephe Wu

Preparation

Download 19c database rpm 
yum install tigervnc-server xterm
yum install oracle-database-preinstall-19c.x86_64
yum localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm

yum install wget
wget https://yum.oracle.com/repo/OracleLinux/OL6/9/base/x86_64/getPackage/xorg-x11-twm-1.0.3-5.1.el6.x86_64.rpm
rpm -ivh xorg-x11-twm-1.0.3-5.1.el6.x86_64.rpm 

su - oracle
vncserver 

 type in oracle as password

ssh -X -i /home/local/ANT/wujephe/jephe-sydney.pem ec2-user@52.62.117.20 -L 5901:localhost:5901

Use Linux Remmina to connect to VNC localhost:1 with password 'oracle'.

Users and groups preparation

As preinstall rpm won't create asm* groups by itself, you might need to manually create them first.

Check /etc/groups for group id usage to find out which are available then create accordingly.
# groupadd -g 54421 oinstall
# groupadd -g 54322 dba
# groupadd -g 54323 oper
# groupadd -g 54324 backupdba
# groupadd -g 54325 dgdba
# groupadd -g 54326 kmdba
# groupadd -g 54327 asmdba
# groupadd -g 54328 asmoper
# groupadd -g 54329 asmadmin
# groupadd -g 54330 racdba

# useradd --uid 54321 --gid oinstall --groups dba,oper,asmdba,racdba,backupdba,dgdba,kmdba oracle

# useradd --uid 54322 --gid oinstall --groups dba,asmadmin,asmdba,asmoper,racdba grid

You might need to run usermod to change oracle user groups as it's being created by oracle-database-ee-19c-1.0-1.x86_64.rpm

usermod -G dba,oper,asmdba,racdba,backupdba,dgdba,kmdba oracle

Otherwise, when installing database software, it might not able to find ASM disk group.

Refer to https://access.redhat.com/documentation/en-us/reference_architectures/2017/html/deploying_oracle_rac_database_12c_release_2_on_red_hat_enterprise_linux_7/ref_config_details#user_groups

Note: for oracle and grid user, it's very important for them to belong to secondary group as follows

usermod -G dba,asmdba,backupdba,dgdba,kmdba,racdba oracle
usermod -G asmadmin,asmdba,racdba grid

Directory preparation

login as root , run
mkdir -p /u01/app/19.0.0/grid
mkdir -p /u01/app/oracle
chown -R grid:oinstall /u01
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/

Note: grid infrastructure installation will ask for ORACLE_HOME directory which is for some logging within grid, just use default value prompted.



For grid installation
login as grid user
$ cd /u01/app/19.0.0/grid
$ unzip -q /u01/softwares/grid_home.zip
$ ./gridSetup.sh   # within vnc window

Install cvuqdisk rpm before starting grid installation

[root@localhost 19.0.0]# cd grid/cv/rpm/
[root@localhost rpm]# ls
cvuqdisk-1.0.10-1.rpm

[root@localhost rpm]# rpm -ivh cvuqdisk-1.0.10-1.rpm
Preparing...                          ################################# [100%]
Using default group oinstall to install package
Updating / installing...
   1:cvuqdisk-1.0.10-1                ################################# [100%]

Device consistency 

use UDEV rules

https://oracle-base.com/articles/linux/udev-scsi-rules-configuration-in-oracle-linux 

[root@ip-172-31-6-220 rules.d]# more 99-oracleasm.rules

KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="360014057643ce73dd3a4080b6832a913", SYMLINK+="asm-disk1", OWNER="grid", GROUP="oinstall", MODE="0660"

[root@ip-172-31-6-220 rules.d]# ll /dev/sda1

brw-rw----. 1 grid oinstall 8, 1 Jun 21 00:42 /dev/sda1

[root@ip-172-31-6-220 rules.d]# ll /dev/asm-disk1

lrwxrwxrwx. 1 root root 4 Jun 21 00:42 /dev/asm-disk1 -> sda1

[root@ip-172-31-6-220 rules.d]# /usr/lib/udev/scsi_id -g -u -d /dev/sda1

360014057643ce73dd3a4080b6832a913

[root@ip-172-31-6-220 rules.d]# udevadm control --reload-rules

[root@ip-172-31-6-220 rules.d]# udevadm trigger

use ASMFD


$ su root
# export ORACLE_HOME=/u01/app/19.0.0/grid
# export ORACLE_BASE=/tmp
Use Oracle ASM command line tool (ASMCMD) to provision the disk devices for use with Oracle ASM Filter Driver.
# cd /u01/app/19.0.0/grid/bin
# ./asmcmd afd_label DATA1 /dev/sdb --init
# ./asmcmd afd_label DATA2 /dev/sdc --init
# ./asmcmd afd_label DATA3 /dev/sdd --init

to unlabel:

# /u01/app/19.0.0/grid/bin/asmcmd afd_unlabel /dev/sdb -f --init

Verify the device has been marked for use with Oracle ASMFD.
# ./asmcmd afd_lslbl /dev/sdb
# ./asmcmd afd_lslbl /dev/sdc
# ./asmcmd afd_lslbl /dev/sdd

Log in as the grid user, and start the Oracle Grid Infrastructure installer by running the following command:
$ /u01/app/19.0.0/grid/gridSetup.sh

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ostmg/administer-filter-driver.html#GUID-6F16B5EC-BE7D-44FA-A05B-A62CF33763D3

Note: above requires /dev/sdb to be owned by grid:oinstall based on my testing, otherwise, Grid will fail to open ASM disk,  maybe put into /etc/rc.d/rc.local as follows

chown grid:oinstall /dev/sdb

VNC preparation

login as grid and oracle user, run
vncserver :1 and vncserver :2 to start vnc server


Installation for database

$ mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
$ chgrp oinstall /u01/app/oracle/product/19.0.0/dbhome_1
$ cd /u01/app/oracle/product/19.0.0/dbhome_1
$ unzip -q /tmp/db_home.zip
$ cd /u01/app/oracle/product/19.0.0/dbhome_1
$ ./runInstaller

References

https://dbaclass.com/article/move-spfile-file-system-asm-rac/
https://access.redhat.com/documentation/en-us/reference_architectures/2017/html-single/deploying_oracle_rac_database_12c_release_2_on_red_hat_enterprise_linux_7/index

https://oracle-base.com/articles/12c/oracle-db-12cr2-rac-installation-on-oracle-linux-7-using-virtualbox


Issues


Error 49802 Initializing ADR when running gridSetup.sh

=> make sure /u01/app/19.0.0/grid and subdirectory are owned by grid:oinstall

chown grid:oinstall -R /u01/app/19.0.0/grid

 
ORA-15107: missing or invalid ASM disk name
=> change /etc/udev/rules.d/99-oracleasm.rules from /dev/sd?1


[root@localhost rules.d]# more 99-oracleasm.rules
KERNEL=="sd?", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB9ded913b-c5b04341", SYMLINK+="asm-disk1", OWNER="grid", GROUP="asmad

min", MODE="0660"


[grid@localhost ~]$ /u01/app/19.0.0/grid/bin/asmca -silent -oui_internal -configureASM -diskString '/dev/sd*' -diskGroupName DATA -diskList /dev/sdb1 -redundancy EXTERNAL -au_size 4
SYS_PASSWORD_PROMPT

ASMSNMP_PASSWORD_PROMPT


[FATAL] [DBT-30002] Disk group DATA creation failed.
ORA-15018: diskgroup cannot be created
ORA-15107: missing or invalid ASM disk name



[grid@localhost ~]$ /u01/app/19.0.0/grid/bin/asmca -silent -oui_internal -configureASM -diskString '/dev/sd*' -diskGroupName DATA -diskList /dev/sdb -redundancy EXTERNAL -au_size 4
SYS_PASSWORD_PROMPT

ASMSNMP_PASSWORD_PROMPT


ASM has been created and started successfully.


[DBT-30001] Disk groups created successfully. Check /u01/app/19.0.0/grid_base/cfgtoollogs/asmca/asmca-190625AM092007.log for details.












Setting up iscsi sharing between RHEL7

by Jephe Wu

=== On target side

1. Add a volume on AWS EC2 console and assign volume to the EC2 VM

confirmed new volume in /proc/partitions

fdisk /dev/xvdf

to create one partition with linux type

2.  yum install targetcli
systemctl enable target
systemctl start target

3. setup target lun

[root@ip-172-31-4-10 ec2-user]# targetcli
targetcli shell version 2.1.fb49
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/> iscsi/
/iscsi> create
Created target iqn.2003-01.org.linux-iscsi.ip-172-31-4-10.x8664:sn.82d2391e0b7c.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi> ls
o- iscsi .............................................................................................................. [Targets: 1]
  o- iqn.2003-01.org.linux-iscsi.ip-172-31-4-10.x8664:sn.82d2391e0b7c .................................................... [TPGs: 1]
    o- tpg1 ................................................................................................. [no-gen-acls, no-auth]
      o- acls ............................................................................................................ [ACLs: 0]
      o- luns ............................................................................................................ [LUNs: 0]
      o- portals ...................................................................................................... [Portals: 1]
        o- 0.0.0.0:3260 ....................................................................................................... [OK]
/iscsi> iqn.2003-01.org.linux-iscsi.ip-172-31-4-10.x8664:sn.82d2391e0b7c/tpg1


/iscsi/iqn.20...391e0b7c/tpg1> /
/> /backstores/block create name=block_backend dev=/dev/xvdf
Created block storage object block_backend using /dev/xvdf.
/> iscsi/
/iscsi> iqn.2003-01.org.linux-iscsi.ip-172-31-4-10.x8664:sn.82d2391e0b7c/tpg1
/iscsi/iqn.20...391e0b7c/tpg1> luns/ create /backstores/block/block_backend
Created LUN 0.
/iscsi/iqn.20...391e0b7c/tpg1> ls
o- tpg1 ..................................................................................................... [no-gen-acls, no-auth]
  o- acls ................................................................................................................ [ACLs: 0]
  o- luns ................................................................................................................ [LUNs: 1]
  | o- lun0 ................................................................... [block/block_backend (/dev/xvdf) (default_tg_pt_gp)]
  o- portals .......................................................................................................... [Portals: 1]
    o- 0.0.0.0:3260 ........................................................................................................... [OK]
/iscsi/iqn.20...391e0b7c/tpg1> /

/iscsi> iqn.2003-01.org.linux-iscsi.ip-172-31-4-10.x8664:sn.82d2391e0b7c/tpg1

/iscsi/iqn.20...391e0b7c/tpg1> acls/
/iscsi/iqn.20...b7c/tpg1/acls> create iqn.1994-05.com.redhat:413be97b32f2
Created Node ACL for iqn.1994-05.com.redhat:413be97b32f2
Created mapped LUN 0.

/iscsi/iqn.20...391e0b7c/tpg1> ls
o- tpg1 ..................................................................................................... [no-gen-acls, no-auth]
  o- acls ................................................................................................................ [ACLs: 1]
  | o- iqn.1994-05.com.redhat:413be97b32f2 ........................................................................ [Mapped LUNs: 1]
  |   o- mapped_lun0 ............................................................................... [lun0 block/block_backend (rw)]
  o- luns ................................................................................................................ [LUNs: 1]
  | o- lun0 ................................................................... [block/block_backend (/dev/xvdf) (default_tg_pt_gp)]
  o- portals .......................................................................................................... [Portals: 1]
    o- 0.0.0.0:3260 ........................................................................................................... [OK]


====on client side

[root@ip-172-31-8-24 ec2-user]#  yum install iscsi-initiator-utils


[root@ip-172-31-0-31 iscsi]# iscsiadm -m discovery -t st -p 172.31.4.10 
172.31.4.10:3260,1 iqn.2003-01.org.linux-iscsi.ip-172-31-4-10.x8664:sn.82d2391e0b7c

[root@ip-172-31-0-31 iscsi]# iscsiadm -m node -T iqn.2003-01.org.linux-iscsi.ip-172-31-4-10.x8664:sn.82d2391e0b7c -l
Logging in to [iface: default, target: iqn.2003-01.org.linux-iscsi.ip-172-31-4-10.x8664:sn.82d2391e0b7c, portal: 172.31.4.10,3260] (multiple)
Login to [iface: default, target: iqn.2003-01.org.linux-iscsi.ip-172-31-4-10.x8664:sn.82d2391e0b7c, portal: 172.31.4.10,3260] successful.

[root@ip-172-31-0-31 iscsi]# dmesg | grep sda
[348576.211493] sd 4:0:0:0: [sda] 20971520 512-byte logical blocks: (10.7 GB/10.0 GiB)
[348576.221556] sd 4:0:0:0: [sda] Write Protect is off
[348576.226764] sd 4:0:0:0: [sda] Mode Sense: 43 00 00 08
[348576.227815] sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[348576.256350]  sda: sda1
[348576.263152] sd 4:0:0:0: [sda] Attached SCSI disk

there's no need to enable any client service, as kernel will detect iscsi drive automatically below

----
[   12.312069] Loading iSCSI transport class v2.0-870.
[   12.354416] iscsi: registered transport (tcp)
[   12.382519] scsi host2: iSCSI Initiator over TCP/IP
[   12.398666] scsi 2:0:0:0: Direct-Access     LIO-ORG  block_backend    4.0  PQ: 0 ANSI: 5
[   12.417146] scsi 2:0:0:0: alua: supports implicit and explicit TPGS
[   12.422931] scsi 2:0:0:0: alua: device naa.600140563a0ac28e2414b52a3c5f8f89 port group 0 rel port 1
[   12.431126] scsi 2:0:0:0: alua: Attached
[   12.438279] scsi 2:0:0:0: alua: transition timeout set to 60 seconds
[   12.445803] scsi 2:0:0:0: alua: port group 00 state A non-preferred supports TOlUSNA
[   12.458154] scsi 2:0:0:0: Attached scsi generic sg0 type 0
[   12.506779] sd 2:0:0:0: [sda] 20971520 512-byte logical blocks: (10.7 GB/10.0 GiB)
[   12.543041] sd 2:0:0:0: [sda] Write Protect is off
[   12.547556] sd 2:0:0:0: [sda] Mode Sense: 43 00 00 08
[   12.564423] sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[   12.597412]  sda: sda1
[   12.609015] sd 2:0:0:0: [sda] Attached SCSI disk
----

References


iscsiadm -m session [-P1 | -P3]
login all Luns exported on the target: iscsiadm -m discovery -t st -l
node and discovery database directory: /var/lib/iscsi
disconnect: iscsiadm -m node -T target_iqn_name -p ipaddress -u
remove target from database so it won't connect upon reboot: iscsiadm -m node -T target_iqn_name -p ipaddress --op delete
delete all bindings for iface0: iscsiadm -m node -I iface0 --op=delete
logout all target: iscsiadm -m node -U all
login all node: iscsiadm -m node -L all
rescan lun: iscsiadm -m node -p 192.168.40.10 --rescan
check /var/lib/iscsi interface directory:



How to install minimal X Windows packages on RHEL7/RHEL8 for Oracle installation with vncviewer

by Jephe Wu

Summary

In RHEL7, since Redhat removed twm window manager, if Oracle DBA needs to install Oracle database on RHEL7 remotely, and doesn't want to use ssh -X  to forward X11 which is slow on network,  there's a way to make it so.

Steps


1. download twm window manager from RHEL6

wget http://mirror.centos.org/centos/6/os/x86_64/Packages/xorg-x11-twm-1.0.3-5.1.el6.x86_64.rpm

2. install tigervnc-server
yum install tigervnc-server xterm

rpm -ivh xorg-x11-twm-1.0.3-5.1.el6.x86_64.rpm

3. run vncserver :1 on RHEL7

4. use vncviewer to connect to RHEL7 ip address at 5901 port

Reference

http://houseofbrick.com/twm-window-manager-on-rhel-7/ 
https://docs.oracle.com/cd/E52668_01/E54669/html/ol7-vnc-config.html