Wednesday, November 28, 2012

Argument list too long error

At times, you might get into a situation where you can't copy, move, remove or even list a huge number of files in a directory. When you attempt it, an error will be thrown saying "Argument list too long". This actually indicates that the OS has exceeded its Argument list limit. To know the Argument list limitation of your OS, run the following command "getconf ARG_MAX". It will show you the maximum number of arguments that can be passed to mv, cp, rm or ls command.

getconf ARG_MAX
   131072

To get rid of this problem, you must split your mv or cp command using wildcards.

Like instead of using "cp /folder1/* /folder2/ ",  we should use "cp /folder1/a* /folder2/; cp /folder1/b* /folder2/"
(or)
you can use 'for' loop construct as follows:

# for i in {a..z}; do cp /folder1/$i* /folder2/ ; done &
Please note in 'for' loop, for every cp command it executes, it creates a new process id.

Thursday, November 8, 2012

Oracle ASM commands

Some Oracle ASM admin commands for my records :

oracleasm status
oracleasm listdisks
oracleasm start
oracleasm stop
oracleasm querydisk
oracleasm querydisk /dev/sd*
ls -l /dev/oracleasm/disks
oracleasm listdisks | xargs oracleasm querydisk -p
oracleasm scandisks
oracleasm scandisks -p
oracleasm restart
oracleasm enable
oracleasm disable
oracleasm configure
oracleasm createdisk ASMDISKName /dev/sdx
/usr/sbin/asmtool -C -l /dev/oracleasm -n ASMDISKName -s /dev/sdx -a force=yes
oracleasm deletedisk