Thinking Out Loud

May 22, 2022

Systemd Persistent Logging

Filed under: 19c,linux,OEL7,oracle — mdinh @ 3:05 pm

Remembrance from an old friend: Curiosity killed the cat, but satisfaction brought it back.

Finally found how to keep systemd logging persistent.

==================================================
### Number of reboots:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# last reboot
reboot   system boot  5.4.17-2136.307. Sat May 21 17:53 - 18:01  (00:07)
reboot   system boot  5.4.17-2136.307. Sat May 21 17:48 - 17:51  (00:03)
reboot   system boot  5.4.17-2136.307. Sat May 21 11:01 - 17:48  (06:46)
reboot   system boot  5.4.17-2136.307. Fri May 20 23:12 - 11:01  (11:48)
reboot   system boot  5.4.17-2136.307. Fri May 20 22:54 - 23:11  (00:17)
reboot   system boot  5.4.17-2136.307. Fri May 20 22:49 - 22:54  (00:04)
reboot   system boot  5.4.17-2136.307. Fri May 20 22:21 - 22:49  (00:27)
reboot   system boot  5.4.17-2136.307. Fri May 20 22:04 - 22:21  (00:16)
reboot   system boot  5.4.17-2136.307. Thu May 19 23:35 - 22:03  (22:28)
reboot   system boot  5.4.17-2136.307. Thu May 19 23:19 - 23:34  (00:15)
reboot   system boot  5.4.17-2136.307. Thu May 19 23:07 - 23:18  (00:11)
reboot   system boot  5.4.17-2136.307. Thu May 19 22:54 - 23:05  (00:11)
reboot   system boot  5.4.17-2136.307. Thu May 19 22:47 - 22:53  (00:06)
reboot   system boot  5.4.17-2136.307. Thu May 19 21:08 - 22:45  (01:37)
reboot   system boot  5.4.17-2136.307. Thu May 19 20:40 - 21:07  (00:27)
reboot   system boot  5.4.17-2136.307. Thu May 19 07:28 - 10:59  (03:31)
reboot   system boot  5.4.17-2136.307. Thu May 19 07:22 - 07:27  (00:05)
reboot   system boot  5.4.17-2036.100. Wed May 18 22:24 - 07:22  (08:57)

wtmp begins Wed May 18 22:24:31 2022
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### Only 1 reboot recorded from journalctl:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# journalctl --list-boots
 0 016de73a7e81411bbd7c0b7657863852 Sat 2022-05-21 17:53:18 -04—Sat 2022-05-21 18:01:01 -04
[root@oracle-goldengate-1910-vagrant ~]#

[root@oracle-goldengate-1910-vagrant ~]# journalctl | head -1
-- Logs begin at Sat 2022-05-21 17:53:18 -04, end at Sat 2022-05-21 18:01:01 -04. --
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### Enable persistent systemd journal log:
==================================================

Enable persistent storage for the systemd journal log
https://gist.github.com/JPvRiel/b7c185833da32631fa6ce65b40836887

[root@oracle-goldengate-1910-vagrant ~]# mkdir /var/log/journal
[root@oracle-goldengate-1910-vagrant ~]# systemd-tmpfiles --create --prefix /var/log/journal
[root@oracle-goldengate-1910-vagrant ~]# echo "SystemMaxUse=100M" >> /etc/systemd/journald.conf
[root@oracle-goldengate-1910-vagrant ~]# grep -i SystemMaxUse /etc/systemd/journald.conf
#SystemMaxUse=
SystemMaxUse=100M
[root@oracle-goldengate-1910-vagrant ~]# systemctl restart systemd-journald.service

==================================================
### Moment of truth:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# last reboot
reboot   system boot  5.4.17-2136.307. Sat May 21 18:31 - 18:33  (00:01)
reboot   system boot  5.4.17-2136.307. Sat May 21 18:12 - 18:29  (00:16)
reboot   system boot  5.4.17-2136.307. Sat May 21 17:53 - 18:09  (00:15)

reboot   system boot  5.4.17-2136.307. Sat May 21 17:48 - 17:51  (00:03)
reboot   system boot  5.4.17-2136.307. Sat May 21 11:01 - 17:48  (06:46)
reboot   system boot  5.4.17-2136.307. Fri May 20 23:12 - 11:01  (11:48)
reboot   system boot  5.4.17-2136.307. Fri May 20 22:54 - 23:11  (00:17)
reboot   system boot  5.4.17-2136.307. Fri May 20 22:49 - 22:54  (00:04)
reboot   system boot  5.4.17-2136.307. Fri May 20 22:21 - 22:49  (00:27)
reboot   system boot  5.4.17-2136.307. Fri May 20 22:04 - 22:21  (00:16)
reboot   system boot  5.4.17-2136.307. Thu May 19 23:35 - 22:03  (22:28)
reboot   system boot  5.4.17-2136.307. Thu May 19 23:19 - 23:34  (00:15)
reboot   system boot  5.4.17-2136.307. Thu May 19 23:07 - 23:18  (00:11)
reboot   system boot  5.4.17-2136.307. Thu May 19 22:54 - 23:05  (00:11)
reboot   system boot  5.4.17-2136.307. Thu May 19 22:47 - 22:53  (00:06)
reboot   system boot  5.4.17-2136.307. Thu May 19 21:08 - 22:45  (01:37)
reboot   system boot  5.4.17-2136.307. Thu May 19 20:40 - 21:07  (00:27)
reboot   system boot  5.4.17-2136.307. Thu May 19 07:28 - 10:59  (03:31)
reboot   system boot  5.4.17-2136.307. Thu May 19 07:22 - 07:27  (00:05)
reboot   system boot  5.4.17-2036.100. Wed May 18 22:24 - 07:22  (08:57)

wtmp begins Wed May 18 22:24:31 2022
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### More than 1 reboot recorded from journalctl:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# journalctl --list-boots|sort
 0 beedb88ca40c4c6187ae9d5c7ff1e96e Sat 2022-05-21 18:31:53 -04—Sat 2022-05-21 23:30:01 -04
-1 e12a9e02fd374350a5fcd3d4360b09fc Sat 2022-05-21 18:12:48 -04—Sat 2022-05-21 18:29:34 -04
-2 016de73a7e81411bbd7c0b7657863852 Sat 2022-05-21 17:53:18 -04—Sat 2022-05-21 18:09:16 -04
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### Review GoldengGate Start and Stop:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# last reboot|head -5|sort -n
reboot   system boot  5.4.17-2136.307. Sat May 21 11:01 - 17:48  (06:46)
reboot   system boot  5.4.17-2136.307. Sat May 21 17:48 - 17:51  (00:03)

reboot   system boot  5.4.17-2136.307. Sat May 21 17:53 - 18:09  (00:15)

reboot   system boot  5.4.17-2136.307. Sat May 21 18:12 - 18:29  (00:16)
reboot   system boot  5.4.17-2136.307. Sat May 21 18:31 - 19:11  (00:39)
[root@oracle-goldengate-1910-vagrant ~]#

[root@oracle-goldengate-1910-vagrant ~]# journalctl --no-pager|grep "Manager st"
May 21 17:53:44 oracle-goldengate-1910-vagrant start_goldengate.sh[3115]: Manager started.

May 21 18:09:04 oracle-goldengate-1910-vagrant stop_goldengate.sh[6177]: Manager stopped.
May 21 18:13:15 oracle-goldengate-1910-vagrant start_goldengate.sh[3383]: Manager started.

