101 Series of Oracle in Google Cloud – Part I : Building ASM and Database

101 Series of Oracle in Google Cloud – Part I : Building ASM and Database

About a year ago I worked on a project with some awesome teammates (Simon Pane and Karun Dutt) to work on a POC to move their Oracle environment into Google Cloud. These are some of the things I learned and this series will guide whoever is wanting to test out Oracle in Google Cloud. 

I do want to make a note before I begin. I am no licensing expert, so before you do this, make sure to talk to your Google/Oracle Sales rep on what is allowed and costs involved.

So as this is a 101 series, I will start with our logging in to google cloud. By now you should already have create your account in cloud.google.com and have installed google cloud SDK , as in my case I’m using a Mac, I downloaded it from this location. Once I did this, I logged in to my google cloud account.

Renes-MacBook-Pro-2:~ rene$ gcloud auth login **********@*****.com

Also as I am using Google free tier, so there are limitations on the disk sizes, instance type, quotas , etc that I can use, hence the type of instance and disk sizes that I am using.

These are the specifications I used 

  • Google Cloud Instance name : rene-ace-test-inst1
  • n1-standard-8 VM which has 8 vCPU  and 30 GB Memory 
  • Centos 7
  • 1 150g SSD Disk for ASM , Diskgroup DATA
  • 1 100g HD Disk for boot disk
  • Default Subnet Network
  • No Quotas
  • Oracle 19.3 for OHAS and RDBMS
  • Oracle DB instance name : DBTEST

So the first thing that I will do is create the disk that I will use for ASM. In this case I used a 150g SSD disk.

