grep all ORA errors except one ORA error


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users grep all ORA errors except one ORA error
# 1  
Old 11-05-2010
grep all ORA errors except one ORA error

Hi - I am trying to grep all "ORA" errors in a log files.I have to grep all ORA errors except one error for example ORA-01653.How can exclude that error in "grep" command?

In following "grep" command I want to exclude "ORA-01653" error

Code:
grep -i ORA alert.log >>/tmp/ora_errors.txt

Thanks in advance.

M

Last edited by Scott; 11-05-2010 at 05:31 PM.. Reason: Added code tags
# 2  
Old 11-05-2010
Code:
grep -i ORA -v 'ORA-01653' alert.log >>/tmp/ora_errors.txt

# 3  
Old 11-05-2010
-i is for ignoring case. All Oracle errors are in upper case.

Code:
$ sed -n "/ORA-/{/01653/!p;}"

# 4  
Old 11-05-2010
Thanks for your prompt reply.
I tried both "grep" and "sed" command and "sed" is working fine.

When I tried "grep" command i got following error.
$grep -i ORA -v "ORA-01653" alert.log

grep: can't open -v
grep: can't open ORA-01653


Thanks,
-M
# 5  
Old 11-05-2010
Code:
grep ORA alert.log | grep -v ORA-01653

Code:
[ctsgnb@shell ~]$ cat alert.log
blablablablabalbala
ORA-01555 blablablabla
blablablablabalbala
ORA-01653 blablablabla
blablablablabalbala
ORA-01234 blablablabla
ORA-09430215 blablablabla
ORA-01653 blablablabla
blablablablabalbala
blablablablabalbala
blablablablabalbala
ORA-09415 blablablabla
[ctsgnb@shell ~]$ grep ORA alert.log|grep -v ORA-01653
ORA-01555 blablablabla
ORA-01234 blablablabla
ORA-09430215 blablablabla
ORA-09415 blablablabla
[ctsgnb@shell ~]$

# 6  
Old 11-12-2010
Or you could use a Perl regular expression with negative lookahead assertion, as shown below with ctsgnb's test file -

Code:
$
$
$ cat alert.log
blablablablabalbala
ORA-01555 blablablabla
blablablablabalbala
ORA-01653 blablablabla
blablablablabalbala
ORA-01234 blablablabla
ORA-09430215 blablablabla
ORA-01653 blablablabla
blablablablabalbala
blablablablabalbala
blablablablabalbala
ORA-09415 blablablabla
$
$
$ perl -lne '/^ORA-(?!01653)/ && print' alert.log
ORA-01555 blablablabla
ORA-01234 blablablabla
ORA-09430215 blablablabla
ORA-09415 blablablabla
$
$

tyler_durden
# 7  
Old 11-12-2010
And to complete the list the inevitable awk Smilie
Code:
awk '/ORA/&&!/-01653/' alert.log

and a sed variation:
Code:
sed '/-01653/d;/ORA/!d' alert.log

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Ora-27603:ora-27626:

Hi, User claim that job is running slow from their end. I DBA found in database the below errors in alert log file. ORA-27603: Cell storage I/O error, I/O failed on disk o/192.168.10.3/RECO_DM01_CD_01_drm01 at offset 13335789568 for data length 1048576 ORA-27626: Exadata error: 2201 (IO... (2 Replies)
Discussion started by: Maddy123
2 Replies

2. Shell Programming and Scripting

Check for “errors” or “ORA-”

I want to check for "errors" or "ORA-" in Y.if there is an error then exit Y=`sqlplus -s user/passwd<< EOF exec test_Proc; exit; EOF` if ; then exit 1 fi but this doesnt work (6 Replies)
Discussion started by: haadiya
6 Replies

3. Shell Programming and Scripting

Shell script to capture Current day ORA errors from Alert Log

Please provide Shell script to capture ORA errors from Alert Log for a given date or Current date. -Veera (1 Reply)
Discussion started by: Veera_V
1 Replies

4. Shell Programming and Scripting

Extracting Sysdate-1 ORA Errors - Can you help me in this UNIX Script?

Hi Guys, I wanted to create an Unix Shell Script that should fetch a particular string from a text file on a particular date. We all know Oracle generates alert logs for each and every day for every actions in the database. I have an alert log file now where it contains for about a months... (4 Replies)
Discussion started by: raja_dba
4 Replies

5. Shell Programming and Scripting

How to turn off ora errors in shell script?

I have a shell script which select total count from a table and use its value in a if condition like below connect_string="username/password@tnsname" tot=`sqlplus -s $connect_string << EOF set echo off set feedback off set head off select count(*) from test_table; EOF ` if then echo... (2 Replies)
Discussion started by: vel4ever
2 Replies

6. HP-UX

ORA-06512 Error in Oracle 10g

HI All , I am using oracle 10g and HP AIX . I am getting the below error while running the package. ORA-29280: invalid directory path ORA-06512: at "SYS.UTL_FILE", line 41 ORA-06512: at "SYS.UTL_FILE", line 478 ORA-06512: at "DW_APP.PKG_ASS_FVC", line 595 ORA-06512: at line 2 ... (4 Replies)
Discussion started by: Perlbaby
4 Replies

7. Shell Programming and Scripting

Shell script to capture ORA errors from Alert Log

Hi, as the title says, I am after a simple script, which will open the Alert log from an 11.2.0.1 Linux environment and mail the error message and description to a recipient email address. I can then schedule this job via cron and let it run every 15 minutes. I have searched online... (16 Replies)
Discussion started by: jnrpeardba
16 Replies

8. HP-UX

ORA-27300 error because of hp ux

Dear All, i am not able to start the 9i oracle database because of the following problems. I log in into unix and then into sqlplus export oracle_sid=SATEST startup nomount i am getting the following errors ORA-27300: OS system dependent operation:semget failed with... (3 Replies)
Discussion started by: alokpattar
3 Replies

9. Solaris

maxuprc and maxusers - ORA-27300, ORA-27301, ORA-27302

Hi all, Am intermittently getting the following errors on one of my databases. Errors in file /oracle/HRD/saptrace/background/hrd_psp0_13943.trc: ORA-27300: OS system dependent operation:fork failed with status: 12 ORA-27301: OS failure message: Not enough space ORA-27302:... (1 Reply)
Discussion started by: newbie_01
1 Replies

10. Shell Programming and Scripting

How to get ORA errors in alertlog file using shell script.

Hi, Can anyone tell me how to get all ORA errors between two particular times in an alertlog file using shell script. Thanks (3 Replies)
Discussion started by: suman_dba1
3 Replies
Login or Register to Ask a Question