May 21 18:29:21 oracle-goldengate-1910-vagrant stop_goldengate.sh[6290]: Manager stopped.
May 21 18:32:17 oracle-goldengate-1910-vagrant start_goldengate.sh[4134]: Manager started.
[root@oracle-goldengate-1910-vagrant ~]#

==================================================

reboot system boot  5.4.17-2136.307. Sat May 21 17:48 - 17:51  (00:03) 
journalctl May 21 17:53:44 oracle-goldengate-1910-vagrant start_goldengate.sh[3115]: Manager started.

reboot system boot  5.4.17-2136.307. Sat May 21 17:53 - 18:09  (00:15)
journalctl May 21 18:09:04 oracle-goldengate-1910-vagrant stop_goldengate.sh[6177]: Manager stopped.
journalctl May 21 18:13:15 oracle-goldengate-1910-vagrant start_goldengate.sh[3383]: Manager started.

reboot system boot  5.4.17-2136.307. Sat May 21 18:12 - 18:29  (00:16)
journalctl May 21 18:13:15 oracle-goldengate-1910-vagrant start_goldengate.sh[3383]: Manager started.
journalctl May 21 18:29:21 oracle-goldengate-1910-vagrant stop_goldengate.sh[6290]: Manager stopped.

reboot system boot  5.4.17-2136.307. Sat May 21 18:31 - 10:57  (16:25)
journalctl May 21 18:32:17 oracle-goldengate-1910-vagrant start_goldengate.sh[4134]: Manager started.

May 21, 2022

Systemd Database GoldenGate Service Start Stop

Filed under: 19c,GoldenGate,linux,OEL7,oracle — mdinh @ 6:13 pm

A complicated solution for a simple process.

If you can’t beat them, join them.

==================================================
### Restart vagrant box:
==================================================

resetlogs@ghost MINGW64 /e/oracle/vagrant-projects/OracleGoldenGate/19.3.0 (main)
$ vagrant halt

resetlogs@ghost MINGW64 /e/oracle/vagrant-projects/OracleGoldenGate/19.3.0 (main)
$ vagrant up

resetlogs@ghost MINGW64 /e/oracle/vagrant-projects/OracleGoldenGate/19.3.0 (main)
$ vagrant ssh

==================================================
### System info and last reboot:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# cat /etc/system-release
Oracle Linux Server release 7.9
[root@oracle-goldengate-1910-vagrant ~]#

