Thursday, August 23, 2018

RHEL7 Extras

RHEL7 Extras

RHEL7 Extras
Introduction of DockerDocker is an open source project that automates the deployment of applications inside Linux Containers, and provides the capability to package an application with its run time dependencies into a container.
Device Hot-plug RemovedWhile RHEL 5/6 has device hot-plug support (udev rule that runs the ifup script for newly created devices), it has been disabled for RHEL 7 since it can result in race conditions when initializing newly found.
No 32 Bit ISO ImageNo 32 bit ISO for download. Red Hat Enterprise Linux 7 will only provide 64-bit ISO's, thus allowing only a 64-bit operating environment. RHEL 7 will not natively support 32-bit hardware.
"MemAvailable" Added to /proc/meminfo 
A new entry to the /proc/meminfo file has been introduced to provide the MemAvailable field. MemAvailable provides an estimate of how much memory is available for starting new applications, without swapping. However, unlike the data provided by the Cache or Free fields, MemAvailable takes into account page cache and also that not all reclaimable memory slabs will be reclaimable due to items being in use.
New Ruby and Python VersionsRed Hat Enterprise Linux 7 provides the latest Ruby version, 2.0.0 and Python 2.7.5.
OpenJDK7 Made DefaultRed Hat Enterprise Linux 7 features OpenJDK7 as the default Java Development Kit (JDK) and Java 7 as the default Java version.
More Powerful NetworkManager
NetworkManager has been significantly enhanced to configure and monitor all the networking features for enterprise class servers and for desktop applications.

For the enterprise data centers, NetworkManager can be used for tasks such as basic networking configuration, network teaming, configuring virtual LANs, bridges, bonds, IPv6, VPNs, assigning interfaces to firewall zones, and others. For desktop servers it can manage wired and wireless networks and VPNs.
Support for 40 Gigabit NICs
Red Hat Enterprise Linux 7 supports 40 Gigabit network interface controllers (NICs) from multiple hardware partners. This provides support for 40 Gigabit Ethernet link speeds enabling faster network communication for applications and systems. Note that the ethtool utility will report interface link speeds up to 40Gb data rates.
No RHN ClassicRHN Classic is not supported in RHEL7. Older versions supported different subscription management methods. Red Hat Subscription Management is the only one used by RHEL 7.
OpenSSH - Multiple Required Authentications
Red Hat Enterprise Linux 7 supports multiple required authentications in SSH protocol version 2 using the AuthenticationMethods option. This option lists one or more comma-separated lists of authentication method names. Successful completion of all the methods in any list is required for authentication to complete.
Minimum Disk Space for Installation of RHEL7Red Hat Enterprise Linux 7 now requires at least 1 GB of disk space to install. However, Red Hat recommends a minimum of 5 GB of disk space for all supported architectures.
Implementation of tmpfs file systemRed Hat Enterprise Linux 7 offers the ability to use /tmp as a mount point for a temporary file storage system (tmpfs).

