Scripting Help!

THIS MY SCRIPT:

export ORACLE_SID=ohkrm92
export ORAENV_ASK=NO
. oraenv

echo "
select * from dba_profiles
where resource_name in ('PASSWORD_LIFE_TIME','PASSWORD_GRACE_TIME')
order by profile;
" > t2.sql
echo "@t2.sql" | sqlplus -s erwin/nm21784

HERE IS THE OUTPUT:

PROFILE RESOURCE_NAME RESOURCE
------------------------------ -------------------------------- --------
LIMIT
----------------------------------------
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD
3

:My boss told me that the script should DISPLAY ERROR if FAILED_LOGIN_ATTEMPTS is greater than 3... HOW should I do THis?
PLease talk to me like im moron, im just a beginner... or please give a
sample code to do this.. thanx a lot...

ps: this is a follow question: thanv to those who answer,
specially dhruva...

i no longer have an oracle box to test this with but you can try:

check which column is the "DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD"
example that column is 4th column hence....

export ORACLE_SID=ohkrm92
export ORAENV_ASK=NO
. oraenv

echo "
select * from dba_profiles
where resource_name in ('PASSWORD_LIFE_TIME','PASSWORD_GRACE_TIME')
order by profile;
" > t2.sql
echo "@t2.sql" | sqlplus -s erwin/nm21784 | awk ' { if ($4>3) print $0 }'   

add the awk command to your existing script :cool:
thanks

thnx inquirer...

i have tried what you have though i get this error

syntax error The source line is 1.
The error context is
{ if >>> { <<<
awk: The statement cannot be correctly parsed.
The source line is 1.
awk: Quitting
The source line is 1.

IF you have still Suggestions that i should try pls inform me...

thanks a lot....

please note that the curly bracket {} is different with parenthesis ()

thanks

inquirer thnx for the help..

i have checked that, though this time
the script has no error, it also has no
output.. Their is no output on the screen...

What does this mean?
Is there any thing i can do?

thnx for the help, i really appreciate it...

make sure that the failed login attempts are in the 4th column otherwise change the value of the $4. if the values for the failed login attempts are located elsewhere change it.

also to make sure that the code is correct you can reverse the condition from $4>3 into $4<3 just to see if there are any values received.

hmmm... i saw a similar post to this. please next time avoid reposting the same question.

do you actually need all the data then segregate the failed login attempts? if you only need the failed login attempts you just change the query.

select * from dba_profiles
where resource_name in ('PASSWORD_LIFE_TIME','PASSWORD_GRACE_TIME')
and RESOURCE_NAME like '%FAILED_LOGIN_ATTEMPTS%'
and LIMIT > 3
order by profile;

otherwise:

export ORACLE_SID=ohkrm92
export ORAENV_ASK=NO
. oraenv

echo "
select * from dba_profiles
where resource_name in ('PASSWORD_LIFE_TIME','PASSWORD_GRACE_TIME')
order by profile;
" > t2.sql
echo "@t2.sql" | sqlplus -s erwin/nm21784 | grep "FAILED_LOGIN_ATTEMPTS" | awk ' { if ($4>3) print $0 }'   

hello'

i have get some output, but how do i DISPLAY a error Message if
FAILED_LOGIN_ATTEMPTS is greater than 3...... i have also tried
your suggestions,, it works though how can i display an error message...
thanx you...

this is the output...

PROFILE -------- RESOURCE_NAME -------- RESOURCE
DEFAULT -------- FAILED_LOGIN_ATTEMPTS -------- PASSWORD
MGR_ACCOUNT-------- FAILED_LOGIN_ATTEMPTS -------- PASSWORD

thnx for the advise...