Wednesday, July 16, 2014

Stop gvfsd-metadata Using 100% CPU and Disk High I/O

If your Linux system is slowly grinding to a halt, and you manage to pull up the System Monitor and see that gvfsd-metadata is using 100% of the CPU, here’s how to correct it. In a terminal run the following 2 commands:
rm -rf ~/.local/share/gvfs-metadata

pkill gvfsd-metadata
Your system should now be back to normal.

Friday, May 30, 2014

The best command to create raw datafile used by Oracle database

Oracle recommends creating new datafiles on devices with zero offset. The command "/usr/sbin/mklv -y LVname -T O -w n -s n -r n VGname NumPPs" can be used. Please contact Oracle customer support for more details.

Friday, May 9, 2014

AIX make filesystem

List PV (Disk)
bash-3.2# lspv
hdisk0          0056b0de849951c7                    rootvg          active
hdisk1          0056b0dee1558f91                    rootvg          active
hdisk5          0056b0de8d3ad7c5                    datavg2         active
hdisk6          0056b0de8d3b2189                    datavg          active
use smit vg to make new vg View vg information
bash-3.2# lsvg datavg   
VOLUME GROUP:       datavg                   VG IDENTIFIER:  0056b0de00004c0000000145e01e8ee2
VG STATE:           active                   PP SIZE:        1024 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      1673 (1713152 megabytes)
MAX LVs:            256                      FREE PPs:       1172 (1200128 megabytes)
LVs:                2                        USED PPs:       501 (513024 megabytes)
OPEN LVs:           0                        QUORUM:         2 (Enabled)
TOTAL PVs:          1                        VG DESCRIPTORS: 2
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         1                        AUTO ON:        yes
MAX PPs per VG:     32512                                     
MAX PPs per PV:     2032                     MAX PVs:        16
LTG size (Dynamic): 1024 kilobyte(s)         AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable 
view vg's lv
bash-3.2# lsvg -l datavg
datavg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
test1               jfs2       500     500     1    closed/syncd  /test1
loglv00             jfs2log    1       1       1    closed/syncd  N/A
use smitty mklv make a new LV

use smitty manfs make a filesystem, then mount

Thursday, April 24, 2014

Use Click Package to Write Beautiful Command Application with Python

click is a Python package for creating beautiful command line interfaces in a composable way with as little amount of code as necessary. It’s the “Command Line Interface Creation Kit”. It’s highly configurable but comes with good defaults out of the box.

Install
pip install click 
Hello world Sample
import click

@click.command()
@click.option('--count', default=1, help='number of greetings')
@click.option('--name', prompt='Your name',
              help='the person to greet', required=True)
def hello(count, name):
    for x in range(count):
        print('Hello %s!' % name)

if __name__ == '__main__':
    hello()
You can find quickstart and full docs here.

Monday, March 31, 2014

How to trace a user login in oracle database

trace oracle user login
alter session set tracefile_identifier='login_test';
alter session set events '10046 trace name context forever ,level 12'

conn fucker/larry

alter session set events '10046 trace name context off' ;

Thursday, March 6, 2014

Auto Kill Bloking Session on Oracle Database with SQL

DECLARE   
  CURSOR c1 IS select process,sid,serial#, blocking_session from v$session where blocking_session is not null;  
  i NUMBER:= 0;
BEGIN
  FOR e_rec IN c1 LOOP
  i:= i+1;
    EXECUTE immediate 'ALTER SYSTEM KILL SESSION ' ||''''|| e_rec.sid ||','|| e_rec.serial# ||''' ';
  END LOOP;
END;
/