[root@oracle-goldengate-1910-vagrant ~]# last reboot|head -1
reboot   system boot  5.4.17-2136.307. Sat May 21 11:01 - 11:02  (00:00)
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### Verify goldengate.service started on reboot:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# systemctl status goldengate.service
● goldengate.service - Oracle GoldenGate Manager
   Loaded: loaded (/etc/systemd/system/goldengate.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-05-21 11:02:14 -04; 1min 9s ago
  Process: 4485 ExecStart=/home/oracle/scripts/start_goldengate.sh (code=exited, status=0/SUCCESS)
 Main PID: 4504 (mgr)
   CGroup: /system.slice/goldengate.service
           ├─4504 ./mgr PARAMFILE /u01/ogg/dirprm/mgr.prm REPORTFILE /u01/ogg/dirrpt/MGR.rpt PROCESSID MGR
           └─4522 /u01/ogg/extract PARAMFILE /u01/ogg/dirprm/ext.prm REPORTFILE /u01/ogg/dirrpt/EXT.rpt PROCESSID EXT

May 21 11:02:06 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Manager started.
May 21 11:02:06 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: GGSCI (oracle-goldengate-1910-vagrant) 3> START ER *
May 21 11:02:07 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Sending START request to MANAGER ...
May 21 11:02:07 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: EXTRACT EXT starting
May 21 11:02:07 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: GGSCI (oracle-goldengate-1910-vagrant) 4> shell sleep 5
May 21 11:02:13 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: GGSCI (oracle-goldengate-1910-vagrant) 5> INFO ALL
May 21 11:02:14 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Program     Status      Group       Lag at Chkpt  Time Since Chkpt
May 21 11:02:14 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: MANAGER     RUNNING
May 21 11:02:14 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: EXTRACT     RUNNING     EXT         00:01:25      00:00:00
May 21 11:02:14 oracle-goldengate-1910-vagrant systemd[1]: Started Oracle GoldenGate Manager.
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### Check logs for goldengate.service:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# journalctl -u goldengate.service
-- Logs begin at Sat 2022-05-21 11:01:41 -04, end at Sat 2022-05-21 11:03:24 -04. --
May 21 11:02:04 oracle-goldengate-1910-vagrant systemd[1]: Starting Oracle GoldenGate Manager...
May 21 11:02:04 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: The Oracle base has been set to /opt/oracle
May 21 11:02:04 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Oracle GoldenGate Command Interpreter for Oracle
May 21 11:02:04 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO
May 21 11:02:04 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 21:16:29
May 21 11:02:04 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Operating system character set identified as UTF-8.
May 21 11:02:04 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
May 21 11:02:05 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: GGSCI (oracle-goldengate-1910-vagrant) 1>
May 21 11:02:05 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: GGSCI (oracle-goldengate-1910-vagrant) 2> START MGR
May 21 11:02:06 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Manager started.
May 21 11:02:06 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: GGSCI (oracle-goldengate-1910-vagrant) 3> START ER *
May 21 11:02:07 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Sending START request to MANAGER ...
May 21 11:02:07 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: EXTRACT EXT starting
May 21 11:02:07 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: GGSCI (oracle-goldengate-1910-vagrant) 4> shell sleep 5
May 21 11:02:13 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: GGSCI (oracle-goldengate-1910-vagrant) 5> INFO ALL
May 21 11:02:14 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: Program     Status      Group       Lag at Chkpt  Time Since Chkpt
May 21 11:02:14 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: MANAGER     RUNNING
May 21 11:02:14 oracle-goldengate-1910-vagrant start_goldengate.sh[4485]: EXTRACT     RUNNING     EXT         00:01:25      00:00:00
May 21 11:02:14 oracle-goldengate-1910-vagrant systemd[1]: Started Oracle GoldenGate Manager.
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### There is no log from journalctl before reboot:
==================================================

[root@oracle-goldengate-1910-vagrant ~]#  last reboot|head -1
reboot   system boot  5.4.17-2136.307. Sat May 21 11:01 - 11:32  (00:30)
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### NOTICE: Logs begin at Sat 2022-05-21 11:01:41
==================================================

[root@oracle-goldengate-1910-vagrant ~]# journalctl --no-pager|head -2
-- Logs begin at Sat 2022-05-21 11:01:41 -04, end at Sat 2022-05-21 11:30:01 -04. --
May 21 11:01:41 oracle-goldengate-1910-vagrant systemd-journal[151]: Runtime journal is using 8.0M (max allowed 96.8M, trying to leave 145.3M free of 960.7M available → current limit 96.8M).
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### stop_goldengate.sh attempts to gather info:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# ls -alrt /u01/ogg/ggse*
-rw-r-----. 1 oracle oinstall  7835 May 21 11:00 /u01/ogg/ggserr.log.20220521.1100
-rw-r--r--. 1 oracle oinstall   955 May 21 11:00 /u01/ogg/ggserr.log.stop
-rw-r-----. 1 oracle oinstall 10384 May 21 11:02 /u01/ogg/ggserr.log
[root@oracle-goldengate-1910-vagrant ~]#

[root@oracle-goldengate-1910-vagrant ~]# cat /u01/ogg/ggserr.log.stop
2022-05-21T11:00:47.915-0400  INFO    OGG-00987  Oracle GoldenGate Command Interpreter for Oracle:  GGSCI command (oracle): STOP MGR.
2022-05-21T11:00:47.930-0400  INFO    OGG-00963  Oracle GoldenGate Manager for Oracle, mgr.prm:  Command received from GGSCI on host [127.0.0.1]:58056 (STOP).
2022-05-21T11:00:47.930-0400  WARNING OGG-00938  Oracle GoldenGate Manager for Oracle, mgr.prm:  Manager is stopping at user request.
2022-05-21T11:00:51.934-0400  INFO    OGG-00987  Oracle GoldenGate Command Interpreter for Oracle:  GGSCI command (oracle): STOP ER *.
2022-05-21T11:00:52.175-0400  INFO    OGG-01021  Oracle GoldenGate Capture for Oracle, ext.prm:  Command received from GGSCI: STOP.
2022-05-21T11:00:52.179-0400  INFO    OGG-00991  Oracle GoldenGate Capture for Oracle, ext.prm:  EXTRACT EXT stopped normally.
2022-05-21T11:00:59.213-0400  INFO    OGG-00987  Oracle GoldenGate Command Interpreter for Oracle:  GGSCI command (oracle): INFO ALL.
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### Continue with demo:
==================================================

==================================================
### Stop goldengate.service using systemctl stop:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# systemctl stop goldengate.service
[root@oracle-goldengate-1910-vagrant ~]# systemctl status goldengate.service
● goldengate.service - Oracle GoldenGate Manager
   Loaded: loaded (/etc/systemd/system/goldengate.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Sat 2022-05-21 11:16:37 -04; 13s ago
  Process: 5432 ExecStop=/home/oracle/scripts/stop_goldengate.sh (code=exited, status=0/SUCCESS)
  Process: 4485 ExecStart=/home/oracle/scripts/start_goldengate.sh (code=exited, status=0/SUCCESS)
 Main PID: 4504 (code=exited, status=0/SUCCESS)

May 21 11:16:28 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Manager stopped.
May 21 11:16:28 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: GGSCI (oracle-goldengate-1910-vagrant) 3> STOP ER *
May 21 11:16:29 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Sending STOP request to EXTRACT EXT ...
May 21 11:16:30 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Request processed.
May 21 11:16:30 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: GGSCI (oracle-goldengate-1910-vagrant) 4> shell sleep 5
May 21 11:16:36 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: GGSCI (oracle-goldengate-1910-vagrant) 5> INFO ALL
May 21 11:16:37 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Program     Status      Group       Lag at Chkpt  Time Since Chkpt
May 21 11:16:37 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: MANAGER     STOPPED
May 21 11:16:37 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: EXTRACT     STOPPED     EXT         00:00:00      00:00:07
May 21 11:16:37 oracle-goldengate-1910-vagrant systemd[1]: Stopped Oracle GoldenGate Manager.
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### Check journalctl -u goldengate.service:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# journalctl -u goldengate.service|grep -i stop
May 21 11:16:24 oracle-goldengate-1910-vagrant systemd[1]: Stopping Oracle GoldenGate Manager...
May 21 11:16:24 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: The Oracle base has been set to /opt/oracle
May 21 11:16:24 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: ‘/u01/ogg/ggserr.log’ -> ‘/u01/ogg/ggserr.log.20220521.1116’
May 21 11:16:24 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Oracle GoldenGate Command Interpreter for Oracle
May 21 11:16:24 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO
May 21 11:16:24 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 21:16:29
May 21 11:16:24 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Operating system character set identified as UTF-8.
May 21 11:16:24 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
May 21 11:16:25 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: GGSCI (oracle-goldengate-1910-vagrant) 1>
May 21 11:16:25 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: GGSCI (oracle-goldengate-1910-vagrant) 2> STOP MGR !
May 21 11:16:26 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Sending STOP request to MANAGER ...
May 21 11:16:26 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Request processed.
May 21 11:16:28 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Manager stopped.
May 21 11:16:28 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: GGSCI (oracle-goldengate-1910-vagrant) 3> STOP ER *
May 21 11:16:29 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Sending STOP request to EXTRACT EXT ...
May 21 11:16:30 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Request processed.
May 21 11:16:30 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: GGSCI (oracle-goldengate-1910-vagrant) 4> shell sleep 5
May 21 11:16:36 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: GGSCI (oracle-goldengate-1910-vagrant) 5> INFO ALL
May 21 11:16:37 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: Program     Status      Group       Lag at Chkpt  Time Since Chkpt
May 21 11:16:37 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: MANAGER     STOPPED
May 21 11:16:37 oracle-goldengate-1910-vagrant stop_goldengate.sh[5432]: EXTRACT     STOPPED     EXT         00:00:00      00:00:07
May 21 11:16:37 oracle-goldengate-1910-vagrant systemd[1]: Stopped Oracle GoldenGate Manager.
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### List ggserr logs:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# ls -alrt /u01/ogg/ggse*
-rw-r-----. 1 oracle oinstall  7835 May 21 11:00 /u01/ogg/ggserr.log.20220521.1100
-rw-r-----. 1 oracle oinstall 10384 May 21 11:16 /u01/ogg/ggserr.log.20220521.1116
-rw-r-----. 1 oracle oinstall   955 May 21 11:16 /u01/ogg/ggserr.log
-rw-r--r--. 1 oracle oinstall   955 May 21 11:16 /u01/ogg/ggserr.log.stop
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### Services configured for rdbms and goldengate:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# systemctl list-unit-files|egrep -i 'oracle|gate'
goldengate.service                            enabled
oracle-rdbms.service                          enabled
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### Configuration for goldengate.service:
==================================================

[root@oracle-goldengate-1910-vagrant ~]# ls -l /etc/systemd/system/goldengate.service
-rw-r--r--. 1 root root 713 May 19 23:16 /etc/systemd/system/goldengate.service
[root@oracle-goldengate-1910-vagrant ~]#

[root@oracle-goldengate-1910-vagrant ~]# cat /etc/systemd/system/goldengate.service
[Unit]
Description=Oracle GoldenGate Manager
After=syslog.target network.target
# systemctl list-unit-files|grep -i oracle
After=oracle-rdbms.service

[Service]
Type=forking
RemainAfterExit=yes
KillMode=none
User=oracle
Group=oinstall
TimeoutStopSec=60
TimeoutSec=300
Restart=no

# systemd ignores PAM limits, so set any necessary limits in the service.
# Not really a bug, but a feature.
# https://bugzilla.redhat.com/show_bug.cgi?id=754285
# /etc/security/limits.d/oracle-database-preinstall-19c.conf

LimitMEMLOCK=infinity
LimitNOFILE=131072
LimitNPROC=131072

ExecStart=/home/oracle/scripts/start_goldengate.sh
ExecStop=/home/oracle/scripts/stop_goldengate.sh
Restart=no

[Install]
WantedBy=multi-user.target
[root@oracle-goldengate-1910-vagrant ~]#

==================================================
### GoldenGate processes:
==================================================

oracle@oracle-goldengate-1910-vagrant ogg]$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO
Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 21:16:29
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.



GGSCI (oracle-goldengate-1910-vagrant) 1> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     EXT         00:00:00      00:00:00


GGSCI (oracle-goldengate-1910-vagrant) 2> info mgr detail

Manager is running (IP port TCP:oracle-goldengate-1910-vagrant.7809, Process ID 5539).


GGSCI (oracle-goldengate-1910-vagrant) 3> info extract *

EXTRACT    EXT       Last Started 2022-05-20 23:31   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:03 ago)
Process ID           5546
Log Read Checkpoint  Oracle Integrated Redo Logs
                     2022-05-20 23:35:08
                     SCN 0.3722791 (3722791)


