Showing posts with label Unix / Linux. Show all posts
Showing posts with label Unix / Linux. Show all posts

Sunday, June 20, 2021

Script Run datapatch against all running instance in parallel

This script can be used to run datapatch against all currently running instances in parallel to apply sql patches after patches are applied on Oracle homes. It is helpful for post patching operations. It works for different instances running out of different Oracle homes and different home with different owners.

The script accepts one optional parameter as log file path, it will save log files under /tmp if no parameter is presented while the script is started.

In order to have the script succeed, please be advised about following limitations,

1. The script is only tested on Linux and AIX, it does not work on Solaris.

2. Only root or Oracle database home owner is supposed to run this script. If the instances are running out of different Oracle homes which are owned by different OS users, root user is recommended. Otherwise, the instances running out of Oracle home which owner is different from current user will be excluded.

3. Oracle database home is 12c or higher which supports datapatch

4. The script runs following command as root to retrieve Oracle home path
   /bin/ls
   Therefore, if Oracle home owner (normally oracle) runs this script, sudo has to be configure to grant the user privilege to run '/bin/ls' as root without being asked for password.

Friday, June 18, 2021

Install PostgreSQL on RHEL/OL/CentOS 6/7/8

There are many ways to install PostgreSQL on Linux box. Here, I am going to use yum to install different version of PostgreSQL on Red Hat Enterprise Linux (RHEL) 7/8, it also works for Oracle Linux (OL) / CentOS 7/8.

1. Install yum repository for PostgreSQL

Depends on version of OS, run one of following commands
  * RHEL/OL/CentOS 8
  yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

  * RHEL/OL/CentOS 7
  yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

  * RHEL/OL/CentOS 6
  yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm

2. Validate yum repository list with following command

  yum repolist

The command lists all configured repositories, example output on RHEL 8 
repo id                repo name
pgdg-common            PostgreSQL common RPMs for RHEL/CentOS 8 - x86_64
pgdg10                 PostgreSQL 10 for RHEL/CentOS 8 - x86_64
pgdg11                 PostgreSQL 11 for RHEL/CentOS 8 - x86_64
pgdg12                 PostgreSQL 12 for RHEL/CentOS 8 - x86_64
pgdg13                 PostgreSQL 13 for RHEL/CentOS 8 - x86_64
pgdg96                 PostgreSQL 9.6 for RHEL/CentOS 8 - x86_64

It configured PostgreSQL 9.6, 10, 11, 12, 13 repositories on RHEL 8. Therefore, I can install any or all of these version PostgreSQL. Note, available version PostgreSQL is different for different OS version.

3. Install PostgreSQL

Depends on which version you want to install, run one of following command,

  * Install PostgreSQL 13
  yum install -y postgresql13-server

  * Install PostgreSQL 12
  yum install -y postgresql12-server

  * Install PostgreSQL 11
  yum install -y postgresql11-server

  * Install PostgreSQL 10
  yum install -y postgresql10-server

  * Install PostgreSQL 96
  yum install -y postgresql96-server

4. Install package postgresql-contrib

This package contains various extension modules that are included in the PostgreSQL distribution. Depends on the version of PostgreSQL installed, run one of following command to install contrib package,

  * PostgreSQL 13
  yum install -y postgresql13-contrib

  * PostgreSQL 12
  yum install -y postgresql12-contrib

  * PostgreSQL 11
  yum install -y postgresql11-contrib

  * PostgreSQL 10
  yum install -y postgresql10-contrib

  * PostgreSQL 96
  yum install -y postgresql96-contrib

Wednesday, June 16, 2021

Oracle 19.11 roothas.sh failed with "Out of memory" on AIX