Renes-MacBook-Pro-2:~ rene$ gcloud compute disks create rene-ace-disk-asm1 \
>    --project=oracle-migration \
>    --type=pd-ssd \
>    --size=150GB \
>    --labels=item=rene-ace \
>    --zone=us-central1-c
Created [https://www.googleapis.com/compute/v1/projects/oracle-migration/zones/us-central1-c/disks/rene-ace-disk-asm1].
NAME                ZONE           SIZE_GB  TYPE    STATUS
rene-ace-disk-asm1  us-central1-c  150      pd-ssd  READY

Now I will create HD Disk of 100g size for our boot disk with Centos 7

Renes-MacBook-Pro-2:~ rene$ gcloud compute disks create rene-ace-inst1-boot-disk \
 --project=oracle-migration \
 --type=pd-standard \
 --size=100GB \
 --zone=us-central1-c \
 --image=centos-7-v20200309 \
 --image-project=centos-cloud 
WARNING: You have selected a disk size of under [200GB]. This may result in poor I/O performance. For more information, see: https://developers.google.com/compute/docs/disks#performance.
Created [https://www.googleapis.com/compute/v1/projects/oracle-migration/zones/us-central1-c/disks/rene-ace-inst1-boot-disk].
WARNING: Some requests generated warnings:
 - Disk size: '100 GB' is larger than image size: '10 GB'. You might need to resize the root repartition manually if the operating system does not support automatic resizing. See https://cloud.google.com/compute/docs/disks/add-persistent-disk#resize_pd for details.

NAME                      ZONE           SIZE_GB  TYPE         STATUS
rene-ace-inst1-boot-disk  us-central1-c  100      pd-standard  READY

Once I created our ASM disk, I will create our VM with the boot disk that I created above

Renes-MacBook-Pro-2:~ rene$ gcloud compute instances create rene-ace-test-inst1 \
    --project=oracle-migration \
    --zone=us-central1-c \
    --machine-type=n1-standard-8 \
    --subnet=default \
    --network-tier=PREMIUM \
    --no-restart-on-failure \
    --maintenance-policy=TERMINATE \
    --no-service-account \
    --no-scopes \
    --disk=name=rene-ace-inst1-boot-disk,device-name=rene-ace-inst1-boot-disk,mode=rw,boot=yes,auto-delete=yes \
    --tags=allow-ssh,egress-nat-gce \
    --labels=item=rene-ace
Created [https://www.googleapis.com/compute/v1/projects/oracle-migration/zones/us-central1-c/instances/rene-ace-test-inst1].
NAME                 ZONE           MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP   STATUS
rene-ace-test-inst1  us-central1-c  n1-standard-8               10.***.***.***   34.***.***.***  RUNNING

Once I have did this, I will now attach the disk that I will use for ASM

Renes-MacBook-Pro-2:~ rene$ gcloud compute instances attach-disk rene-ace-test-inst1 \
    --disk=rene-ace-disk-asm1 \
    --device-name=rene-ace-disk-asm1 \
    --mode=rw \
    --zone=us-central1-c
Updated [https://www.googleapis.com/compute/v1/projects/oracle-migration/zones/us-central1-c/instances/rene-ace-test-inst1].
Renes-MacBook-Pro-2:~ rene$ gcloud compute ssh rene-ace-test-inst1 --zone=us-central1-c
Updating project ssh metadata...⠏Updated [https://www.googleapis.com/compute/v1/projects/oracle-migration].                                                                            
Updating project ssh metadata...done.                                                                                                                                                  
Waiting for SSH key to propagate.
Warning: Permanently added 'compute.5519028484974783249' (ECDSA) to the list of known hosts.
/etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
[rene@rene-ace-test-inst1 ~]$ 

All of the steps until I mention it again, will be as root user.

I will now proceed to install the 19c preinstall RPM 

[rene@rene-ace-test-inst1 ~]$ sudo su -
[root@rene-ace-test-inst1 ~]# curl -o ./oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm \    
https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 18204  100 18204    0     0  55201      0 --:--:-- --:--:-- --:--:-- 55331
[root@rene-ace-test-inst1 ~]# yum -y localinstall ./oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
Loaded plugins: fastestmirror
Examining ./oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm: oracle-database-preinstall-19c-1.0-1.el7.x86_64
Marking ./oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-19c.x86_64 0:1.0-1.el7 will be installed
--> Processing Dependency: bc for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
Determining fastest mirrors
epel/x86_64/metalink                                                                                                                                             |  18 kB  00:00:00     
 * base: us.mirror.nsec.pt
 * epel: mirror.steadfastnet.com
 * extras: mirrors.gigenet.com
 * updates: bay.uchicago.edu
base                                                                                                                                                             | 3.6 kB  00:00:00     
epel                                                                                                                                                             | 4.7 kB  00:00:00     
extras                                                                                                                                                           | 2.9 kB  00:00:00     
google-cloud-sdk/signature                                                                                                                                       |  454 B  00:00:00     
google-cloud-sdk/signature                                                                                                                                       | 1.4 kB  00:00:00 !!! 
google-compute-engine/signature                                                                                                                                  |  454 B  00:00:00     
google-compute-engine/signature                                                                                                                                  | 1.4 kB  00:00:00 !!! 
updates                                                                                                                                                          | 2.9 kB  00:00:00     
(1/9): epel/x86_64/group_gz                                                                                                                                      |  95 kB  00:00:00     
(2/9): epel/x86_64/updateinfo                                                                                                                                    | 1.0 MB  00:00:00     
(3/9): base/7/x86_64/group_gz                                                                                                                                    | 165 kB  00:00:00     
(4/9): extras/7/x86_64/primary_db                                                                                                                                | 164 kB  00:00:00     
(5/9): epel/x86_64/primary_db                                                                                                                                    | 6.7 MB  00:00:00     
(6/9): base/7/x86_64/primary_db                                                                                                                                  | 6.0 MB  00:00:00     
(7/9): google-cloud-sdk/primary                                                                                                                                  | 168 kB  00:00:00     
(8/9): google-compute-engine/primary                                                                                                                             | 3.9 kB  00:00:00     
(9/9): updates/7/x86_64/primary_db                                                                                                                               | 7.6 MB  00:00:00     
google-cloud-sdk                                                                                                                                                              1224/1224
google-compute-engine                                                                                                                                                             11/11
--> Processing Dependency: bind-utils for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: compat-libcap1 for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: compat-libstdc++-33 for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: glibc-devel for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: ksh for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: libaio for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: libaio-devel for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: libstdc++-devel for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: nfs-utils for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: psmisc for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: smartmontools for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: sysstat for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: unzip for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: xorg-x11-utils for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: xorg-x11-xauth for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Running transaction check
---> Package bc.x86_64 0:1.06.95-13.el7 will be installed
---> Package bind-utils.x86_64 32:9.11.4-9.P2.el7 will be installed
--> Processing Dependency: bind-libs-lite(x86-64) = 32:9.11.4-9.P2.el7 for package: 32:bind-utils-9.11.4-9.P2.el7.x86_64
--> Processing Dependency: bind-libs(x86-64) = 32:9.11.4-9.P2.el7 for package: 32:bind-utils-9.11.4-9.P2.el7.x86_64
--> Processing Dependency: liblwres.so.160()(64bit) for package: 32:bind-utils-9.11.4-9.P2.el7.x86_64
--> Processing Dependency: libisccfg.so.160()(64bit) for package: 32:bind-utils-9.11.4-9.P2.el7.x86_64
--> Processing Dependency: libisc.so.169()(64bit) for package: 32:bind-utils-9.11.4-9.P2.el7.x86_64
--> Processing Dependency: libirs.so.160()(64bit) for package: 32:bind-utils-9.11.4-9.P2.el7.x86_64
--> Processing Dependency: libdns.so.1102()(64bit) for package: 32:bind-utils-9.11.4-9.P2.el7.x86_64
...
Installed:
  oracle-database-preinstall-19c.x86_64 0:1.0-1.el7                                                                                                                                     

Dependency Installed:
  GeoIP.x86_64 0:1.5.0-14.el7                  bc.x86_64 0:1.06.95-13.el7           bind-libs.x86_64 32:9.11.4-9.P2.el7                     bind-libs-lite.x86_64 32:9.11.4-9.P2.el7 
  bind-license.noarch 32:9.11.4-9.P2.el7       bind-utils.x86_64 32:9.11.4-9.P2.el7 compat-libcap1.x86_64 0:1.10-7.el7                      compat-libstdc++-33.x86_64 0:3.2.3-72.el7
  geoipupdate.x86_64 0:2.5.0-1.el7             glibc-devel.x86_64 0:2.17-292.el7    glibc-headers.x86_64 0:2.17-292.el7                     gssproxy.x86_64 0:0.7.0-26.el7           
  kernel-headers.x86_64 0:3.10.0-1062.18.1.el7 keyutils.x86_64 0:1.5.8-3.el7        ksh.x86_64 0:20120801-140.el7_7                         libICE.x86_64 0:1.0.9-9.el7              
  libSM.x86_64 0:1.2.2-2.el7                   libX11.x86_64 0:1.6.7-2.el7          libX11-common.noarch 0:1.6.7-2.el7                      libXau.x86_64 0:1.0.8-2.1.el7            
  libXext.x86_64 0:1.3.3-3.el7                 libXi.x86_64 0:1.7.9-1.el7           libXinerama.x86_64 0:1.1.3-2.1.el7                      libXmu.x86_64 0:1.1.2-2.el7              
  libXrandr.x86_64 0:1.5.1-2.el7               libXrender.x86_64 0:0.9.10-1.el7     libXt.x86_64 0:1.1.5-3.el7                              libXtst.x86_64 0:1.2.3-1.el7             
  libXv.x86_64 0:1.0.11-1.el7                  libXxf86dga.x86_64 0:1.1.4-2.1.el7   libXxf86misc.x86_64 0:1.0.3-7.1.el7                     libXxf86vm.x86_64 0:1.1.4-1.el7          
  libaio.x86_64 0:0.3.109-13.el7               libaio-devel.x86_64 0:0.3.109-13.el7 libbasicobjects.x86_64 0:0.1.1-32.el7                   libcollection.x86_64 0:0.7.0-32.el7      
  libdmx.x86_64 0:1.1.3-3.el7                  libevent.x86_64 0:2.0.21-4.el7       libini_config.x86_64 0:1.3.1-32.el7                     libnfsidmap.x86_64 0:0.25-19.el7         
  libpath_utils.x86_64 0:0.2.1-32.el7          libref_array.x86_64 0:0.1.5-32.el7   libstdc++-devel.x86_64 0:4.8.5-39.el7                   libtirpc.x86_64 0:0.2.4-0.16.el7         
  libverto-libevent.x86_64 0:0.2.5-4.el7       libxcb.x86_64 0:1.13-1.el7           lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7 mailx.x86_64 0:12.5-19.el7               
  nfs-utils.x86_64 1:1.3.0-0.65.el7            psmisc.x86_64 0:22.20-16.el7         quota.x86_64 1:4.01-19.el7                              quota-nls.noarch 1:4.01-19.el7           
  rpcbind.x86_64 0:0.2.0-48.el7                smartmontools.x86_64 1:7.0-1.el7_7.1 sysstat.x86_64 0:10.1.5-18.el7_7.1                      tcp_wrappers.x86_64 0:7.6-77.el7         
  unzip.x86_64 0:6.0-20.el7                    xorg-x11-utils.x86_64 0:7.5-23.el7   xorg-x11-xauth.x86_64 1:1.0.9-1.el7                    

Complete!

Also there are some additional packages that need to be installed as well I will do an update of what we have installed

[root@rene-ace-test-inst1 ~]# yum -y install wget java-11-openjdk gcc gcc-c++
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: us.mirror.nsec.pt
...
Installed:
  gcc.x86_64 0:4.8.5-39.el7              gcc-c++.x86_64 0:4.8.5-39.el7              java-11-openjdk.x86_64 1:11.0.6.10-1.el7_7              wget.x86_64 0:1.14-18.el7_6.1             

Dependency Installed:
  avahi-libs.x86_64 0:0.6.31-19.el7        copy-jdk-configs.noarch 0:3.3-10.el7_5               cpp.x86_64 0:4.8.5-39.el7                  cups-libs.x86_64 1:1.6.3-40.el7             
  dejavu-fonts-common.noarch 0:2.33-6.el7  dejavu-sans-fonts.noarch 0:2.33-6.el7                fontconfig.x86_64 0:2.13.0-4.3.el7         fontpackages-filesystem.noarch 0:1.44-8.el7 
  giflib.x86_64 0:4.1.6-9.el7              java-11-openjdk-headless.x86_64 1:11.0.6.10-1.el7_7  javapackages-tools.noarch 0:3.4.1-11.el7   libfontenc.x86_64 0:1.1.3-3.el7             
  libjpeg-turbo.x86_64 0:1.2.90-8.el7      libmpc.x86_64 0:1.0.1-3.el7                          libxslt.x86_64 0:1.1.28-5.el7              lksctp-tools.x86_64 0:1.0.17-2.el7          
  mpfr.x86_64 0:3.1.1-4.el7                pcsc-lite-libs.x86_64 0:1.8.8-8.el7                  python-javapackages.noarch 0:3.4.1-11.el7  python-lxml.x86_64 0:3.2.1-4.el7            
  ttmkfdir.x86_64 0:3.0.9-42.el7           tzdata-java.noarch 0:2019c-1.el7                     xorg-x11-font-utils.x86_64 1:7.5-21.el7    xorg-x11-fonts-Type1.noarch 0:7.5-9.el7     

Complete!
[root@rene-ace-test-inst1 ~]# yum -y update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: us.mirror.nsec.pt
 * epel: mirror.steadfastnet.com
 * extras: mirrors.gigenet.com
 * updates: bay.uchicago.edu
Resolving Dependencies
...
Installed:
  kernel.x86_64 0:3.10.0-1062.18.1.el7                                                                                                                                                  

Updated:
  binutils.x86_64 0:2.27-41.base.el7_7.3      firewalld.noarch 0:0.6.3-2.el7_7.4               firewalld-filesystem.noarch 0:0.6.3-2.el7_7.4  google-cloud-sdk.noarch 0:286.0.0-1    
  kernel-tools.x86_64 0:3.10.0-1062.18.1.el7  kernel-tools-libs.x86_64 0:3.10.0-1062.18.1.el7  kmod.x86_64 0:20-25.el7_7.1                    kmod-libs.x86_64 0:20-25.el7_7.1       
  libicu.x86_64 0:50.2-4.el7_7                python-firewall.noarch 0:0.6.3-2.el7_7.4         python-perf.x86_64 0:3.10.0-1062.18.1.el7      python-requests.noarch 0:2.6.0-9.el7_7 
  rsyslog.x86_64 0:8.24.0-41.el7_7.4          systemd.x86_64 0:219-67.el7_7.4                  systemd-libs.x86_64 0:219-67.el7_7.4           systemd-sysv.x86_64 0:219-67.el7_7.4   

Complete!

[root@rene-ace-test-inst1 ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base epel extras google-cloud-sdk google-compute-engine updates
Cleaning up list of fastest mirrors

We have to ensure that there is at least 16GB of swap space

[root@rene-ace-test-inst1 ~]# dd if=/dev/zero of=/swapfile bs=1M count=16384
16384+0 records in
16384+0 records out
17179869184 bytes (17 GB) copied, 80.5556 s, 213 MB/s
[root@rene-ace-test-inst1 ~]# mkswap /swapfile
Setting up swapspace version 1, size = 16777212 KiB
no label, UUID=50136cfb-9ab7-4d5a-8ed7-726da89a7ede
[root@rene-ace-test-inst1 ~]# chmod 0600 /swapfile
[root@rene-ace-test-inst1 ~]# swapon /swapfile
[root@rene-ace-test-inst1 ~]# echo "/swapfile          swap            swap    defaults        0 0" >> /etc/fstab
[root@rene-ace-test-inst1 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@rene-ace-test-inst1 ~]# echo "transparent_hugepage=never" >> /etc/default/grub
[root@rene-ace-test-inst1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1062.18.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.18.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1062.12.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.12.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1062.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-2a464dc72a01028f0cd989f1d687b484
Found initrd image: /boot/initramfs-0-rescue-2a464dc72a01028f0cd989f1d687b484.img
done

We will now disable the firewall and change SELINUX to permissive

[root@rene-ace-test-inst1 ~]# systemctl stop firewalld
[root@rene-ace-test-inst1 ~]# systemctl disable firewalld
[root@rene-ace-test-inst1 ~]# sed -i.bak '/^SELINUX=/ s/SELINUX=.*/SELINUX=permissive/' /etc/selinux/config^C
[root@rene-ace-test-inst1 ~]# cat /etc/selinux/config | grep SELINUX
# SELINUX= can take one of these three values:
SELINUX=permissive
# SELINUXTYPE= can take one of three values:
SELINUXTYPE=targeted 

Our next step is to enable huge pages by changing the value in /etc/sysctl.conf and restarting the VM

[root@rene-ace-test-inst1 ~]# echo "vm.nr_hugepages=4096" >> /etc/sysctl.conf
[root@rene-ace-test-inst1 ~]# shutdown -r now
Connection to 34.66.112.87 closed by remote host.
Connection to 34.66.112.87 closed.
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
Renes-MacBook-Pro-2:~ rene$ gcloud compute ssh rene-ace-test-inst1 --zone=us-central1-c
Last login: Tue Mar 31 01:31:10 2020 from 189.216.207.2
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
[rene@rene-ace-test-inst1 ~]$ sudo su -
Last login: Tue Mar 31 01:31:21 UTC 2020 on pts/0
[root@rene-ace-test-inst1 ~]# grep Huge /proc/meminfo
AnonHugePages:         0 kB
HugePages_Total:    4096
HugePages_Free:     4096
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

We will now create the directories for our binaries,create the additional OS groups and update the bash profile

[root@rene-ace-test-inst1 ~]# mkdir -p /u01/app/19.0.0.0/grid
[root@rene-ace-test-inst1 ~]# mkdir -p /u01/app/oracle/product/19.0.0.0/dbhome_1
[root@rene-ace-test-inst1 ~]# mkdir -p /u01/app/oraInventory
[root@rene-ace-test-inst1 ~]# mkdir -p /u01/app/oracle/fast_recovery_area
[root@rene-ace-test-inst1 ~]# mkdir -p /u01/app/oracle_software
[root@rene-ace-test-inst1 ~]# mkdir -p /home/oracle/working
[root@rene-ace-test-inst1 ~]# chown -R oracle:oinstall /u01
[root@rene-ace-test-inst1 ~]# chown -R oracle:oinstall /home/oracle/working
[root@rene-ace-test-inst1 ~]# chmod -R 775 /u01

[root@rene-ace-test-inst1 ~]# 
[root@rene-ace-test-inst1 ~]# 
[root@rene-ace-test-inst1 ~]# cat <<EOT >> /home/oracle/.bash_profile
     
#  Oracle RDBMS Settings:
export ORACLE_SID=ORCL
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\${ORACLE_BASE}/product/19.0.0.0/dbhome_1
export GRID_HOME=/u01/app/19.0.0.0/grid
export PATH=\${ORACLE_HOME}/bin:\${PATH}
export SWLIB=/u01/app/oracle_software
EOT
[root@rene-ace-test-inst1 ~]# groupadd -g 54327 asmdba
[root@rene-ace-test-inst1 ~]# groupadd -g 54328 asmoper
[root@rene-ace-test-inst1 ~]# groupadd -g 54329 asmadmin
[root@rene-ace-test-inst1 ~]# usermod -u 54321 -g oinstall -G dba,asmadmin,asmdba,asmoper oracle
[root@rene-ace-test-inst1 ~]# 
[root@rene-ace-test-inst1 ~]# echo "umask 022" >> /home/oracle/.bashrc

I will now login as oracle use and will download the latest OPatch using Maris Elsins getMOSpatch

[rene@rene-ace-test-inst1 ~]$ sudo su - oracle
Last login: Tue Mar 31 01:09:04 UTC 2020 on pts/0
[oracle@rene-ace-test-inst1 ~]$ cd ${SWLIB}
[oracle@rene-ace-test-inst1 oracle_software]$ wget https://github.com/MarisElsins/getMOSPatch/raw/master/getMOSPatch.jar

...
(raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8932 (8.7K) [application/octet-stream]
Saving to: ‘getMOSPatch.jar’

100%[==============================================================================================================================================>] 8,932       --.-K/s   in 0s      

2020-03-31 01:46:46 (80.6 MB/s) - ‘getMOSPatch.jar’ saved [8932/8932]

[oracle@rene-ace-test-inst1 oracle_software]$ java -jar getMOSPatch.jar patch=6880880 platform=226P regexp=.*190.* download=all
Enter your MOS username: ********@*********.com
Enter your MOS password: 
|
Enter Comma separated platforms to list: 226P

We're going to download patches for the following Platforms/Languages:
 226P - Linux x86-64

Processing patch 6880880 for Linux x86-64 and applying regexp .*190.* to the filenames:
 1 - p6880880_190000_Linux-x86-64.zip
 Enter Comma separated files to download: all
 All files will be downloadad because download=all was specified.

Downloading all selected files:
 Downloading p6880880_190000_Linux-x86-64.zip: 110MB at average speed of 16744KB/s - DONE!  

Now download Oracle base software using wget from edelivery.oracle.com. You will need to download files V982063-01.zip  (ORACLE RDBMS) and V982068-01.zip (ORACLE GI). You should have the following files :

[oracle@rene-ace-test-inst1 oracle_software]$ ls -ltr
total 5931508
-rw-r--r--. 1 oracle oinstall 3059705302 Apr 23  2019 V982063-01.zip
-rw-r--r--. 1 oracle oinstall 2889184573 Apr 23  2019 V982068-01.zip
-rw-r--r--. 1 oracle oinstall  115653541 Mar 31 01:49 p6880880_190000_Linux-x86-64.zip

We will now unzip the files to the corresponding location and updating the OPatch

[oracle@rene-ace-test-inst1 oracle_software]$ unzip -q ${SWLIB}/V982063-01.zip -d ${ORACLE_HOME}
[oracle@rene-ace-test-inst1 oracle_software]$ unzip -q ${SWLIB}/V982068-01.zip -d ${GRID_HOME}
[oracle@rene-ace-test-inst1 oracle_software]$ rm -rf ${ORACLE_HOME}/OPatch
[oracle@rene-ace-test-inst1 oracle_software]$ rm -rf ${GRID_HOME}/OPatch
[oracle@rene-ace-test-inst1 oracle_software]$ unzip -q ${SWLIB}/p6880880_190000_Linux-x86-64.zip -d ${ORACLE_HOME}
[oracle@rene-ace-test-inst1 oracle_software]$ unzip -q ${SWLIB}/p6880880_190000_Linux-x86-64.zip -d ${GRID_HOME}

As root user ,I will install the cvuqdisk

[rene@rene-ace-test-inst1 ~]$ sudo su -
Last login: Tue Mar 31 01:35:45 UTC 2020 on pts/0
[root@rene-ace-test-inst1 ~]# cd /u01/app/19.0.0.0/grid/cv/rpm
[root@rene-ace-test-inst1 rpm]# rpm -qi cvuqdisk
package cvuqdisk is not installed
[root@rene-ace-test-inst1 rpm]# CVUQDISK_GRP=oinstall; export CVUQDISK_GRP
[root@rene-ace-test-inst1 rpm]# rpm -iv cvuqdisk-*.rpm
Preparing packages...
cvuqdisk-1.0.10-1.x86_64

Back as oracle user, I will run the cluvfy pre crsinst to see if there is nothing missing for us to be able to install OHAS and ASM , as this will be not be a RAC environment, we are only using ASM.

[oracle@rene-ace-test-inst1 ~]$ cd ${GRID_HOME}
[oracle@rene-ace-test-inst1 grid]$ ./runcluvfy.sh stage -pre crsinst -n `hostname -s`

ERROR: 
PRVG-10467 : The default Oracle Inventory group could not be determined.

Verifying Physical Memory ...PASSED
Verifying Available Physical Memory ...PASSED
Verifying Swap Size ...PASSED
Verifying Free Space: rene-ace-test-inst1:/usr,rene-ace-test-inst1:/var,rene-ace-test-inst1:/etc,rene-ace-test-inst1:/sbin,rene-ace-test-inst1:/tmp ...PASSED
Verifying User Existence: oracle ...
  Verifying Users With Same UID: 54321 ...PASSED
Verifying User Existence: oracle ...PASSED
...
CVU operation performed:      stage -pre crsinst
Date:                         Apr 4, 2020 2:09:38 PM
CVU home:                     /u01/app/19.0.0.0/grid/
User:                         oracle

Now I will modify the response file so I can do the GI Software as a CRS_SWONLY installation

[oracle@rene-ace-test-inst1 grid]$ cp ${GRID_HOME}/inventory/response/grid_install.rsp ${SWLIB}/grid_install.rsp
[oracle@rene-ace-test-inst1 grid]$   
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.option/ s~oracle.install.option=$~oracle.install.option=CRS_SWONLY~' ${SWLIB}/grid_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^ORACLE_HOSTNAME/ s~ORACLE_HOSTNAME=$~ORACLE_HOSTNAME=`hostname -A`~' ${SWLIB}/grid_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^INVENTORY_LOCATION/ s~INVENTORY_LOCATION=$~INVENTORY_LOCATION=/u01/app/oraInventory~' ${SWLIB}/grid_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^ORACLE_BASE/ s~ORACLE_BASE=$~ORACLE_BASE='${ORACLE_BASE}'~' ${SWLIB}/grid_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.asm.OSDBA/ s~oracle.install.asm.OSDBA=$~oracle.install.asm.OSDBA=asmdba~' ${SWLIB}/grid_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.asm.OSOPER/ s~oracle.install.asm.OSOPER=$~oracle.install.asm.OSOPER=asmoper~' ${SWLIB}/grid_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.asm.OSASM/ s~oracle.install.asm.OSASM=$~oracle.install.asm.OSASM=asmadmin~' ${SWLIB}/grid_install.rsp
[oracle@rene-ace-test-inst1 grid]$   
[oracle@rene-ace-test-inst1 grid]$ diff ${GRID_HOME}/inventory/response/grid_install.rsp ${SWLIB}/grid_install.rsp
60c60
< INVENTORY_LOCATION=
---
> INVENTORY_LOCATION=/u01/app/oraInventory
75c75
< oracle.install.option=
---
> oracle.install.option=CRS_SWONLY
80c80
< ORACLE_BASE=
---
> ORACLE_BASE=/u01/app/oracle
98c98
< oracle.install.asm.OSDBA=
---
> oracle.install.asm.OSDBA=asmdba
105c105
< oracle.install.asm.OSOPER=
---
> oracle.install.asm.OSOPER=asmoper
111c111
< oracle.install.asm.OSASM=
---
> oracle.install.asm.OSASM=asmadmin

Now we will launch the software install

[oracle@rene-ace-test-inst1 grid]$ ${GRID_HOME}/gridSetup.sh -silent -responseFile ${SWLIB}/grid_install.rsp
Launching Oracle Grid Infrastructure Setup Wizard...

The response file for this session can be found at:
 /u01/app/19.0.0.0/grid/install/response/grid_2020-04-04_02-12-20PM.rsp

You can find the log of this install session at:
 /tmp/GridSetupActions2020-04-04_02-12-20PM/gridSetupActions2020-04-04_02-12-20PM.log

As a root user, execute the following script(s):
	1. /u01/app/oraInventory/orainstRoot.sh
	2. /u01/app/19.0.0.0/grid/root.sh

Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes: 
[rene-ace-test-inst1]
Execute /u01/app/19.0.0.0/grid/root.sh on the following nodes: 
[rene-ace-test-inst1]

Successfully Setup Software.
Moved the install session logs to:
 /u01/app/oraInventory/logs/GridSetupActions2020-04-04_02-12-20PM

Once the software installation is complete, we proceed to run the orainstRoot.sh and root.sh as root user.

We will also run roothas.pl to setup the HAS stack:

[rene@rene-ace-test-inst1 ~]$ sudo su -
Last login: Sat Apr  4 14:06:06 UTC 2020 on pts/0
[root@rene-ace-test-inst1 ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@rene-ace-test-inst1 ~]# /u01/app/19.0.0.0/grid/root.sh
Check /u01/app/19.0.0.0/grid/install/root_rene-ace-test-inst1_2020-04-04_14-15-37-955415144.log for the output of root script

[root@rene-ace-test-inst1 ~]# export GRID_HOME=/u01/app/19.0.0.0/grid
[root@rene-ace-test-inst1 ~]# ${GRID_HOME}/perl/bin/perl -I ${GRID_HOME}/perl/lib -I ${GRID_HOME}/crs/install ${GRID_HOME}/crs/install/roothas.pl
Using configuration parameter file: /u01/app/19.0.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/oracle/crsdata/rene-ace-test-inst1/crsconfig/roothas_2020-04-04_02-16-37PM.log
LOCAL ADD MODE 
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE 
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node rene-ace-test-inst1 successfully pinned.
2020/04/04 14:16:47 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'

rene-ace-test-inst1     2020/04/04 14:17:24     /u01/app/oracle/crsdata/rene-ace-test-inst1/olr/backup_20200404_141724.olr     724960844     
2020/04/04 14:17:24 CLSRSC-327: Successfully configured Oracle Restart for a standalone server
[root@rene-ace-test-inst1 ~]# sleep 10

[root@rene-ace-test-inst1 ~]# ${GRID_HOME}/bin/crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
               OFFLINE OFFLINE      rene-ace-test-inst1      STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        OFFLINE OFFLINE                               STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       rene-ace-test-inst1      STABLE
--------------------------------------------------------------------------------

Still as root user, we prepare the disks for ASM using UDEV rules:

[root@rene-ace-test-inst1 ~]# if [ ! -e /dev/sdb1 ]; then
   echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdb
fi
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xae81dcbe.

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

Command (m for help): Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): Partition number (1-4, default 1): First sector (2048-314572799, default 2048): Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-314572799, default 314572799): Using default value 314572799
Partition 1 of type Linux and of size 150 GiB is set

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rene-ace-test-inst1 ~]#  
[root@rene-ace-test-inst1 ~]# ASM_DISK1=`/usr/lib/udev/scsi_id -g -u -d /dev/sdb`
[root@rene-ace-test-inst1 ~]#  
[root@rene-ace-test-inst1 ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="0Google_PersistentDisk_persistent-disk-1", SYMLINK+="oracleasm/asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
[root@rene-ace-test-inst1 ~]# /sbin/partprobe /dev/sdb1
[root@rene-ace-test-inst1 ~]# sleep 10

[root@rene-ace-test-inst1 ~]# /sbin/udevadm control --reload-rules
[root@rene-ace-test-inst1 ~]# sleep 10
[root@rene-ace-test-inst1 ~]# /sbin/partprobe /dev/sdb1
[root@rene-ace-test-inst1 ~]# sleep 10
[root@rene-ace-test-inst1 ~]# /sbin/udevadm control --reload-rules
[root@rene-ace-test-inst1 ~]# sleep 10
[root@rene-ace-test-inst1 ~]# ls -al /dev/oracleasm/*
lrwxrwxrwx. 1 root root 7 Apr  4 14:20 /dev/oracleasm/asm-disk1 -> ../sdb1

Back as oracle user, we prepare the RDBMS install software response file

[oracle@rene-ace-test-inst1 grid]$ cp ${ORACLE_HOME}/install/response/db_install.rsp ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$   
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.option/ s~oracle.install.option=$~oracle.install.option=INSTALL_DB_SWONLY~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.InstallEdition/ s~oracle.install.db.InstallEdition=$~oracle.install.db.InstallEdition=EE~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^ORACLE_HOSTNAME/ s~ORACLE_HOSTNAME=$~ORACLE_HOSTNAME=`hostname -A`~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^UNIX_GROUP_NAME/ s~UNIX_GROUP_NAME=$~UNIX_GROUP_NAME=oinstall~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^INVENTORY_LOCATION/ s~INVENTORY_LOCATION=$~INVENTORY_LOCATION=/u01/app/oraInventory~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^ORACLE_HOME/ s~ORACLE_HOME=$~ORACLE_HOME='${ORACLE_HOME}'~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^ORACLE_BASE/ s~ORACLE_BASE=$~ORACLE_BASE='${ORACLE_BASE}'~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.DBA_GROUP/ s~oracle.install.db.DBA_GROUP=$~oracle.install.db.DBA_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.OPER_GROUP/ s~oracle.install.db.OPER_GROUP=$~oracle.install.db.OPER_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.BACKUPDBA_GROUP/ s~oracle.install.db.BACKUPDBA_GROUP=$~oracle.install.db.BACKUPDBA_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.DGDBA_GROUP/ s~oracle.install.db.DGDBA_GROUP=$~oracle.install.db.DGDBA_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.KMDBA_GROUP/ s~oracle.install.db.KMDBA_GROUP=$~oracle.install.db.KMDBA_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.OSDBA_GROUP/ s~oracle.install.db.OSDBA_GROUP=$~oracle.install.db.OSDBA_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.OSOPER_GROUP/ s~oracle.install.db.OSOPER_GROUP=$~oracle.install.db.OSOPER_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.OSBACKUPDBA_GROUP/ s~oracle.install.db.OSBACKUPDBA_GROUP=$~oracle.install.db.OSBACKUPDBA_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.OSDGDBA_GROUP/ s~oracle.install.db.OSDGDBA_GROUP=$~oracle.install.db.OSDGDBA_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.OSKMDBA_GROUP/ s~oracle.install.db.OSKMDBA_GROUP=$~oracle.install.db.OSKMDBA_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^oracle.install.db.OSRACDBA_GROUP/ s~oracle.install.db.OSRACDBA_GROUP=$~oracle.install.db.OSRACDBA_GROUP=dba~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^SECURITY_UPDATES_VIA_MYORACLESUPPORT/ s~SECURITY_UPDATES_VIA_MYORACLESUPPORT$=~SECURITY_UPDATES_VIA_MYORACLESUPPORT=FALSE~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$ sed -i '/^DECLINE_SECURITY_UPDATES/ s~DECLINE_SECURITY_UPDATES=$~DECLINE_SECURITY_UPDATES=TRUE~' ${SWLIB}/db_install.rsp
[oracle@rene-ace-test-inst1 grid]$   
[oracle@rene-ace-test-inst1 grid]$ diff ${ORACLE_HOME}/install/response/db_install.rsp ${SWLIB}/db_install.rsp
29c29
< oracle.install.option=
---
> oracle.install.option=INSTALL_DB_SWONLY
34c34
< UNIX_GROUP_NAME=
---
> UNIX_GROUP_NAME=oinstall
41c41
< INVENTORY_LOCATION=
---
> INVENTORY_LOCATION=/u01/app/oraInventory
45c45
< ORACLE_HOME=
---
> ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
50c50
< ORACLE_BASE=
---
> ORACLE_BASE=/u01/app/oracle
62c62
< oracle.install.db.InstallEdition=
---
> oracle.install.db.InstallEdition=EE
79c79
< oracle.install.db.OSDBA_GROUP=
---
> oracle.install.db.OSDBA_GROUP=dba
85c85
< oracle.install.db.OSOPER_GROUP=
---
> oracle.install.db.OSOPER_GROUP=dba
90c90
< oracle.install.db.OSBACKUPDBA_GROUP=
---
> oracle.install.db.OSBACKUPDBA_GROUP=dba
95c95
< oracle.install.db.OSDGDBA_GROUP=
---
> oracle.install.db.OSDGDBA_GROUP=dba
100c100
< oracle.install.db.OSKMDBA_GROUP=
---
> oracle.install.db.OSKMDBA_GROUP=dba
105c105
< oracle.install.db.OSRACDBA_GROUP=
---
> oracle.install.db.OSRACDBA_GROUP=dba

Once the response file is created, we now install the RDBMS software

[oracle@rene-ace-test-inst1 ~]$ ${ORACLE_HOME}/runInstaller -silent -waitforcompletion -responseFile ${SWLIB}/db_install.rsp
Launching Oracle Database Setup Wizard...

The response file for this session can be found at:
 /u01/app/oracle/product/19.0.0.0/dbhome_1/install/response/db_2020-04-04_02-22-21PM.rsp

You can find the log of this install session at:
 /u01/app/oraInventory/logs/InstallActions2020-04-04_02-22-21PM/installActions2020-04-04_02-22-21PM.log

As a root user, execute the following script(s):
	1. /u01/app/oracle/product/19.0.0.0/dbhome_1/root.sh

Execute /u01/app/oracle/product/19.0.0.0/dbhome_1/root.sh on the following nodes: 
[rene-ace-test-inst1]

Successfully Setup Software.

As root user we run the RDBMS root.sh

[root@rene-ace-test-inst1 ~]#  /u01/app/oracle/product/19.0.0.0/dbhome_1/root.sh
Check /u01/app/oracle/product/19.0.0.0/dbhome_1/install/root_rene-ace-test-inst1_2020-04-04_20-07-58-636555961.log for the output of root script

Once we have finished the RDBMS software installation, we setup the listener as oracle user. Also from this point forward we will no longer do any tasks as root, only as oracle user.

[oracle@rene-ace-test-inst1 ~]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-APR-2020 14:39:21

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/rene-ace-test-inst1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rene-ace-test-inst1.us-central1-c.c.oracle-migration.internal)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                04-APR-2020 14:39:22
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/rene-ace-test-inst1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rene-ace-test-inst1.us-central1-c.c.oracle-migration.internal)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@rene-ace-test-inst1 ~]$ lsnrctl stop

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-APR-2020 14:39:29

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
[oracle@rene-ace-test-inst1 ~]$  
[oracle@rene-ace-test-inst1 ~]$ srvctl add listener
[oracle@rene-ace-test-inst1 ~]$ srvctl start listener

We will now create and start the ASM Instance:

[oracle@rene-ace-test-inst1 ~]$ export ORACLE_SID=+ASM
[oracle@rene-ace-test-inst1 ~]$  
[oracle@rene-ace-test-inst1 ~]$ cat <<EOT > ${GRID_HOME}/dbs/init+ASM.ora
instance_type=ASM
asm_diskstring='/dev/oracleasm/*'
large_pool_size=12M
remote_login_passwordfile='EXCLUSIVE'
memory_target=0
sga_target=3G
pga_aggregate_target=400M
processes=1024
EOT
[oracle@rene-ace-test-inst1 ~]$   
[oracle@rene-ace-test-inst1 ~]$ srvctl add asm -d '/dev/oracleasm/*'
[oracle@rene-ace-test-inst1 ~]$ srvctl start asm
[oracle@rene-ace-test-inst1 ~]$  
[oracle@rene-ace-test-inst1 ~]$ export ORAENV_ASK=NO
[oracle@rene-ace-test-inst1 ~]$ . oraenv
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rene-ace-test-inst1 ~]$   
[oracle@rene-ace-test-inst1 ~]$ echo "CREATE spfile FROM pfile;" | sqlplus -s / as sysasm

File created.

[oracle@rene-ace-test-inst1 ~]$ srvctl stop asm
[oracle@rene-ace-test-inst1 ~]$ srvctl start asm

Now we will create the ASM diskgroup DATA

[oracle@rene-ace-test-inst1 ~]$ echo "
SELECT header_status,path FROM v\$asm_disk;
  
-- DROP DISKGROUP DATA INCLUDING CONTENTS;
CREATE DISKGROUP DATA EXTERNAL REDUNDANCY
   DISK '/dev/oracleasm/asm-disk1'
   ATTRIBUTE
      'compatible.asm'   = '19.0.0.0.0',
      'compatible.rdbms' = '12.1.0.2.0';
  
SELECT header_status,path FROM v\$asm_disk;
" | sqlplus -s / as sysasm

HEADER_STATU
------------
PATH
--------------------------------------------------------------------------------
CANDIDATE
/dev/oracleasm/asm-disk1

Diskgroup created.

HEADER_STATU
------------
PATH
--------------------------------------------------------------------------------
MEMBER
/dev/oracleasm/asm-disk1

Once the diskgroup is created, we now will create the database called DBTEST

[oracle@rene-ace-test-inst1 ~]$ mkdir -p /u01/app/oracle/fast_recovery_area/DBTEST
[oracle@rene-ace-test-inst1 ~]$ 
[oracle@rene-ace-test-inst1 ~]$ export ORACLE_SID=DBTEST
[oracle@rene-ace-test-inst1 ~]$ dbca -silent \
    -createDatabase \
    -templateName General_Purpose.dbc \
    -gdbName ${ORACLE_SID} \
    -sid ${ORACLE_SID} \
    -createAsContainerDatabase FALSE \
    -sysPassword welcome1 \
    -systemPassword welcome1 \
    -emConfiguration NONE \
    -datafileDestination '+DATA' \
    -recoveryAreaDestination '/u01/app/oracle/fast_recovery_area' \
    -redoLogFileSize 128 \
    -storageType ASM \
    -diskGroupName DATA \
    -characterSet AL32UTF8 \
    -nationalCharacterSet AL16UTF16 \
    -registerWithDirService FALSE \
    -automaticMemoryManagement FALSE \
    -initparams \
    db_create_file_dest='+DATA', \
    db_create_online_log_dest_1='+DATA', \
    filesystemio_options='SETALL', \
    log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST', \
    log_archive_format='DBTEST_%s%t%r.arc', \
    pga_aggregate_target=200, \
    processes=150, \
    sga_target=1200, \
    streams_pool_size=64M, \
    undo_retention=7200
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
   CAUSE: 
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
   CAUSE: 
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
Prepare for db operation
10% complete
Registering database with Oracle Restart
14% complete
Copying database files
43% complete
Creating and starting Oracle instance
45% complete
49% complete
53% complete
56% complete
62% complete
Completing Database Creation
68% complete
70% complete
71% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /u01/app/oracle/cfgtoollogs/dbca/DBTEST.
Database Information:
Global Database Name:DBTEST
System Identifier(SID):DBTEST
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/DBTEST/DBTEST.log" for further details.

Once the DB is created, we will adjust redo log settings to be 128 MB

[oracle@rene-ace-test-inst1 ~]$ sqlplus

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Apr 4 15:04:31 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Enter user-name: /as sysdba

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select name from v$database;

NAME
---------
DBTEST

SQL> SET serverout on
   
DECLARE
   file_bytes           NUMBER;
   max_group            INT;
   num_groups           INT;
   num_threads          INT;
   created              INT;
   str                  VARCHAR2(128);
BEGIN
   --SELECT MAX(bytes) INTO file_bytes FROM v$log;
   SELECT 128*1024*1024 INTO file_bytes FROM dual;
   SELECT COUNT(DISTINCT(thread#)) INTO num_threads FROM v$log;
   SELECT MAX(group#), COUNT(DISTINCT(group#)) INTO max_group, num_groups FROM v$logfile WHERE type = 'ONLINE';
   SELECT COUNT(*) INTO created FROM v$standby_log;
   IF (created = 0) THEN
      FOR i IN 1..num_threads LOOP
         --FOR j IN i..max_group+i LOOP
         FOR j IN 1..5 LOOP
            str := 'ALTER DATABASE ADD LOGFILE THREAD '||i||' GROUP '||TO_CHAR(j+num_groups*i)||' SIZE '||file_bytes;
            DBMS_OUTPUT.put_line(str);
            EXECUTE IMMEDIATE str;
         END LOOP;
      END LOOP;
   END IF;
END;
/  
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 4 SIZE 134217728
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 5 SIZE 134217728
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 6 SIZE 134217728
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 7 SIZE 134217728
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 8 SIZE 134217728

PL/SQL procedure successfully completed.

We will also adjust the database to use hugepages only, minimize SGA allocations, and adjust filesystem IO options

[oracle@rene-ace-test-inst1 ~]$ echo "
    alter system set USE_LARGE_PAGES=ONLY scope=spfile;
    alter system set FILESYSTEMIO_OPTIONS=SETALL scope=spfile;
    alter system set SGA_TARGET=650M scope=spfile;
    alter system set SGA_MAX_SIZE=650M scope=spfile;
    alter system set SHARED_POOL_SIZE=256M scope=spfile;
    alter system set PGA_AGGREGATE_TARGET=50M scope=spfile;
    alter system set DB_CACHE_SIZE=64M scope=spfile;
    alter system set PARALLEL_MAX_SERVERS=0 scope=spfile;
    alter system set RECYCLEBIN=OFF scope=spfile;
" | sqlplus -s / as sysdba

System altered.


System altered.


System altered.


System altered.


System altered.


System altered.


System altered.


System altered.


System altered.

We now stop and restart the DB so that the  parameters will take place and verify with the script crs_status.sh the status of the OHAS environment

[oracle@rene-ace-test-inst1 ~]$ srvctl stop database -d ${ORACLE_SID}
[oracle@rene-ace-test-inst1 ~]$ srvctl start database -d ${ORACLE_SID}

[oracle@rene-ace-test-inst1 ~]$ wget https://raw.githubusercontent.com/rene-ace/oracle_bash_scripts/master/crs_status.sh --output-document=${HOME}/working/crs_status.sh
...
(raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1320 (1.3K) [text/plain]
Saving to: ‘/home/oracle/working/crs_status.sh’

100%[==============================================================================================================================================>] 1,320       --.-K/s   in 0s      

2020-04-04 20:44:09 (224 MB/s) - ‘/home/oracle/working/crs_status.sh’ saved [1320/1320]

[oracle@rene-ace-test-inst1 working]$ chmod 750 ${HOME}/working/crs_status.sh
[oracle@rene-ace-test-inst1 working]$ sed -i '/^CRS_HOME/ s~CRS_HOME=$~CRS_HOME='${GRID_HOME}'~' ${HOME}/working/crs_status.sh
[oracle@rene-ace-test-inst1 working]$ ${HOME}/working/crs_status.sh
Name                                          Target     State           Server                    State details
------------------------------------------------------------------------------------------------------------------------
ora.DATA.dg                                   ONLINE     ONLINE          rene-ace-test-inst1       STABLE 
ora.LISTENER.lsnr                             ONLINE     ONLINE          rene-ace-test-inst1       STABLE 
ora.asm                                       ONLINE     ONLINE          rene-ace-test-inst1       Started,STABLE 
ora.ons                                       OFFLINE    OFFLINE         rene-ace-test-inst1       STABLE 
ora.cssd                                      ONLINE     ONLINE          rene-ace-test-inst1       STABLE 
ora.dbtest.db                                 ONLINE     ONLINE          rene-ace-test-inst1       Open,HOME=/u01/app/o 
ora.diskmon                                   OFFLINE    OFFLINE         STABLE                     
ora.evmd                                      ONLINE     ONLINE          rene-ace-test-inst1       STABLE 

Now that we have created our Google VM and installed OHAS and created our Oracle DB, we will be doing several things with these during our series. Hopes this helps you to understand a bit better Google Cloud and how to install an Oracle database in it.

Rene Antunez
[email protected]
2 Comments