GGSCI (oracle-goldengate-1910-vagrant) 4> exit
[oracle@oracle-goldengate-1910-vagrant ogg]$

==================================================
### start_goldengate.sh & start_goldengate.obey:
==================================================

[oracle@oracle-goldengate-1910-vagrant ~]$ cat /home/oracle/scripts/start_goldengate.sh
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

ORAENV_ASK=NO; ORACLE_SID=ORCLCDB; OGG_HOME=/u01/ogg
. /usr/local/bin/oraenv

$OGG_HOME/ggsci << EOF
  OBEY /home/oracle/scripts/start_goldengate.obey
  exit
EOF
exit
[oracle@oracle-goldengate-1910-vagrant ~]$

[oracle@oracle-goldengate-1910-vagrant ~]$ cat /home/oracle/scripts/start_goldengate.obey
START MGR
START ER *
shell sleep 5
INFO ALL
[oracle@oracle-goldengate-1910-vagrant ~]$

==================================================
### stop_goldengate.sh & stop_goldengate.obey:
==================================================

[oracle@oracle-goldengate-1910-vagrant ~]$ cat /home/oracle/scripts/stop_goldengate.sh
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

ORAENV_ASK=NO; ORACLE_SID=ORCLCDB; OGG_HOME=/u01/ogg
. /usr/local/bin/oraenv

# Rotate existing GGSERR_LOG with append date
GGSERR_LOG=$OGG_HOME/ggserr.log
cp -fv ${GGSERR_LOG%%.*}.{${GGSERR_LOG#*.},${GGSERR_LOG#*.}."$(date +%Y%m%d.%H%M)"}
cat /dev/null > $GGSERR_LOG

$OGG_HOME/ggsci << EOF
  OBEY /home/oracle/scripts/stop_goldengate.obey
  exit
EOF
tail -9 $GGSERR_LOG > $GGSERR_LOG.stop
exit
[oracle@oracle-goldengate-1910-vagrant ~]$

[oracle@oracle-goldengate-1910-vagrant ~]$ cat /home/oracle/scripts/stop_goldengate.obey
STOP MGR !
STOP ER *
shell sleep 5
INFO ALL
[oracle@oracle-goldengate-1910-vagrant ~]$

==================================================
### GoldenGate credential store:
==================================================

GGSCI (oracle-goldengate-1910-vagrant) 1> INFO CREDENTIALSTORE

Reading from credential store:

Default domain: OracleGoldenGate

  Alias: c##ggadmin
  Userid: c##ggadmin@ORCLCDB

GGSCI (oracle-goldengate-1910-vagrant) 2>

==================================================
### GoldenGate mgr.prm:
==================================================

[oracle@oracle-goldengate-1910-vagrant ogg]$ cat dirprm/mgr.prm
PORT 7809
USERIDALIAS c##ggadmin
PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS, MINKEEPDAYS 3
AUTOSTART ER *
AUTORESTART ER *, RETRIES 5, WAITMINUTES 2, RESETMINUTES 60
CHECKMINUTES 5
LAGINFOMINUTES 0
LAGCRITICALMINUTES 5
[oracle@oracle-goldengate-1910-vagrant ogg]$

==================================================
### GoldenGate ext.prm:
==================================================

[oracle@oracle-goldengate-1910-vagrant ogg]$ cat dirprm/ext.prm
EXTRACT ext
SETENV (ORACLE_SID = "ORCLCDB")
SETENV (ORACLE_HOME = "/opt/oracle/product/19c/dbhome_1")
USERIDALIAS c##ggadmin
EXTTRAIL ./dirdat/et
GETUPDATEBEFORES
UPDATERECORDFORMAT COMPACT

SOURCECATALOG ORCLPDB1
TABLE ogguser.*;
SEQUENCE ogguser.*;
[oracle@oracle-goldengate-1910-vagrant ogg]$

==================================================
### tnsnames.ora requires (UR=A):
==================================================

ORCLPDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCLPDB1)(UR=A)
    )
  )
  
==================================================
!!! IMPORTANT !!!
==================================================

systemctl is NOT aware when goldengate start/stopp from ggsci!

GGSCI (oracle-goldengate-1910-vagrant) 1> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     EXT         00:00:00      00:00:09


GGSCI (oracle-goldengate-1910-vagrant) 2> stop mgr !

Sending STOP request to MANAGER ...
Request processed.
Manager stopped.


GGSCI (oracle-goldengate-1910-vagrant) 3> stop er *

Sending STOP request to EXTRACT EXT ...
Request processed.


GGSCI (oracle-goldengate-1910-vagrant) 4> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     STOPPED
EXTRACT     STOPPED     EXT         00:00:00      00:00:04


GGSCI (oracle-goldengate-1910-vagrant) 5>

==============================

[root@oracle-goldengate-1910-vagrant ~]# systemctl status goldengate.service
● goldengate.service - Oracle GoldenGate Manager
   Loaded: loaded (/etc/systemd/system/goldengate.service; enabled; vendor preset: disabled)
   Active: active (exited) since Sat 2022-05-21 12:00:46 -04; 1min 40s ago
  Process: 5432 ExecStop=/home/oracle/scripts/stop_goldengate.sh (code=exited, status=0/SUCCESS)
  Process: 7921 ExecStart=/home/oracle/scripts/start_goldengate.sh (code=exited, status=0/SUCCESS)
 Main PID: 4504 (code=exited, status=0/SUCCESS)

May 21 12:00:37 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: GGSCI (oracle-goldengate-1910-vagrant) 2> START MGR
May 21 12:00:38 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: MGR is already running.
May 21 12:00:38 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: GGSCI (oracle-goldengate-1910-vagrant) 3> START ER *
May 21 12:00:39 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: EXTRACT EXT is already running.
May 21 12:00:39 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: GGSCI (oracle-goldengate-1910-vagrant) 4> shell sleep 5
May 21 12:00:45 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: GGSCI (oracle-goldengate-1910-vagrant) 5> INFO ALL
May 21 12:00:46 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: Program     Status      Group       Lag at Chkpt  Time Since Chkpt
May 21 12:00:46 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: MANAGER     RUNNING
May 21 12:00:46 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: EXTRACT     RUNNING     EXT         00:00:00      00:00:00
May 21 12:00:46 oracle-goldengate-1910-vagrant systemd[1]: Started Oracle GoldenGate Manager.
[root@oracle-goldengate-1910-vagrant ~]#

==============================

GGSCI (oracle-goldengate-1910-vagrant) 1> sh date

Sat May 21 12:07:40 -04 2022


GGSCI (oracle-goldengate-1910-vagrant) 2> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     STOPPED
EXTRACT     STOPPED     EXT         00:00:00      00:05:45