When applying Oracle GI Release Update 19.11.0.0.210420 on AIX, command "roothas.sh -postpatch" failed with "Out of memory" as following
[root@host01]# /u01/app/oracle/product/19.0.0/grid_1/crs/install/roothas.sh -postpatch
Using configuration parameter file: /u01/app/oracle/product/19.0.0/grid_1/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/oracle/crsdata/host01/crsconfig/hapatch_2021-06-15_01-53-27PM.log
Out of memory!
Out of memory!
Out of memory!
/u01/app/oracle/product/19.0.0/grid_1/crs/install/roothas.sh[137]: 7930494 Segmentation fault(coredump)
The command '/u01/app/oracle/product/19.0.0/grid_1/perl/bin/perl -I/u01/app/oracle/product/19.0.0/grid_1/perl/lib -I/u01/app/oracle/product/19.0.0/grid_1/crs/install -I/u01/app/oracle/product/19.0.0/grid_1/xag /u01/app/oracle/product/19.0.0/grid_1/crs/install/roothas.pl -postpatch' execution failed

The error is coming from the perl process (script roothas.pl) executing the root configuration scripts, the perl process does not have enough memory(especially data segments) during the script execution.

Technically, the "Out of memory" error could be seen on AIX while running Oracle 19c perl scripts for root configuration. These perl scripts are usually executed/called by DBA with sh script root.sh, rootupgrade.sh, rootcrs.sh, roothas.sh, etc. Although the error was hard to see before, it is becoming popular since Oracle GI RU 19.11 was released.

It is caused by OS memory allocation method. On AIX, the number of data segments that a process is allowed to use also limits the process memory size. The default number of data segments is one. The size of a data segment is 256 MB. Data segments are shared for both data and stack. The maximum number of additional data segments a process can use is eight (2GB). The number of segments that a process can use for data is controlled by the LDR_CNTRL environment variable. It is defined in the parent process of the process that is to be affected.

Therefore, we are able to fix the issue by increasing process memory size through increasing value of environment variable LDR_CNTRL. For example, the following defines eight additional data segments

export LDR_CNTRL=MAXDATA=0x80000000
<root script>
unset LDR_CNTRL

Here, 
  <root script> is what you have to run as root which got "Out of memory". In my case, it is "roothas.sh -postpatch".
  unset command remove (unset) the LDR_CNTRL environment variable, so that it does not unintentionally affect other processes.

Some argumentative guy says eight additional data segments (2GB) is too large, ok, you can set to 4 as following

export LDR_CNTRL=MAXDATA=0x40000000

Tuesday, June 15, 2021

Configure yum with proxy server on RHEL/OL/Fedora

When using yum to maintain packages on hosts running Red Hat Enterprise Linux (RHEL), Oracle Linux (OL) or Fedora, you may have to configure proxy option if the host is running behind firewall.

In order to do that, add following lines to yum configuration file /etc/yum.conf

proxy=http://<proxy server>:<port>
proxy_username=<user name>
proxy_password=<password>

Here, 

  <proxy server> is the host name or IP address of proxy server
  <user name> user name if proxy server requires
  <password>  password if proxy server requires

File /etc/yum.conf  example
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False
proxy=http://proxy.dbaplus.ca:8080
proxy_username=user01
proxy_password=user01pwd

Wednesday, March 31, 2021

OEM 13.4 AgentPull.sh failed with '0403-011 The specified substitution is not valid for this command'

When using Oracle Enterprise Manager 13.4 AgentPull.sh to deploy Agent 13.4 on AIX server, got following error,
./AgentPull.sh[270]: platform=${platform/\)/%29}: 0403-011 The specified substitution is not valid for this command.

Line 270 in AgentPull.sh is
platform=${platform/\)/%29}

It is a bash statement which tries to replace right parenthesis with code '%29', it works for bash but not Bourne shell (sh). The problem is that the script has directive to have Unix/Linux to run the script under bourne shell
$ head AgentPull.sh
#!/bin/sh
#
# $Header: emcore/install/unix/AgentPull.sh.template /main/30 2019/12/19 21:29:10 vbhaagav Exp $
#
# AgentPull.sh
#
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
#
#    NAME
#      AgentPull.sh - <one-line expansion of the name>

The script works on most Linux servers because the /bin/sh is a symbolic link file linked to /bin/bash on these servers. Unfortunately, AIX is honest :), sh is sh and bash is bash, they are different.

