Thursday Oct 11, 2012

One of my most frequently used commands

On a Linux or UNIX server this is one of my most frequently used commands.

find . -name "*.htm" -exec grep -iH "alter session" {} \;

It is an easy way to find a string you know is in a group of files, but don't know or can't remember which file it is in.

For the example above, I knew that WebCenter Content sends a bunch of alter session commands to the database when it opens a new database connection. I wanted to find where these were defined and what all the alter session commands were.

So, I ran these commands:

cd /opt/oracle/middleware/Oracle_ECM1/ucm/idc/resources/core
find . -name "*.htm" -exec grep -iH "alter session" {} \;

And the results were:

./tables/query.htm: ALTER SESSION SET optimizer_mode = ?
./tables/query.htm: ALTER SESSION SET NLS_LENGTH_SEMANTICS = ?
./tables/query.htm: ALTER SESSION SET NLS_SORT = ?
./tables/query.htm: ALTER SESSION SET NLS_COMP = ?
./tables/query.htm: ALTER SESSION SET CURSOR_SHARING = ?
./tables/query.htm: ALTER SESSION SET EVENTS '30579 trace name context forever, level 2'
./tables/query.htm: ALTER SESSION SET NLS_DATE_FORMAT = ?
./tables/query.htm: alter session set events '30579 trace name context forever, level 2'

I could then go edit the query.htm file and find the include that contained all the ALTER SESSION commands.

About

Kevin Smith is a Technical Director in Oracle Consulting's WebCenter practice. He has been working with content management products since 2004 when he joined Stellent.

Search

Archives
« October 2012 »
SunMonTueWedThuFriSat
 
1
2
3
4
6
7
8
9
10
12
13
14
15
18
19
20
21
22
23
24
25
26
27
28
29
30
31
   
       
Today