GGSCI (oracle-goldengate-1910-vagrant) 3> start mgr
Manager started.


GGSCI (oracle-goldengate-1910-vagrant) 4> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     EXT         00:00:00      00:00:03


GGSCI (oracle-goldengate-1910-vagrant) 5>

==============================

[root@oracle-goldengate-1910-vagrant ~]# systemctl status goldengate.service
● goldengate.service - Oracle GoldenGate Manager
   Loaded: loaded (/etc/systemd/system/goldengate.service; enabled; vendor preset: disabled)
   Active: active (exited) since Sat 2022-05-21 12:00:46 -04; 7min ago
  Process: 5432 ExecStop=/home/oracle/scripts/stop_goldengate.sh (code=exited, status=0/SUCCESS)
  Process: 7921 ExecStart=/home/oracle/scripts/start_goldengate.sh (code=exited, status=0/SUCCESS)
 Main PID: 4504 (code=exited, status=0/SUCCESS)

May 21 12:00:37 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: GGSCI (oracle-goldengate-1910-vagrant) 2> START MGR
May 21 12:00:38 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: MGR is already running.
May 21 12:00:38 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: GGSCI (oracle-goldengate-1910-vagrant) 3> START ER *
May 21 12:00:39 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: EXTRACT EXT is already running.
May 21 12:00:39 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: GGSCI (oracle-goldengate-1910-vagrant) 4> shell sleep 5
May 21 12:00:45 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: GGSCI (oracle-goldengate-1910-vagrant) 5> INFO ALL
May 21 12:00:46 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: Program     Status      Group       Lag at Chkpt  Time Since Chkpt
May 21 12:00:46 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: MANAGER     RUNNING
May 21 12:00:46 oracle-goldengate-1910-vagrant start_goldengate.sh[7921]: EXTRACT     RUNNING     EXT         00:00:00      00:00:00
May 21 12:00:46 oracle-goldengate-1910-vagrant systemd[1]: Started Oracle GoldenGate Manager.
[root@oracle-goldengate-1910-vagrant ~]#

March 26, 2022

Default SSH keys Algorithm

Filed under: linux — mdinh @ 11:29 pm

I encountered a peculiar incindent for not being able to connect to host after installing Git Bash latest version.

Basically old Git version 2.32.0.windows.1 SSH key default is RSA while new Git version 2.35.1.windows.2 SSH key default is ED25519.

One option is to restore to previous Git version (which I opted).

Alternatively, specify -oHostKeyAlgorithms when using new Git Version.

================================================
--- Find Windows OS
================================================

C:\Users\pucaximibepu>systeminfo | findstr OS
OS Name:                   Microsoft Windows Server 2019 Datacenter
OS Version:                10.0.17763 N/A Build 17763
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Member Server
OS Build Type:             Multiprocessor Free
BIOS Version:              Amazon EC2 1.0, 10/16/2017

C:\Users\pucaximibepu>

==================================================
--- git version 2.35.1.windows.2 (default ed25519)
==================================================

pucaximibepu@tank-8753 MINGW64 ~
$ git --version
git version 2.35.1.windows.2

==================================================
--- Connect using ssh FAILED
==================================================

pucaximibepu@tank-8753 MINGW64 ~
$ ssh p_mdinh@172.22.37.10
Unable to negotiate with 172.22.37.10 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

==================================================
--- Specify -oHostKeyAlgorithms ssh-dss SUCCEEDED
==================================================

pucaximibepu@tank-8753 MINGW64 ~
$ ssh -oHostKeyAlgorithms=+ssh-dss p_mdinh@172.22.37.10
(p_mdinh@172.22.37.10)
**********************************************************
**** ATTENTION ** ATTENTION ** ATTENTION ** ATTENTION ****
**********************************************************

Use SecureAuth 2FA to login - RSA tokens no longer work.

Enter your RSD password (your computer/mail password)
and NOT your Linux password.

Password:

==================================================
--- Specify -oHostKeyAlgorithms ssh-rsa FAILED
==================================================

pucaximibepu@tank-8753 MINGW64 ~
$ ssh -oHostKeyAlgorithms=+ssh-rsa p_mdinh@172.22.37.10
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:++6geRg12kREpx3l5ZjYKm+EhiDuG5nfsFOkavD6PUI.
Please contact your system administrator.
Add correct host key in /c/Users/pucaximibepu/.ssh/known_hosts to get rid of this message.
Offending DSA key in /c/Users/pucaximibepu/.ssh/known_hosts:2
Host key for 172.22.37.10 has changed and you have requested strict checking.
Host key verification failed.

pucaximibepu@tank-8753 MINGW64 ~
$

==================================================
--- Remove known_hosts
==================================================

pucaximibepu@tank-8753 MINGW64 ~
$ cd .ssh

pucaximibepu@tank-8753 MINGW64 ~/.ssh
$ ls -l
total 4
-rw-r--r-- 1 pucaximibepu 1049089 1214 Mar 26 16:25 known_hosts

pucaximibepu@tank-8753 MINGW64 ~/.ssh
$ rm known_hosts

==================================================
--- Specify -oHostKeyAlgorithms ssh-rsa SUCCEEDED
==================================================

pucaximibepu@tank-8753 MINGW64 ~/.ssh
$ ssh -oHostKeyAlgorithms=+ssh-rsa p_mdinh@172.22.37.10
The authenticity of host '172.22.37.10 (172.22.37.10)' can't be established.
RSA key fingerprint is SHA256:++6geRg12kREpx3l5ZjYKm+EhiDuG5nfsFOkavD6PUI.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.22.37.10' (RSA) to the list of known hosts.
(p_mdinh@172.22.37.10)
**********************************************************
**** ATTENTION ** ATTENTION ** ATTENTION ** ATTENTION ****
**********************************************************

Use SecureAuth 2FA to login - RSA tokens no longer work.

Enter your RSD password (your computer/mail password)
and NOT your Linux password.

Password:

==================================================
--- git version 2.32.0.windows.1 (default RSA)
==================================================

pucaximibepu@tank-8753 MINGW64 ~
$ git --version
git version 2.32.0.windows.1

==================================================
---  ssh SUCCEEDED without -oHostKeyAlgorithms
==================================================

pucaximibepu@tank-8753 MINGW64 ~
$ ssh p_mdinh@172.22.37.10

(p_mdinh@172.22.37.10)
**********************************************************
**** ATTENTION ** ATTENTION ** ATTENTION ** ATTENTION ****
**********************************************************

Use SecureAuth 2FA to login - RSA tokens no longer work.

Enter your RSD password (your computer/mail password)
and NOT your Linux password.

Password:

January 28, 2022

Silent Install Oracle DB 19.3

Filed under: 19c,linux,response_file,runInstaller — mdinh @ 10:16 pm

I was asked to Install Oracle 19c EE with the provided information:

DB: /app/oracle/product/19.3.0
SW: /backup/media/oracle19.3_database/LINUX.X64_193000_db_home.zip

Not knowing anything about the environment, more due diligence is required and here are the steps taken:

--- Find OS info:

oracle@oradev001: ~ $ uname -an
Linux oradev001 3.10.0-1160.31.1.el7.x86_64 #1 SMP Wed May 26 20:18:08 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

--- Create new directory:

oracle@oradev001: ~ $ ls -ld /app/oracle/product/19.3.0
ls: cannot access /app/oracle/product/19.3.0: No such file or directory

