Linux – Install java and javac on RedHat Linux

Install java and javac on RedHat Linux

To install java and the java compiler on RedHat Linux, it is required to installed a couple of packages using yum.

As root, or sudo as a privileged user, execute the following commands at the command line prompt:

yum install java
yum install java-1.8.0-openjdk-devel

Linux – Oracle – Display Environment Variables Associated to a Process

Find the process id – Example : Oracle Listener

[grid@server01 admin]$ ps -ef|grep -i listen
grid     21687     1  0 Apr21 ?        00:20:28 /oracle/grid/12.2/bin/tnslsnr LISTENER_SCAN1 -no_crs_notify -inherit
grid     21938     1  0 Apr21 ?        00:32:52 /oracle/grid/12.2/bin/tnslsnr LISTENER -no_crs_notify -inherit
root     31840 31805  0 Apr21 ?        00:00:00 hald-addon-input: Listening on /dev/input/event3 /dev/input/event0 /dev/input/event1
68       32017 31805  0 Apr21 ?        00:00:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
grid     32608 13797  0 14:21 pts/5    00:00:00 grep -i listen

Display the Environment Variables

[grid@server01 admin]$ strings /proc/21938/environ
__CRS_ACTIVE_VERSION=12.2.0.1.0
__CLSAGFW_TYPE_NAME=ora.mgmtlsnr.type
CHECK_WRAP_TRACE=/oracle/gridbase/crsdata/debug/oraagent_trace_needed.txt
ORA_CRS_HOME=/oracle/grid/12.2
TERM=linux
__CRSD_CONNECT_STR=(ADDRESS=(PROTOCOL=IPC)(KEY=CRSD_IPC_SOCKET_11))
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
CRF_HOME=/oracle/grid/12.2
GIPCD_PASSTHROUGH=false
ENVCMD=/bin/env
__CRSD_AGENT_NAME=/oracle/grid/12.2/bin/oraagent_grid
_ORA_AGENT_ACTION=TRUE
__CRSD_MSG_FRAME_VERSION=2
LD_LIBRARY_PATH=/oracle/grid/12.2/lib:/etc/ORCLcluster/lib
WRAP_ENVFILE=/oracle/gridbase/crsdata/debug/oraagent_env_20066.log
START_MODE=
FILEOWNER=
__CLSAGENT_INCARNATION=2
CRS_LIMIT_MEMLOCK=unlimited
FILEOWNER_ID=
__CRS_START_MODE=normal
ORACLE_BASE=/oracle/gbase
.......

Oracle – Direct NFS with a Windows NFS Server

Scenario : Oracle Direct NFS, NFS on Windows Server

you are using Oracle Direct NFS, and the NFS is running on Windows, there is a potential issue with permissions and ownership changes required.

Example

An example of issues with Oracle Direct NFS using datapump with the DATA_PUMP_DIR located on an NFS share server by NFS on Windows:

Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 2.625 MB
Processing object type SCHEMA_EXPORT/USER
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.CREATE_OBJECT_ROWS [USER:"XYZ"]
ORA-19505: failed to identify file "/u01/ORCL/ORCL_testexp.dp"
ORA-17503: ksfdopn:4 Failed to open file /u01/ORCL/ORCL_testexp.dp
ORA-17500: ODM err:File does not exist
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPW$WORKER", line 11014
----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name

Relevant MOS Documents

RMAN Backup Fail to NFS Shares From a Windows Server When DNFS is Enabled (Doc ID 2171297.1)
Datapump Dump File Permission In DNFS Environment (Doc ID 2049012.1)

Solution

Change the value of the following registry key (on the Windows Server providing NFS) to 0 and restart Server for NFS:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerForNfs\CurrentVersion\Exports\0\RestrictChown = 0 (DWORD)

Workaround

You could also disable Direct NFS:
set ORACLE environment.
cd $ORACLE_HOME/rdbms/lib/
make -f ins_rdbms.mk dnfs_off

— restart the instance

Linux – tcpdump capture network packets

tcpdump

tcpdump is a Linux program that can be used to capture network traffic to and from a Linux server and it’s clients.

It is well-docmented and needs no further description. This post just describes a particular, restricted, way of using it to capture packets between a specific client computer and the server, and to send the output to a file which can subsequently be read by the same program.

 

