Showing posts with label Commands. Show all posts
Showing posts with label Commands. Show all posts

Monday, March 29, 2010

nohup

When a user logs out of his session, the shell is killed. Hence any background processes started in the shell also gets killed. To avoid this and make background processes run even when the user logs out use nohup command.

When nohup (no hangup) command is prefixed with any command, the command continue to run even when the user who run that command logs out.

$ nohup compress comp.dmp &
$


The & indicates that the command runs in the background.

When you log out the session the parent is killed, in such situation the kernel assigns the orphan (child) to the system's init process (PID 1) the parent of all shells. Hence when the user logs out, init takes over the parentage of any process run with nohup.

If you run more than one command in a pipeline, then use the nohup command at the beginning of each command in the pipeline,

$ nohup grep 'ORA-' alert_prod.log & nohup sort &

Thanks

at jobs

Schedule jobs using 'at' command

at command is used to schedule jobs. It takes a series of commands as input and execute it at a particular time in the future. It differs from cron which is used for recurring executions (every hour, every day etc).

at offers the following keywords to be used for scheduling, now, noon, midnight, today and tomorrow. It also accepts the + operator. You can use hours, days, weeks, months and years keywords along with the + operator. For eg,

at 13
at 2.15pm
at midnight
at now + 1 day
at 3:30 January 26, 1986

To schedule job,

$ at 21:29 /export/rmanbkp.sh
$ at 13:15
at> /data_back/expprod.sh
ctrl-d
$

To view the scheduled jobs,

$ at -l
oracle.1266893940.a Mon Feb 22 21:29:00 GMT 2010
oracle.1269888300.a Mon Mar 29 13:15:00 GMT 2010

To remove a job

$ at -r oracle.1269888300.a

Note: There is no way you can find out the name of the program scheduled to run. Only job number is dislayed.

Thanks

Sunday, September 13, 2009

Compress Files

To compress and uncompress the files in unix you can use the following commands.

1. Compress and uncompress
2. gzip and gunzip
3. bzip2 and bunzip2

Compress and uncompress

The output file has the extension as .Z

Example:

$ compress -v test.txt
test.txt: Compression: 59.74% This file is replaced with test.txt.Z

To compress file to another directory
$ compress -c proddmp.dmp > /data_back/proddmp.dmp.Z

$ uncompress test.txt.Z
$

To uncompress to another directory
$ uncompress -c proddmp.dmp.Z > /oradump/proddmp.dmp

gzip and gunzip

The output file has the extension as .gz

Example:

$ gzip test.txt
test.txt.gz

$ gunzip test.txt.gz

note: You can use gzip -d instead of gunzip. Both are same.

To view the compressed text file without decompressing use gzcat or gzmore if available in the platform.

$ gzcat test.txt.gz
$ gzmore test.txt.gz

To compress the folder

$ gzip -r /oracle/test
$ gunzip -r /oracle/test

bzip2 and bunzip2

The output file has the extension .bz2 The usage of bzip2 and bunzip2 is similar to gzip and gunzip.

Thanks

Tuesday, May 19, 2009

lslv, lspv, lsvg

Some important commands

To display all the disks installed on an AIX machine

$ lsdev -Cc disk

To see what volume groups the disks belong to

$ lspv

This lists all the physical disks available on the system with their pvids assigned to it with the Volume Group name associated with this disk. "None" if NOT part of LVM.

To list information about the disks that belongs to the volume group.

$ lsvg -p

To list which logical volumes occupy the volume group

$ lsvg –l

To list all available volume groups

$ lsvg

Logical Volume Commands

To list all logical volumes under a volume group

$ lslv -l

To list the Logical Volume details with partition size , characteristics of volume and mirror copies.

$ lslv

To list the Physical Volume where the LV is located.

$ lslv -l

Note: vgname - volume group name and lv - logical volume

Thanks

Monday, May 4, 2009

Size of Real Memory

To find the amount of RAM in your machine,

AIX

# lsattr -El sys0 -a realmem

Also, the first line of vmstat report shows the no. of CPUs and Memory installed.

Thanks.

Swap Space Usage

To report information on Swap Space usage use the following command,

AIX

$ lsps -a

Solaris

$ swap -l

HP

$ swapinfo -m

Linux

$ swapon -s

Thanks

Followers

Powered By Blogger
 

RAC Database Administration. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com