oracle@oradev001: ~ $ mkdir -p /app/oracle/product/19.3.0
oracle@oradev001: ~ $ ls -ld /app/oracle/product/19.3.0
drwxr-xr-x 2 oracle dba 4096 Jan 26 12:44 /app/oracle/product/19.3.0

--- Extract software:

oracle@oradev001: ~ $ cd /app/oracle/product/19.3.0
oracle@oradev001: /app/oracle/product/19.3.0 $ unzip -oq /backup/media/oracle19.3_database/LINUX.X64_193000_db_home.zip; echo $?
0

--- Extract rspfmt_dbinstall_response_schema_v19.0.0 from db_install.rsp:

oracle@oradev001: /app/oracle/product/19.3.0 $ ls -l install/response/db_install.rsp
-rw-r--r-- 1 oracle dba 19932 Feb  6  2019 install/response/db_install.rsp

oracle@oradev001: /app/oracle/product/19.3.0 $ grep responseFileVersion install/response/db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0

--- Find UNIX_GROUP_NAME (oinstall or dba):

oracle@oradev001: /app/oracle/product/19.3.0 $ id oracle
uid=3000(oracle) gid=3000(dba) groups=3000(dba),54329(asmadmin),54327(asmdba)

--- Find ORACLE_BASE:

oracle@oradev001: /app/oracle/product/19.3.0 $ env|grep ORACLE_BASE
ORACLE_BASE=/app/oracle

--- Find INVENTORY_LOCATION:

oracle@oradev001: /app/oracle/product/19.3.0 $ ls -l /etc/oraInst.loc
-rw-r--r-- 1 root root 47 Nov  7  2018 /etc/oraInst.loc

--- Create and copy response file to /tmp:

oracle@oradev001: /app/oracle/product/19.3.0 $ cat db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=dba
INVENTORY_LOCATION=/etc/oraInst.loc
SELECTED_LANGUAGES=en
ORACLE_HOME=/app/oracle/product/19.3.0
ORACLE_BASE=/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true

--- Perform executePrereqs and Ignore:

oracle@oradev001: /app/oracle/product/19.3.0 $ ./runInstaller -silent -executePrereqs -waitforcompletion -force -responseFile /tmp/db_install.rsp
Launching Oracle Database Setup Wizard...

[WARNING] [INS-13014] Target environment does not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /app/oraInventory/logs/InstallActions2022-01-26_01-19-52PM/installActions2022-01-26_01-19-52PM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /app/oraInventory/logs/InstallActions2022-01-26_01-19-52PM/installActions2022-01-26_01-19-52PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.

--- Install software only;

oracle@oradev001: /app/oracle/product/19.3.0 $ ./runInstaller -silent -waitforcompletion -responseFile /tmp/db_install.rsp
Launching Oracle Database Setup Wizard...

[WARNING] [INS-13014] Target environment does not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /app/oraInventory/logs/InstallActions2022-01-26_01-28-45PM/installActions2022-01-26_01-28-45PM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /app/oraInventory/logs/InstallActions2022-01-26_01-28-45PM/installActions2022-01-26_01-28-45PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
 /app/oracle/product/19.3.0/install/response/db_2022-01-26_01-28-45PM.rsp

You can find the log of this install session at:
 /app/oraInventory/logs/InstallActions2022-01-26_01-28-45PM/installActions2022-01-26_01-28-45PM.log

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

Execute /app/oracle/product/19.3.0/root.sh on the following nodes:
[oradev001]


Successfully Setup Software with warning(s).
oracle@oradev001: /app/oracle/product/19.3.0 $

--- Review ignorable errors: insufficient swap and OS kernel parameter "shmall"

oracle@oradev001: /app/oracle/product/19.3.0 $ grep -C 10 INS-13014 /app/oraInventory/logs/InstallActions2022-01-26_01-28-45PM/installActions2022-01-26_01-28-45PM.log
INFO:  [Jan 26, 2022 1:29:03 PM] ------------------List of failed Tasks------------------
INFO:  [Jan 26, 2022 1:29:03 PM] *********************************************
INFO:  [Jan 26, 2022 1:29:03 PM] Swap Size: This is a prerequisite condition to test whether sufficient total swap space is available on the system.
INFO:  [Jan 26, 2022 1:29:03 PM] Severity:IGNORABLE
INFO:  [Jan 26, 2022 1:29:03 PM] OverallStatus:VERIFICATION_FAILED
INFO:  [Jan 26, 2022 1:29:03 PM] *********************************************
INFO:  [Jan 26, 2022 1:29:03 PM] OS Kernel Parameter: shmall: This is a prerequisite condition to test whether the OS kernel parameter "shmall" is properly set.
INFO:  [Jan 26, 2022 1:29:03 PM] Severity:IGNORABLE
INFO:  [Jan 26, 2022 1:29:03 PM] OverallStatus:VERIFICATION_FAILED
INFO:  [Jan 26, 2022 1:29:03 PM] -----------------End of failed Tasks List----------------

WARNING:  [Jan 26, 2022 1:29:03 PM] [WARNING] [INS-13014] Target environment does not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /app/oraInventory/logs/InstallActions2022-01-26_01-28-45PM/installActions2022-01-26_01-28-45PM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /app/oraInventory/logs/InstallActions2022-01-26_01-28-45PM/installActions2022-01-26_01-28-45PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.

INFO:  [Jan 26, 2022 1:29:03 PM] Advice is CONTINUE
INFO:  [Jan 26, 2022 1:29:03 PM] Completed validating state <performChecks>
INFO:  [Jan 26, 2022 1:29:03 PM] Verifying route success
INFO:  [Jan 26, 2022 1:29:03 PM] Executing initialize action at state showSummary
INFO:  [Jan 26, 2022 1:29:03 PM] Completed executing initialize action at state <showSummary>
INFO:  [Jan 26, 2022 1:29:03 PM] Waiting for completion of background operations
INFO:  [Jan 26, 2022 1:29:03 PM] Completed background operations
INFO:  [Jan 26, 2022 1:29:03 PM] Waiting for completion of background operations
oracle@oradev001: /app/oracle/product/19.3.0 $

January 13, 2022

COMPLICATED COMMINGLED DATABASE ENVIRONMENT

Filed under: awk_sed_grep,linux,RMAN,shell scripting — mdinh @ 11:16 pm

I have been reviewing RMAN RAC backup for environment having a total of 15 non-production and production databases on the same host excluding APX and MGMTDB.

That’s not a big deal, as I have once had to managed 28 databases residing on the same host, right?

I am just too lazy and too tedious to change RMAN configuration one database at a time.

Luckily, there is a convention where non-production instances ends with T1 and production instances ends with P1.

This allows me to make the same changes to non-production and production in 2 steps.

Goal is to configure RMAN PARALLELISM 2 for NON-PROD and PARALLELISM 4 for PROD and consistent RECOVERY WINDOW OF 14 DAYS.

### Current configuration is inconsistent across databases:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;

CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 2;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 4;

====================
### NON-PROD: 
====================

--- RMAN commands: cat configure.rman:
set echo on
connect target;
show all;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 2;
show all;
exit

--- Let's make sure the instances are correct:
$ ps -ef|grep [p]mon|egrep -v 'ASM|APX|MGMTDB'|cut -d_ -f3|grep -Ev '\P1'|sort
DB01T1
DB02T1
DB03T1

