Monday, June 26, 2006

Hi,

In this part i am going to discuss the issues i faced in UNIX.

These issues will be helpful only for a beginner.

Issue One

1. I want to count the number of files in a direcotry.
2. I had given ls -l wc -l
3. Then the issue starts ie. ls -l will show an extra record total.
4. I want to avoid the total.


Solution One

ls -l grep -v "total" wc -l

Solution Two

ls -l grep ^- wc -l

Solution Three

ls -l wc -l awk {'print $1-1'}



Issue Two


While issuing the ps -ef command it is also showing the ps -ef command which i issued to list the process


Solution

ps -ef grep smon grep -v "grep"


I will be posting new issues faced in future.1

Regards
Salih KM

Thursday, June 22, 2006

Hi All,

In this i will show how to invoke fetch values from database inside a shell script.

Example:

var1=`sqlplus -silent "/as sysdba"<<"EOF1"
clear screen
column "DATABASE NAME" format a15
column "MODE OF OPERATION" format a20
column "ARCHIVE\NOARCHIVE" format a20
select name "DATABASE NAME", open_mode "MODE OF OPERATION",log_mode "ARCHIVE\NOARCHIVE" from v\$database;
exit;
"EOF1"`
IFS="/n"
echo $var1


The above shell script will shows the name, open mode and log mode of a database.

Regards
SALIH KM





Wednesday, June 21, 2006

Hi All,

I will be posting unix commands useful for Oracle DBAs.

Regards
SALIH KM