As workaround, replace first line of AgentPull.sh '#!/bin/sh' with '#!/bin/bash'.

Tuesday, December 1, 2020

Create Oracle ASM disks using multipath devices and udev rules on Oracle Linux / Red Hat Enterprise Linux

 Since Oracle Automatic Storage Management Filter Driver (ASMFD) was released with Oracle Database 12c, DBA has very few chance to work with udev rules when creating ASM disks. 

Fortunately, Oracle Database 19.6 introduced a new feature, Zero-Downtime Grid Infrastructure patching which brings the requirement of udev rules back to DBA. When Oracle ASMFD is used for ASM disks, Oracle patching has to update the operating system driver for ASMFD, which cannot be done in zero-downtime mode. Therefore, in order to patch Grid Infrastructure in zero-downtime mode instead of rolling mode, udev rules becomes a perfect option.

Friday, November 27, 2020

Rename / Change the Multipath Device Names on Linux

 Each multipath device has a World Wide Identifier (WWID), which is guaranteed to be globally unique and unchanging. By default, the name of a multipath device is set to its WWID. Alternately, you can set the user_friendly_names option in the multipath configuration file, which sets the alias to a node-unique name of the form mpathn.

Thursday, November 5, 2020

Oracle AHF installation failed with "AHF-00074: Perl Modules not found: Data::Dumper"

Oracle combined Trace File Analyzer (TFA) & ORAchk/EXAchk into single installer called Oracle Autonomous Health Framework (AHF).

When installing AHF on Linux platform (Red Hat Enterprise Linux / Oracle Linux), got error "AHF-00074: Perl Modules not found :  Data::Dumper"
[root@host01]# ./ahf_setup
AHF Installer for Platform Linux Architecture x86_64
AHF Installation Log : /tmp/ahf_install_202300_4904_2020_11_05-18_04_25.log
PERL : /u01/app/19.9.0/grid/perl/bin/perl
[ERROR] : AHF-00074: Perl Modules not found :  Data::Dumper

Saturday, October 31, 2020

Tuesday, October 27, 2020

Reduce number of privileged access audit files for ASM with rsyslog on Linux

This post shows how to configure rsyslog on Linux (Red Hat Enterprise Linux 7/8) to redirect ASM audit message to OS log files.

If you are looking for the information for Solaris or AIX, please check out following posts

Tuesday, October 20, 2020

Install and Configure Kerberos Authentication on Red Hat Enterprise Linux 8

The demonstration includes three installation/configuration parts,

  Part 1. Install and configure Kerberos Key Distribution Center (KDC) Server
  
     Server name: xdc01.lab.dbaplus.ca
     OS version:  Red Hat Enterprise Linux (RHEL) 8

  Part 2. Install and configure Kerberos client on application (SSH) server
  
     Server 1: host01.lab.dbaplus.ca
     Server 2: host02.lab.dbaplus.ca
     OS version:  Red Hat Enterprise Linux (RHEL) 8
  
  Part 3. Install and configure Kerberos client on workstation to test single-sign-on (SSO) for SSH authentication with Kerberos

Monday, June 10, 2019

Reduce number of privileged access audit files for ASM with syslog on AIX

ASM instance audits all privileged (log in as sysasm, sysdba or sysoper) access by creating audit file for each connection under the audit file destination directories (defined by initialization parameter audit_file_dest). The directory can grow to contain a very large number of files if they are not regularly maintained, especially when initialization parameter audit_sys_operations is true which is default from 12c.

Tuesday, January 15, 2019

Disable Transparent Hugepages on Oracle Linux / Redhat Enterprise Linux 7.5

Transparent Hugepages (THP) are similar to standard HugePages. However, while standard HugePages allocate memory at startup, Transparent Hugepages memory uses the khugepaged thread in the kernel to allocate memory dynamically during runtime, using swappable HugePages.

They may cause delays in accessing memory that can result in node restarts in Oracle RAC environments, or performance issues or delays for Oracle Database single instances. Oracle recommends to disable Transparent HugePages on Oracle database servers.