--- Make the change:
$ for db in $(ps -ef|grep [p]mon|egrep -v 'ASM|APX|MGMTDB'|cut -d_ -f3|grep -Ev '\P1'|sort); do echo 'RMAN configure' $db; . oraenv <<< $db; rman @configure.rman; done;

====================
### PROD:
====================

--- RMAN commands: cat configure.rman:
set echo on
connect target;
show all;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 4;
show all;
exit

--- Let's make sure the instances are correct:
$ ps -ef|grep [p]mon|egrep -v 'ASM|APX|MGMTDB'|cut -d_ -f3|grep -E '\P1'|sort
DB01P1
DB02P1
DB03P1

--- Make the change:
$ for db in $(ps -ef|grep [p]mon|egrep -v 'ASM|APX|MGMTDB'|cut -d_ -f3|grep -E '\P1'|sort); do echo 'RMAN configure' $db; . oraenv <<< $db; rman @configure.rman; done;

December 4, 2021

How To Resolve Tablespace Created With Windows Path In Linux

Filed under: 11g,linux,oracle — mdinh @ 3:20 pm

Now I understand the rationale for not providing DBA privileges to inexperience developers.

Currently, I am uncertain if the current environment is production or not.

Here is demo for 11.2.0.4 to demonstrate the issue and resolution.

Reference:
https://docs.oracle.com/cd/E18283_01/server.112/e17120/dfiles005.htm#i1006478

[oracle@ol7-112-dg1 trace]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 4 14:46:37 2021

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show parameter db_create_file_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest                  string      /u01/oradata

----------------------------------------
--- Windows path used for datafile:
----------------------------------------

SQL> create tablespace TEST datafile 'D:\Oracle\oradata\E1Local\TEST.dbf' SIZE 16M;

Tablespace created.

SQL> set lines 200
SQL> col name for a80
SQL> select file#,name from v$datafile order by 1;

     FILE# NAME
---------- --------------------------------------------------------------------------------
         1 /u01/oradata/hawk/system01.dbf
         2 /u01/oradata/hawk/sysaux01.dbf
         3 /u01/oradata/hawk/undotbs01.dbf
         4 /u01/oradata/hawk/users01.dbf
         5 /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/D:OracleoradataE1LocalTEST.dbf

SQL> alter tablespace TEST offline normal;

Tablespace altered.

SQL> select TABLESPACE_NAME,STATUS from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
UNDOTBS1                       ONLINE
TEMP                           ONLINE
USERS                          ONLINE
TEST                           OFFLINE

6 rows selected.

SQL> host

----------------------------------------
--- Rename datafile from OS
----------------------------------------

[oracle@ol7-112-dg1 trace]$ mv -fv /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/D:OracleoradataE1LocalTEST.dbf /u01/oradata/test.dbf
‘/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/D:OracleoradataE1LocalTEST.dbf’ -> ‘/u01/oradata/test.dbf’

[oracle@ol7-112-dg1 trace]$ exit
exit

SQL> alter tablespace TEST rename datafile '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/D:OracleoradataE1LocalTEST.dbf' TO '/u01/oradata/test.dbf';

Tablespace altered.

SQL> select TABLESPACE_NAME,STATUS from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
UNDOTBS1                       ONLINE
TEMP                           ONLINE
USERS                          ONLINE
TEST                           OFFLINE

6 rows selected.

SQL> alter tablespace TEST online;

Tablespace altered.

SQL> select TABLESPACE_NAME,STATUS from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
UNDOTBS1                       ONLINE
TEMP                           ONLINE
USERS                          ONLINE
TEST                           ONLINE

6 rows selected.

SQL> drop tablespace TEST including contents and datafiles;

Tablespace dropped.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ol7-112-dg1 trace]$

----------------------------------------
--- Alert Log: NO ERRORS!
----------------------------------------

[oracle@ol7-112-dg1 trace]$ tail -25 alert_hawk.log
LNS: Standby redo logfile selected for thread 1 sequence 126 for destination LOG_ARCHIVE_DEST_2
Sat Dec 04 14:47:17 2021
create tablespace TEST datafile 'D:\Oracle\oradata\E1Local\TEST.dbf' SIZE 16M
Completed: create tablespace TEST datafile 'D:\Oracle\oradata\E1Local\TEST.dbf' SIZE 16M
Sat Dec 04 14:48:08 2021
alter tablespace TEST offline normal
Completed: alter tablespace TEST offline normal
Sat Dec 04 14:48:08 2021
Starting background process SMCO
Sat Dec 04 14:48:08 2021
SMCO started with pid=36, OS id=5159
Sat Dec 04 14:48:19 2021
Checker run found 2 new persistent data failures
Sat Dec 04 14:49:33 2021
alter tablespace TEST rename datafile '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/D:OracleoradataE1LocalTEST.dbf' TO '/u01/oradata/test.dbf'
Completed: alter tablespace TEST rename datafile '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/D:OracleoradataE1LocalTEST.dbf' TO '/u01/oradata/test.dbf'
Sat Dec 04 14:49:42 2021
Checker run found 1 new persistent data failures
Sat Dec 04 14:50:00 2021
alter tablespace TEST online
Completed: alter tablespace TEST online
Sat Dec 04 14:50:33 2021
drop tablespace TEST including contents and datafiles
Deleted file /u01/oradata/test.dbf
Completed: drop tablespace TEST including contents and datafiles
[oracle@ol7-112-dg1 trace]$

----------------------------------------
--- Resolution for 19c with ASM
----------------------------------------

SQL> alter session set container=PDB;
SQL> ALTER DATABASE MOVE DATAFILE '/u02/app/oracle/product/19.0.0.0/dbhome_1/dbs/D:OracleoradataE1LocalTEST.dbf' TO '+DATAC1';

May 14, 2021

Gather Your Session Info For Killing

Filed under: 11g,linux,oracle — mdinh @ 4:40 am

So there I was, running emremove.sql as part of pre-upgrade task; however, it was taking longer than expected.

Session was stuck at the output shown below and desperately CTRL-C did not work.

14:35:05 472  /
old  70:     IF (upper('&LOGGING') = 'VERBOSE')
new  70:     IF (upper('VERBOSE') = 'VERBOSE')

^C

^C^C

^C

I checked for blocking session and there were blocking locks from SYS which was really strange.

I made a gutsy call and kill SYS session from OS prompt based on timestamp.

~ $ ps -ef|grep sysdba
oracle    57147 231962  0 May12 pts/4    00:00:00 sqlplus   as sysdba
oracle   155919 139352  0 14:34 pts/1    00:00:00 sqlplus   as sysdba
oracle   244619 216760  0 15:25 pts/5    00:00:00 grep --color=auto sysdba

~ $ kill -9 155919

As it turns out, another DBA was logged in as sysdba causing havoc.

I was lucky to have killed the correct SYS session and will you be as lucky as I was?

Based on my near disaster, it would be better to create good practice of gathering your session info to be able to kill the correct session.

Here is current session info.

SQL> @my
SQL> select b.sid, b.serial#, a.spid processid, b.process clientpid from v$process a, v$session b
  2  where a.addr = b.paddr
  3  and b.audsid = userenv('sessionid')
  4  and b.sid=userenv('sid')
  5  ;

       SID    SERIAL# PROCESSID                CLIENTPID
