device ethX does not seem to be present, delaying initialization..

Problem :device ethX does not seem to be present, delaying initialization…

Solution: fix the problem by deleting the /etc/udev/rules.d/70-persistent-net.rules file and restarting server.

Step 1:Restart network daemon.

#Service network restart

Shutting down loopback interface:
Bringing up loopback interface:
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.

Step 2:

#rm -rf /etc/udev/rules.d/70-persistent-net.rules

Step 3:

#reboot

If your server is virtualbox;

Solution:

step 1:copy the mac address from the inside file “/etc/sysconfig/network-scripts/ifcfg-eth0” to the host to virtualbox–>Settings–>network–>Adapter 1–>advanced–>MAc address

step 2:

#service network reload

 

 

How to extend a LVM swap volume?

In this case, increase by 20G:

 

Summary of commands;

cat /etc/fstab | grep swap

swapoff /dev/system/swap

lvextend -L +20G /dev/system/swap

mkswap /dev/system/swap

swapon /dev/system/swap

free -g

 

Details of above commands are below;

sdevhana01:~ # free -g

total       used       free     shared    buffers     cached

Mem:          1009         10        999          0          0          0

-/+ buffers/cache:          9        999

Swap:           31          0         31

sdevhana01:~ # cat /etc/fstab | grep swap

/dev/system/swap     swap                 swap       defaults              0 0

sdevhana01:~ # swapoff /dev/system/swap

sdevhana01:~ # free -g

total       used       free     shared    buffers     cached

Mem:          1009         10        999          0          0          0

-/+ buffers/cache:          9        999

Swap:            0          0          0

sdevhana01:~ # vgs

VG     #PV #LV #SN Attr   VSize   VFree

  system   1   2   0 wz–n- 269.83g 35.83g

sdevhana01:~ # lvextend -L +20G /dev/system/swap

Extending logical volume swap to 52.00 GiB

Logical volume swap successfully resized

sdevhana01:~ # mkswap /dev/system/swap

mkswap: /dev/system/swap: warning: don’t erase bootbits sectors

on whole disk. Use -f to force.

Setting up swapspace version 1, size = 54525948 KiB

no label, UUID=14a35aeb-6e1a-4848-a7ca-eb315e905d31

sdevhana01:~ # swapon /dev/system/swap

sdevhana01:~ # free -g

total       used       free     shared    buffers     cached

Mem:          1009         10        999          0          0          0

-/+ buffers/cache:          9        999

Swap:           51          0         51

sdevhana01:~ #

Find and replace text within a file using commands on linux

Replace a String in Multiple Files in Linux Using Grep and Sed (Find and replace text within a file using commands.)

OS:Linux,Unix

Use grep and sed commands

QUESTION:

How to replace IP adress on dns server(bind) in multiple files in Linux?

SOLUTION:

syntax(format):

grep -rl old_ip /var/named/ | xargs sed -i 's/old_ip/new_ip/g'

Example:

grep -rl ‘80.70.65.12’ ./ | xargs sed -i ‘s/80.70.65.12/55.45.34.2/g’

OR

grep -rl ‘80.70.65.12’  /var/named/ | xargs sed -i ‘s/80.70.65.12/55.45.34.2/g’

I replaced 80.70.65.12 to 55.45.34.2 in multiple zone files.

 

 

How to disable SSH timeout on Centos 7?

Apply on:Redhat 7/Centos 7

PROBLEM:

Open SSH Server connection drops out after few or N minutes of inactivity on vmware.

How to prevent ssh from disconnecting if it’s been idle for a while?

After few minutes ssh disconnect on redhat 7/centos 7.

[root@server1 ~]# tail -f /var/log/secure

Nov 15 13:39:02 server1 polkitd[4245]: Unregistered Authentication Agent for unix-process:5920:869643 (system bus name :1.194, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)

SOLUTION:

Add following on  /etc/ssh/sshd_config and /etc/ssh/ssh_conf file restart the sshd service.

1.vi /etc/ssh/sshd_config       #after 3600 second disconnect

TCPKeepAlive no
ClientAliveInterval 30
ClientAliveCountMax 3600

2. systemctl restart sshd.service

3.vi /etc/ssh/ssh_config          #applying the setting to every user in the system.

ServerAliveInterval 30

OR

4. vi  ~/.ssh/config                     #applying the setting to single user in the system.

ServerAliveInterval 30

 

 

 

 

 

diskgroup is incomplete OR Database Will Not Mount: ORA-15025, ORA-27041, ‘Permission denied’, ORA-15081

RMAN> RESTORE CONTROLFILE FROM ‘/home/oracle/restore/3jrjomjq_1_1.ctl’;

Starting restore at 31-OCT-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=7 device type=DISK

channel ORA_DISK_1: restoring control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 10/31/2016 17:56:31
ORA-19870: error while restoring backup piece /home/oracle/restore/3jrjomjq_1_1.ctl
ORA-19504: failed to create file “+DATAC1”
ORA-17502: ksfdcre:4 Failed to create file +DATAC1
ORA-15001: diskgroup “DATAC1” does not exist or is not mounted
ORA-15040: diskgroup is incomplete

********alert_db1.log***********************

ALTER DATABASE MOUNT
NOTE: Loaded library: System
ORA-15025: could not open disk ‘/dev/oracleasm/disks/DATA01’
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
SUCCESS: diskgroup DATA was mounted
NOTE: dependency between database ORCL and diskgroup resource ora.DATA.dg is established
ORA-15025: could not open disk ‘/dev/oracleasm/disks/FLASH01’
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
SUCCESS: diskgroup FLASH was mounted
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: ‘+FLASH/orcl/controlfile/current.256.711293457’
ORA-15081: failed to submit an I/O operation to a disk
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: ‘+DATA/orcl/controlfile/current.256.711293457’
ORA-15081: failed to submit an I/O operation to a disk
NOTE: dependency between database ORCL and diskgroup resource ora.FLASH.dg is established.
Checker run found 2 new persistent data failures
ORA-205 signalled during: ALTER DATABASE MOUNT…
SUCCESS: diskgroup DATA was dismounted
SUCCESS: diskgroup FLASH was dismounted

********SOLUTION****************************************************

APPLIES TO:Oracle Database – Enterprise Edition – Version 11.2.0.1 and later

To correct the proper group for the Database oracle executable, do:
As the <asm_home sfw owner>:
$ cd <asm_home>/bin
$ ./setasmgidwrap o=<db_home>/bin/oracle

Now check that the primary group for the Database oracle executable is now asmadmin (not oinstall).

If done, restart the database.

Example:
[grid@exarestore bin]$ cd /u01/app/12.1.0.2/grid/bin
[grid@exarestore bin]$ pwd
/u01/app/12.1.0.2/grid/bin
[grid@exarestore bin]$ ./setasmgidwrap o=/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle
grid@exarestore bin]$ ls -lrt /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle
-rwsr-s–x. 1 oracle asmadmin 323762222 Oct 27 16:06 /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle
Now check that the primary group for the Database oracle executable is now asmadmin (not oinstall).

If done, restart the database.