When enabled, this temporary storage appears as a mounted file system, but stores its content in volatile memory instead of on a persistent storage device. No files in /tmp are stored on the hard drive except when memory is low, in which case swap space is used. This means that the contents of /tmp are not persisted across a reboot.
In-place upgrade, now supportedNow, in-place upgrade from RHEL 6 is supported to RHEL 7 (Reference: https://access.redhat.com/solutions/637583).
Dracut used by AnacondaAnaconda would use "Dracut" to configure disks during installation (GUI) in RHEL 7.x which was earlier performed by utility called "disk druid".
New Logging FrameworkRed Hat Enterprise Linux 7 introduces a new logging daemon, journald, as part of the move to systemd.

journald captures the following types of message for all services:

- syslog messages
- kernel messages
- initial RAM disk and early boot messages
- messages sent to standard output and standard error output.
Samba 4 fully supportedRHEL 7 provides Samba 4, bundle of utilities, features, python bindings which allows communications using SMB1, SMB2 & SMB3 protocols. In RHEL 6.4 and later versions, Samba 4 was provided as Technology Preview.
Non-root user process limitationsIn RHEL 6.x, non-root users were resitricted to a total of 1024 processes per PAM session. In RHEL 7.x, this has been increased to 4096 processes per PAM session by default.
PCS replaces luciThe high availability management agent "luci" has been replaced by "pcs" in RHEL 7. Now, "pcs" can controls pacemaker-based clusters only, not rgmanager-based cluster setups.
Default IO Scheduler"deadline" is now the default IO scheduler in RHEL 7.x (except SATA drives) which was earlier "cfq" by default.
Changes to mount optionsUnlike ext3 and ext4, the XFS file system enables the user_xattr and acl mount options by default. Ext3 and ext4 file systems do not enable these attributes by default.
Another Interesting blog on RHEL 7: http://www.certdepot.net/rhel7-quick-recipes/

The major differences between RHEL 7 and 6


The major differences between RHEL 7 and 6

FeaturesRHEL 7RHEL 6
Default File SystemXFSEXT4
Kernel Version3.10.x-x kernel2.6.x-x Kernel
Kernel Code NameMaipoSantiago
General Availability Date of First Major Release2014-06-09 (Kernel Version 3.10.0-123)2010-11-09 (Kernel Version 2.6.32-71)
First Processsystemd (process ID 1)init (process ID 1)
Runlevelrunlevels are called as "targets" as shown below:

runlevel0.target -> poweroff.target
runlevel1.target -> rescue.target
runlevel2.target -> multi-user.target
runlevel3.target -> multi-user.target
runlevel4.target -> multi-user.target
runlevel5.target -> graphical.target
runlevel6.target -> reboot.target

/etc/systemd/system/default.target (this by default is linked to the multi-user target)
Traditional runlevels defined :

runlevel 0
runlevel 1
runlevel 2
runlevel 3
runlevel 4
runlevel 5
runlevel 6

and the default runlevel would be defined in "/etc/inittab" file.
Host Name Change
In Red Hat Enterprise Linux 7, as part of the move to the new init system (systemd), the hostname variable is defined in "/etc/hostname" file.
In Red Hat Enterprise Linux 6, the hostname variable was defined in the "/etc/sysconfig/network" configuration file.
Change In UID AllocationBy default a new user created would get UIDs assigned starting from 1000.

This could be changed in "/etc/login.defs" file if required.
Default UID assigned to users would start from 500.


This could be changed in "/etc/login.defs" file if required.
Max Supported File Size
Maximum (individual) file size = 500TB
Maximum filesystem size = 500TB

(This maximum file size is only on 64-bit machines. Red Hat Enterprise Linux does not support XFS on 32-bit machines.)
Maximum (individual) file size = 16TB
Maximum filesystem size = 16TB

(This maximum file size is based on a 64-bit machine. On a 32-bit machine, the maximum files size is 8TB.)
File System Check
"xfs_repair"

XFS does not run a file system check at boot time.
"e2fsck"

File system check would gets executed at boot time.
Differences Between xfs_repair & e2fsck
"xfs_repair"

- Inode and inode blockmap (addressing) checks.
- Inode allocation map checks.
- Inode size checks.
- Directory checks.
- Pathname checks.
- Link count checks.
- Freemap checks.
- Super block checks.

"e2fsck"

- Inode, block, and size checks.

- Directory structure checks.

- Directory connectivity checks.

- Reference count checks.

- Group summary info checks.
Difference Between xfs_growfs & resize2fs"xfs_growfs"

xfs_growfs takes mount point as arguments.
"resize2fs"

resize2fs takes logical volume name as arguments.
Change In File System Structure/bin, /sbin, /lib, and /lib64 are now nested under /usr./bin, /sbin, /lib, and /lib64 are usually under /
Boot Loader
GRUB 2
Supports GPT, additional firmware types, including BIOS, EFI and OpenFirmware. Ability to boot on various file systems (xfs, ext4, ntfs, hfs+, raid, etc)
GRUB 0.97
KDUMPRHEL7 supports kdump on large memory based systems up to 3 TBKdump doesn’t work properly with large RAM based systems.
System & Service Manager"Systemd"

systemd is a system and service manager for Linux, and replaces SysV and Upstart used in previous releases of Red Hat Enterprise Linux. systemd is compatible with SysV and Linux Standard Base init scripts.
Upstart
Enable/Start ServiceFor RHEL 7, the systemctl command replaces service and chkconfig.

- Start Service : "systemctl start nfs-server.service".

- Enable Service : To enable the service (example: nfs service ) to start automatically on boot : "systemctl enable nfs-server.service".

Although one can still use the service and chkconfig commands to start/stop and enable/disable services, respectively, they
are not 100% compatible with the RHEL 7 systemctl command 
Using "service" command and "chkconfig" commands.

- Start Service : "service start nfs" OR "/etc/init.d/nfs start"

- Enable Service : To start with specific runlevel : "chkconfig --level 3 5 nfs on"
Default Firewall
"Firewalld (Dynamic Firewall)"

The built-in configuration is located under the "/usr/lib/firewalld" directory. The configuration that you can customize is under the "/etc/firewalld" directory. It is not possible to use Firewalld and Iptables at the same time. But it is still possible to disable Firewalld and use Iptables as before.
Iptables
Network Bonding"Team Driver"

-/etc/sysconfig/network-scripts/ifcfg-team0
- DEVICE=”team0”
- DEVICETYPE=”Team”
"Bonding"

-/etc/sysconfig/network-scripts/ifcfg-bond0
- DEVICE=”bond0”
Network Time SynchronizationUsing Chrony suite (faster time sync compared with ntpd)Using ntpd
NFSNFS4.1
NFSv2 is no longer supported. Red Hat Enterprise Linux 7 supports NFSv3, NFSv4.0, and NVSv4.1 clients.
NFS4
Cluster Resource ManagerPacemakerRgmanager
Load Balancer TechnologyKeepalived and HAProxyPiranha
Desktop/GUI InterfaceGNOME3 and KDE 4.10GNOME2
Default DatabaseMariaDB is the default implementation of MySQL in Red Hat Enterprise Linux 7MySQL
Managing Temporary FilesRHEL 7 uses systemd-tmpfiles (more structured, and configurable, method to manage tmp files and directories).Using "tmpwatch"



Wednesday, August 22, 2018

How to cleanup orphaned datapump jobs from DBA_DATAPUMP_JOBS

How to cleanup orphaned datapump jobs from DBA_DATAPUMP_JOBS

sqlplus / as sysdba
SET lines 140
COL owner_name FORMAT a10;
COL job_name FORMAT a20
COL state FORMAT a12 
COL operation LIKE owner_name
COL job_mode LIKE owner_name
SELECT owner_name, job_name, operation, job_mode,
state, attached_sessions
FROM dba_datapump_jobs;
OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE ATTACHED_SESSIONS
---------- -------------------- ---------- ---------- ------------ -----------------
ANAR SYS_EXPORT_SCHEMA_01 EXPORT SCHEMA NOT RUNNING 0
ANAR SYS_EXPORT_SCHEMA_02 EXPORT SCHEMA NOT RUNNING 0

Step 02: Check the state field. For orphaned jobs the state will be NOT RUNNING. So from the output we can say both are orphaned jobs.

Step 03: Drop the master table.

DROP TABLE ANAR.SYS_EXPORT_SCHEMA_01;
DROP TABLE ANAR.SYS_EXPORT_SCHEMA_02;

Step 04: Check for existing data pump jobs by query issued in step 01. If objects are in recyclebin bin then purge the objects from the recyclebin.

SQL> SELECT owner_name, job_name, operation, job_mode,
 state, attached_sessions
 FROM dba_datapump_jobs;
OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE ATTACHED_SESSIONS
---------- -------------------- ---------- ---------- ------------ -----------------
ANAR BIN$xMNQdACzQ6yl22kj EXPORT SCHEMA NOT RUNNING 0
 9U0B8A==$0
ANAR BIN$BmUy4r5MSX+ojxFk EXPORT SCHEMA NOT RUNNING 0
 sw8ocg==$0

SQL> PURGE TABLE ANAR.SYS_EXPORT_SCHEMA_01;
Table purged.

SQL> PURGE TABLE ANAR.SYS_EXPORT_SCHEMA_02;
Table purged.

Check if there is any orphaned jobs again.

SQL> SELECT owner_name, job_name, operation, job_mode,
state, attached_sessions
FROM dba_datapump_jobs;
no rows selected

Step 05: In this stage you did not get any orphaned jobs if the jobs have a master table. If there are still jobs listed in dba_datapump_jobs do cleanup process like below.

SET serveroutput on
SET lines 100
DECLARE
 job1 NUMBER;
BEGIN
 job1 := DBMS_DATAPUMP.ATTACH('SYS_EXPORT_SCHEMA_01','ANAR');
 DBMS_DATAPUMP.STOP_JOB (job1);
END;
/
DECLARE
 job2 NUMBER;
BEGIN
 job2 := DBMS_DATAPUMP.ATTACH('SYS_EXPORT_SCHEMA_02','ANAR');
 DBMS_DATAPUMP.STOP_JOB (job2);
END;
/

Friday, August 10, 2018

Removing Shared Memory

Removing Shared Memory

Sometimes after an instance crash you may have to remove Oracle's shared memory segments manually.
To see all shared memory segments that are allocated on the system, execute:
$ ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x8f6e2129 98305      oracle     600        77694523   0
0x2f629238 65536      oracle     640        2736783360 35
0x00000000 32768      oracle     640        2736783360 0           dest

In this example you can see that three shared memory segments have been allocated. The output also shows that shmid 32768 is an abandoned shared memory segment from a past ungraceful Oracle shutdown. Status "dest" means that this memory segment is marked to be destroyed. To find out more about this shared memory segment you can run:
$ ipcs -m -i 32768
Shared memory Segment shmid=32768
uid=500 gid=501 cuid=500 cgid=501
mode=0640 access_perms=0640
bytes=2736783360 lpid=3688 cpid=3652 nattch=0
att_time=Sat Oct 29 13:36:52 2005
det_time=Sat Oct 29 13:36:52 2005
change_time=Sat Oct 29 11:21:06 2005

To remove the shared memory segment, you could copy and paste shmid and execute:
$ ipcrm shm 32768

Another approach to remove shared memory is to use Oracle's sysresv utility. Here are a few self explanatory examples on how to use sysresv:
Checking Oracle's IPC resources:
$ sysresv

IPC Resources for ORACLE_SID "orcl" :
Shared Memory
ID              KEY
No shared memory segments used
Semaphores:
ID              KEY
No semaphore resources used
Oracle Instance not alive for sid "orcl"
$

Instance is up and running:
 
$ sysresv -i

IPC Resources for ORACLE_SID "orcl" :
Shared Memory:
ID              KEY
2818058         0xdc70f4e4
Semaphores:
ID              KEY
688128          0xb11a5934
Oracle Instance alive for sid "orcl"
SYSRESV-005: Warning
Instance maybe alive - aborting remove for sid "orcl"
$

Instance has crashed and resources were not released:
$ sysresv -i

IPC Resources for ORACLE_SID "orcl" :
Shared Memory:
ID              KEY
32768           0xdc70f4e4
Semaphores:
ID              KEY
98304           0xb11a5934
Oracle Instance not alive for sid "orcl"
Remove ipc resources for sid "orcl" (y/n)?y
Done removing ipc resources for sid "orcl"
$

  How to Change Instance Type & Security Group of EC2 in AWS By David Taylor Updated April 29, 2023 EC2 stands for Elastic Compute Cloud...