---------- ---------- ------------------------ ------------------------
         5        101 16428                    16427

SQL>

[oracle@ol7-112-dg1 ~]$ ps -ef|grep 16427
oracle   16427  8573  0 03:44 pts/0    00:00:00 sqlplus   as sysdba
oracle   16428 16427  0 03:44 ?        00:00:00 oraclehawk (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   16461 11677  0 03:45 pts/1    00:00:00 grep --color=auto 16427
[oracle@ol7-112-dg1 ~]$

Kill OS process using sqlplus PROCESSID – don’t know session is killed until DML is performed.

[oracle@ol7-112-dg1 ~]$ kill -9 16428

SQL> select * from dual;
select * from dual
*
ERROR at line 1:
ORA-03135: connection lost contact
Process ID: 16428
Session ID: 5 Serial number: 101


SQL>

Another test

--- Session Info
SQL> @my
SQL> select b.sid, b.serial#, a.spid processid, b.process clientpid from v$process a, v$session b
  2  where a.addr = b.paddr
  3  and b.audsid = userenv('sessionid')
  4  and b.sid=userenv('sid')
  5  ;

       SID    SERIAL# PROCESSID                CLIENTPID
---------- ---------- ------------------------ ------------------------
         5        103 16533                    16532

SQL>

--- From another session, check waits for above session
SQL> r
  1  select NVL(s.username,'(oracle)') AS username, s.sid, s.serial#,
  2  sw.event, sw.seconds_in_wait, sw.state
  3  from v$session_wait sw, v$session s
  4  where s.sid = sw.sid and s.sid=&sid
  5*
Enter value for sid: 5
old   4: where s.sid = sw.sid and s.sid=&sid
new   4: where s.sid = sw.sid and s.sid=5

USERNAME               SID    SERIAL# EVENT                          SECONDS_IN_WAIT STATE
--------------- ---------- ---------- ------------------------------ --------------- -------------------
SYS                      5        115 SQL*Net message from client                169 WAITING

SQL>

Kill OS process using sqlplus CLIENTPID – immediate feedback –

[oracle@ol7-112-dg1 ~]$ ps -ef|grep 16532
oracle   16532  8573  0 03:46 pts/0    00:00:00 sqlplus   as sysdba
oracle   16533 16532  0 03:46 ?        00:00:00 oraclehawk (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   16557 11677  0 03:47 pts/1    00:00:00 grep --color=auto 16532
[oracle@ol7-112-dg1 ~]$


[oracle@ol7-112-dg1 ~]$ kill -9 16532


SQL> Killed
[oracle@ol7-112-dg1 ~]$

Hopefully you will never have to kill your own session.

When you need kill your session, it’s better to have the correct information versus guessing.

April 11, 2021

Port Forwarding Using SSH Config File

Filed under: Grid Control,linux — mdinh @ 8:03 pm

Here is a good reference SSH config file for OpenSSH client

From a secured server, I am able to connect to 2 different environments which seems counter intuitive but I digress.

Since there are 2 different environments, the same ~/.ssh/config cannot be used as there may be IP overlap.

One environment will use ~/.ssh/config and ssh emhost

Other environment will use ~/.ssh/cbconfig and ssh -F ~/.ssh/cbconfig emhost

The default EM port for both hosts is 7803.

Using firefox https://localhost:7803/em to access EM does not work well when saving username and password as they will be overwritten.

One solution to save sysman’s password is to use URL with different port.

Hence, config will have EM port 7803 forward to 7803 while cbconfig will have EM port 7803 forward to 7804.

========================================
This is on cloud and looks complicated. 
========================================
I did not create the configuration and don't know how many hours it took.
~/.ssh/config

Host emhost
     HostName 10.157.38.66
     LocalForward 7001 10.157.38.66:7001
     LocalForward 7102 10.157.38.66:7102
     LocalForward 7803 10.157.38.66:7803
     LocalForward 9803 10.157.38.66:9803
     LocalForward 9851 10.157.38.66:9851

# DEFAULTS:
Host *
User dinh


========================================
This is on premise and looks simpler. 
========================================
ssh -F ~/.ssh/cbconfig emhost

Host emhost
     HostName 10.10.72.254
     # Forward port need to use IP address.
     # Equivalent to ssh -L 7804:10.10.72.254:7803 mdinh@10.10.72.254
     LocalForward 7804 10.131.28.227:7803

# DEFAULTS:
Host *
User mdinh

April 6, 2021

Detect Linux Host Restart

Filed under: awk_sed_grep,linux,shell scripting — mdinh @ 3:15 am

Sometime ago I had blogged about Monitor Linux Host Restart

The simple solution: How to email admins automatically after a Linux server starts?

Here is the example from root’s cron:

# crontab -l
@reboot su oracle -c '/home/oracle/scripts/host_restart_alert.sh' > /tmp/host_restart_alert.out 2>&1

Shell script is used because mail cannot be sent from local host and will need to be sent from remote host.

#!/bin/bash -x
MAILFROM=
MAILTO=
SUBJECT="Node reboot detected for $(hostname)"
EMAILMESSAGE="$(hostname) was restarted `uptime -p| awk -F'up' '{print $2}'` ago at `uptime -s`"

# uptime reports minutely and need to sleep for at least 60s after host restart
sleep 63

ssh oracle@remotehost /bin/bash <<EOF
/home/oracle/scripts/send_email.sh "$EMAILMESSAGE" "$SUBJECT" "$MAILFROM" "$MAILTO"
EOF

exit

Why is there a need to detect host restart and isn’t there monitoring for the host?

This is Oracle Exadata Cloud@Customer (ExaCC) environment.

When Oracle support performs patching, they do not provide any sort of communication or status and monitoring is disable for all hosts beforehand.

OPatchAuto to Patch a GI/RAC Environment.

After the patching is complete and your servers are restarted, you should check your product software to verify that the issue has been resolved.

This is why there is a need to detect and be notified for server restart.

April 4, 2021

Linux Find Week# Of Month

Filed under: linux,shell scripting — mdinh @ 9:02 pm

Unfortunately, Linux does not have parameter for Week Number Of Month

I found the solution at https://serverfault.com/questions/383666/how-to-determine-number-of-week-of-the-month

echo $((($(date +%-d)-1)/7+1))

Here is how I have tested.

[oracle@oracle-12201-vagrant ~]$ date -d '20210404'
Sun Apr  4 00:00:00 -05 2021

[oracle@oracle-12201-vagrant ~]$ echo $((($(date -d '20210404' +%-d)-1)/7+1))
1

[oracle@oracle-12201-vagrant ~]$ date -d '20210411'
Sun Apr 11 00:00:00 -05 2021

[oracle@oracle-12201-vagrant ~]$ echo $((($(date -d '20210411' +%-d)-1)/7+1))
2

[oracle@oracle-12201-vagrant ~]$ date -d '20210418'
Sun Apr 18 00:00:00 -05 2021

[oracle@oracle-12201-vagrant ~]$ echo $((($(date -d '20210418' +%-d)-1)/7+1))
3

[oracle@oracle-12201-vagrant ~]$ date -d '20210425'
Sun Apr 25 00:00:00 -05 2021

[oracle@oracle-12201-vagrant ~]$ echo $((($(date -d '20210425' +%-d)-1)/7+1))
4

Why is this even useful?

It can be a continuation of Simplify Log Management For Backup

Next Page »

Blog at WordPress.com.