Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script message

Status
Not open for further replies.

230173

MIS
Jun 22, 2001
208
SG
hi,

I'm trying to implement a backup script from a book called "oracle 8i backup and recovery by Rama velpuri"
But i get the following error:

$ dbbackup spcbase
/opt/app/oracle/admin/backup/backup/dbbackup_begin spcbase hot >> /opt/app/oracle/admin/backup/db_admin/spcbase/log/backup_020409.log 2>>
/opt/app/oracle/admin/backup/db_admin/spcbase/log/backup_020409.err


Usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwy] [-p[parasep]] -e pattern_list...
[-f pattern_file...] [file...]
Usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwy] [-p[parasep]] [-e pattern_list...]
-f pattern_file... [file...]
Usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwy] [-p[parasep]] pattern_list [file...]
dbbackup[191]: Export terminated successfully: not found.
Usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwy] [-p[parasep]] -e pattern_list...
[-f pattern_file...] [file...]
Usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwy] [-p[parasep]] [-e pattern_list...]
-f pattern_file... [file...]
Usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwy] [-p[parasep]] pattern_list [file...]
dbbackup[193]: Export terminated successfully: not found.

I've looked in the script and i see nothing wrong.
He complaints on a grep statement.
This is the first statement with grep:

STATUS=`ps -fu oracle | grep "ora_[a-z]*_${DBNAME}" `

But if i do this on an prompt mline this works fine.

Help!!!

PS: what's "$?" ?
Does this mean any variable?

If you don't have enough info let me know and i'll send the whole script.


thnx
 
$DBNAME is probably the value of your $ORACLE_SID. Assign this somewhere in the script and it should work. Good luck.
 
Another thought, as $DBNAME should work - are you running this as user Oracle? Incidentally $? is the exit value of a command. It's usually 0 if the command completes sucessfully, non-zero if not. HTH.
 
Looking at this again, it appears that grep is failing in several places, and not necessarily in the place you have posted. Can you do a grep on grep (!) in the file and post the output, please? Thanks.
 
I tried to assign the value of DB_NAME to the ORACLE_SID but i get the same error.
 
Are you absolutely, 100% sure that you've included the "'s and `'s in the statement above in the script itself?
 
yep i copied it from the script so it can't be wrong.
 
Curiouser and curiouser. The output from the STATUS line above on one of our test machines is:

oracle 381 1 0 Feb 25 ? 0:11 ora_pmon_TEST
oracle 385 1 0 Feb 25 ? 1:57 ora_lgwr_TEST
oracle 387 1 0 Feb 25 ? 17:11 ora_ckpt_TEST
oracle 389 1 0 Feb 25 ? 17:36 ora_smon_TEST
oracle 391 1 0 Feb 25 ? 0:01 ora_reco_TEST

whilst that for the PROCS line posted in the Unix Scripting Forum is:

7714
12419
381
383
385
387
389
391
393
395
397
7741
7739
7762
29607
1051
29592
7713
7760
29575
29704

Both of these seem to be doing what's required. I should add that the box I'm doing this on is Solaris 7. If it's not too long, can you post the whole script and let us know who you're running it as (presumably Oracle?). Cheers - I'd like to get to the bottom of this!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top