From specific client (a laptop = host 198.168.1.90)
---------------------------------------------------

-- capture the packets:
-i = on interface bond0
host = from client 198.168.1.90
-A = ASCII
-s = capture size 0 (65535 bytes by default)

tcpdump -i bond0 host 198.168.1.90 -A -s0 -w /tmp/rayfox.pcap

-- read pcap file and output to text file
tcpdump -A -r /tmp/rayfox.pcap > /tmp/rayfox.txt

(File can also be read using Wireshark)

To get the date from the pcap file

[root@server1 tmp] tcpdump -tttt -qns 0 -A -r server1_capture.pcap

Capture on a Specific Interface

# Capture on a specific interface (NIC or bond)
tcpdump -vXSs0 -i bond2 -w recv_mcast_java_1_1500.pcap

Read the tcpdump file, pipe to less for more control

# read the captured file
tcpdump -qns 0 -A -r recv_mcast_java_1_1500.pcap|less

Linux – Run remote Powershell from Nagios – nrpe_check

I experienced a strange problem when calling Powershell from nagios to
check failover cluster status.

Note – using old NRPE_NT nagios agent – no problem with NSClient++.

The Get-Cluster cmdlet failed each time the script was executed.
I thought this was related to the fact that this cmdlet requires elevated privieges,
but this was not the case. The issue occurred because NRPE_NT is running as a 32-bit program
and this calls 32-bit cmd, which calls 32-bit Powershell.

If you want to run 64-bit Powershell and use 64-bit Powershell commands,
from nagios, 64-bit powershell must be executed. This means that C:\WINDOWS\sysnative
is required.

nrpe.cfg on Windows
….
command[failover-cluster-check]=C:\WINDOWS\sysnative\WindowsPowerShell\v1.0\powershell.exe “& path\check_1.ps1”
….

if not using NSClient++
– the NRPE_NT service is running as a 32-bit executable
– it runs cmd as 32-bit
– 32-bit cmd calls 32-bit powershell unless C:\WINDOWS\sysnative\ is used

SQL Server/Linux – Install SQL Server 2017 on Linux

Microsoft document: Install SQL Server on Linux

[root@oralintest ~]# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server.repo

[root@oralintest ~]# yum install mssql-server
...
Installed:
mssql-server.x86_64 0:14.0.900.75-1

Complete!
[root@oralintest ~]# /opt/mssql/bin/mssql-conf setup
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=852741&clcid=0x409

The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409

Do you accept the license terms? [Yes/No]:Yes

Choose an edition of SQL Server:
  1) Evaluation (free, no production use rights, 180-day limit)
  2) Developer (free, no production use rights)
  3) Express (free)
  4) Web (PAID)
  5) Standard (PAID)
  6) Enterprise (PAID)
  7) I bought a license through a retail sales channel and have a product key to enter.

Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x409

Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.

Enter your edition(1-7): 1
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...

This is an evaluation version.  There are [90] days left in the evaluation period.
The licensing PID was successfully processed. The new edition is [Enterprise Evaluation Edition].
Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.
[root@oralintest ~]#

[root@oralintest ~]# curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo

[root@oralintest ~]# yum install -y mssql-tools unixODBC-devel
...
Installing : msodbcsql-13.1.9.1-1.x86_64                                                                                                                                 2/4
...
Installed:
  mssql-tools.x86_64 0:14.0.6.0-1                                                     unixODBC-devel.x86_64 0:2.3.1-11.el7

[root@oralintest ~]# export PATH="$PATH:/opt/mssql-tools/bin"
[root@oralintest ~]# firewall-cmd --zone=public --add-port=1433/tcp --permanent
success
[root@oralintest ~]# firewall-cmd --reload
success
[root@oralintest ~]# sqlcmd -S localhost -U SA
Password:
1> use master;
2> go
Changed database context to 'master'.
1> select @@version
2> go
                                                                                                                                                                               
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2017 (RC2) - 14.0.900.75 (X64)
        Jul 27 2017 08:53:49
        Copyright (C) 2017 Microsoft Corporation
        Enterprise Evaluation Edition (64-bit) on Linux (Oracle Linux Server 7.4)                                                                                              

(1 rows affected)