Friday, January 17, 2014

ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

Find the blocking session port, and then kill the process listening on that port.
SELECT O.OBJECT_NAME, S.SID, S.SERIAL#, P.SPID, S.PROGRAM,S.USERNAME,
S.MACHINE,S.PORT , S.LOGON_TIME,SQ.SQL_FULLTEXT 
FROM V$LOCKED_OBJECT L, DBA_OBJECTS O, V$SESSION S, 
V$PROCESS P, V$SQL SQ 
WHERE L.OBJECT_ID = O.OBJECT_ID 
AND L.SESSION_ID = S.SID AND S.PADDR = P.ADDR 
AND S.SQL_ADDRESS = SQ.ADDRESS;
[root@dwh1 ~]# netstat -ap | grep 22735
tcp        1      0 dwh1.prod.mbqt:ncube-lm     dwh1.prod.mbqt:22735        CLOSE_WAIT  19050/oracledwhmbqt 

[root@dwh1 ~]# kill -9 19050

VirtualBox: force guest IP address

> sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=08:00:27:B5:56:05
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=static
#IPADDR=192.168.2.8
IPADDR=192.168.1.101
NETMASK=255.255.255.0
TYPE=Ethernet
DNS1=8.8.8.8
DNS2=8.8.4.4
Then restart network
> sudo service network restart

Wednesday, January 15, 2014

/usr/bin/perl^M: bad interpreter

One perlish way to fix this:
>./fm_test.pl
-bash: ./fm_test.pl: /usr/bin/perl^M: bad interpreter: No such file or directory
is:
> perl -pi -e 'tr[\r][]d' ./fm_test.pl
Another way is to use dos2unix

Wednesday, January 8, 2014

Compute files size

find . -name "*" -ls | awk '{total += $7} END {print total}'

Tuesday, January 7, 2014

Vim backspace issue

If backspace leaves ^? in vim, this is most probably because of "stty erase ^H" being present either in your .bashrc or .bash_profile.
Remove it and Vim will be happy with backspace.