Following discussion is based on Oracle Linux / Redhat Enterprise Linux 7.5, it may be different on other Linux distributions.

Thursday, March 1, 2018

How to delete archive log files using PL/SQL


Although RMAN is always the first choice for most DBAs to delete archive log files, PL/SQL could be easier for this scenario,

User wants to switch an existing database from NOARCHIVELOG mode to ARCHIVELOG mode in order to increase the database availability because the database backup job has to shut down database when running in NOARCHIVELOG mode.

Friday, February 2, 2018

Desktop Icons and Panels Missing in VNC Viewer Connection

When VNC viewer connected to Linux server (Oracle Enterprise Linux 6.4), the desktop only show the wallpaper
and the desktop icons and panels are missing. 

And the log file /home/oracle/.vnc/host01.lab.dbaplus.ca:3.log contains following:
Fri Feb  2 20:11:16 2018
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5903
 vncext:      created VNC server for screen 0
gnome-session[9361]: WARNING: Unable to find provider 'gnome-panel' of required component 'panel'
gnome-session[9361]: WARNING: Unable to find provider 'nautilus' of required component 'filemanager'

Verify if the .desktop file for each component in the error messages exists,
[oracle@host01]$ ls -l /usr/share/applications/*panel*
ls: cannot access /usr/share/applications/*panel*: No such file or directory

[oracle@host01]$ ls -l /usr/share/applications/*nautilus*
ls: cannot access /usr/share/applications/*nautilus*: No such file or directory

The files are missing. Check if the packages are installed, 
[oracle@host01]$ rpm -q gnome-nautilus
package gnome-nautilus is not installed
[oracle@host01]$  rpm -q gnome-panel
package gnome-panel is not installed

Neither is found, install them,
[root@host01]# yum install gnome-panel nautilus
<<messages are truncated>>
Installed:
  gnome-panel.x86_64 0:2.30.2-14.el6                         nautilus.x86_64 0:2.28.4-19.el6

Dependency Installed:
  exempi.x86_64 0:2.1.0-5.el6                              gnome-disk-utility-libs.x86_64 0:2.30.1-2.el6
  gnome-session-xsession.x86_64 0:2.28.0-18.el6            gvfs.x86_64 0:1.4.3-15.el6
  libatasmart.x86_64 0:0.17-4.el6_2                        libcdio.x86_64 0:0.81-3.1.el6
  libcroco.x86_64 0:0.6.2-5.el6                            libexif.x86_64 0:0.6.21-5.el6_3
  libgsf.x86_64 0:1.14.15-5.el6                            librsvg2.x86_64 0:2.26.0-5.el6_1.1
  mtools.x86_64 0:4.0.12-1.el6                             nautilus-extensions.x86_64 0:2.28.4-19.el6
  smp_utils.x86_64 0:0.94-4.el6                            udisks.x86_64 0:1.0.1-4.el6
  unique.x86_64 0:1.1.4-2.el6

Complete!

[root@host01]# rpm -q nautilus
nautilus-2.28.4-19.el6.x86_64
[root@host01]# rpm -q gnome-panel
gnome-panel-2.30.2-14.el6.x86_64

[root@host01]# ls -l /usr/share/applications/*panel*
-rw-r--r-- 1 root root 14928 Apr  7  2011 /usr/share/applications/gnome-panel.desktop
[root@host01]# ls -l /usr/share/applications/*nautilus*
-rw-r--r-- 1 root root  3393 Apr 29  2012 /usr/share/applications/gnome-nautilus-autorun-software.desktop
-rw-r--r-- 1 root root 10634 Apr 29  2012 /usr/share/applications/gnome-nautilus-browser.desktop
-rw-r--r-- 1 root root 12690 Apr 29  2012 /usr/share/applications/gnome-nautilus-computer.desktop
-rw-r--r-- 1 root root  3960 Apr 29  2012 /usr/share/applications/gnome-nautilus.desktop
-rw-r--r-- 1 root root 11229 Apr 29  2012 /usr/share/applications/gnome-nautilus-file-management-properties.desktop
-rw-r--r-- 1 root root  3058 Apr 29  2012 /usr/share/applications/gnome-nautilus-folder-handler.desktop
-rw-r--r-- 1 root root  7651 Apr 29  2012 /usr/share/applications/gnome-nautilus-home.desktop
[root@host01]#

Now, we can start vnc-viewer to create a connection with everything needed.

Thursday, January 25, 2018

AIX Disk Only Visible to One ASM Instance of Grid Infrastructure

Oracle Grid Infrastructure 12.2.0.1
AIX 7.1


New disks are added to both nodes of Grid Infrastructure, and the disk permission is configured properly,
[grid@host01]$ ls -l /dev/*hdisk[56]
brw-------      1 root      system         21, 26 Jan 22 10:58 /dev/hdisk5
brw-------      1 root      system         21, 25 Jan 22 10:58 /dev/hdisk6
crw-rw----    1 grid     asmadmin     21, 26 Jan 24 16:07 /dev/rhdisk5
crw-rw----    1 grid     asmadmin     21, 25 Jan 24 16:06 /dev/rhdisk6

[grid@host02]$ ls -l /dev/*hdisk2[56]
brw-------      1 root      system          21, 25 Jan 22 11:08 /dev/hdisk5
brw-------      1 root      system          21, 31 Jan 22 11:08 /dev/hdisk6
crw-rw----    1 grid     asmadmin     21, 25 Jan 22 11:08 /dev/rhdisk5
crw-rw----    1 grid     asmadmin     21, 31 Jan 24 14:49 /dev/rhdisk6

Wednesday, January 14, 2015

Automate Startup/Shutdown of OSWatcher with Oracle HAS (GridInfrastructure Standalone)

Grid Infrastructure Standalone 11.2.0.3
Operation system AIX 6.1

Download Oracle OSWatcher (oswbb732.tar, current version 7.3.2) from My Oracle Support. Install OSWatcher:
$ mkdir /u01/app/grid/product/7.3.2
$ cd /u01/app/grid/product/7.3.2
$ tar xvf /tmp/oswbb732.tar
  ... ...
$ ls -l oswbb/*OSWbb*
-rwxr-xr-x    1 grid  oinstall         2385 Oct 07 2013  oswbb/startOSWbb.sh
-rwxr-xr-x    1 grid  oinstall          558 Apr 17 2014  oswbb/stopOSWbb.sh

Monday, September 28, 2009

Install DNS server on Red Hat Enterprise Linux (RHEL) AS 4 Update 8

Normally, DBA is far away from DNS server configuration. However, Oracle Database 11g Release 2 introduced an exciting new RAC feature SCAN (Single Client Access Name) witch needs to work with DNS. It becomes the motivation for DBA to study DNS configuration.

Saturday, June 6, 2009

Change Resolution of Red Hat Enterprise Linux Text Console

If Red Hat Enterprise Linux is installed without GUI (Gnome, KDE), or the system is running at runlevel 3, all the text appears big (low resolution) on local text-mode console as following,



Actually, this can be changed by adding 'vga=<resolution code>' option into grub boot loader configuration file '/boot/grub/grub.conf'.

Original grub.conf contains following line,

kernel /vmlinuz-2.6.9-89.EL ro root=LABEL=/ rhgb quiet


And we are going to set the resolution to 1024x768 24bit color and new file is changed as following,

kernel /vmlinuz-2.6.9-89.EL ro root=LABEL=/ rhgb quiet vga=792


Note: Resolution code (here is 792) really depends on hardware. It could be following values (come from Red Hat support),

   Depth      800×600     1024×768     1152×864     1280×1024     1600×1200
   8 bit         vga=771     vga=773        vga=353        vga=775         vga=796
   16 bit       vga=788     vga=791        vga=355        vga=794         vga=798
   24 bit       vga=789     vga=792        -------           vga=795         vga=799


After reboot, much more messages come up onto text console, the console becomes 'bigger',