manintheit.org

manintheit.org


Finding ORA and SP2 Errors with grep

In this short post, I will share simple grep style Regular Expression to find Oracle ORA-XXXXX and SqlPlus(SP2-XXXX) errors

Connectionless Session with sqlplus

#!/bin/bash
#Set oracle environment variables in the .bash_profile
. ~/.bash_profile 
sqlplus -s /nolog <<EOF>test.ora
connect <username>/<password>@<connection identifier> 
SELECT ID || ' ' || NAME || ' ' || SNAME || ' ' || ' ' || PHONE || ' ' || CITY ||  ' ' FROM USERS; 
quit 
EOF

Finding ORA Errors:

grep '^.*ORA-[0-9]\{5\}:' test.ora

Finding SP2 Errors:

grep '^.*SP2-[0-9]\{4\}:' test.ora


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.