Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

   
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 

 

 

Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation

 

 


 

 

 

        
 

 
 

Oracle Locating Files in UNIX

Oracle Tips by Burleson Consulting
 

Advanced Oracle Utilities: The Definitive Reference by Rampant TechPress is written by the top Oracle database experts (Bert Scalzo, Donald Burleson, and Steve Callan).  The following is an excerpt from the book.

Locating files in UNIX

To find the location of code that will be executed, the “which” command is used.  The which command will search the path for the program name it is given. For example, to find the location of the SQL*Plus executable:

 root> which sqlplus
/u01/home/oracle/product/9.1.2/bin/sqlplus
   

To find other files, the UNIX find command is commonly used.  In chapter 8, this command will be extended to search for all files that contain specific strings:


root> cd /
/
root> find . -print|grep –i dbmspool.sql
./oracle/product/9.1.2/rdbms/admin/dbmspool.sql

In the example above, cd to the root directory (/) and issue a UNIX find command to display every file on the Oracle server.  Next, pipe the output of the find command to grep, which searches for the dbmspool.sql file. For more details on file management commands, see Chapter 8.

 

Some common UNIX utility commands will be covered next.

 Using grep in UNIX

The grep utility is the most common method used to find UNIX files that contain specific strings.  Experienced users quickly learn to use the –i option to do a case insensitive string search.

 

In the example below, the goal is to find an SQL script that recompiles invalid objects.

 

root> grep -i invalid *.sql

MKSTDROL.sql:/* create role for 'invalid' users    */
RUNTHEM.sql:  4  WHERE STATUS = 'INVALID'
add_view.sql:         'IV', 'Library Cache Invalidation',                                   
invalid.sql:Spool run_invalid.sql
invalid.sql:   status = 'INVALID'
invalid.sql:@run_invalid.sql
locks.sql:                'IV', 'Library Cache Invalidation', 

Using awk in UNIX

The awk utility is used often extract a specific column of data from output or a file.  For example, to create a list of UNIX process IDs for all Oracle processes on the server.

 

root> ps -ef|grep -i oracle|awk '{ print $2 }'

23308
25167
12193
25163
12155
24065
24073

 

First, issue the ps –ef command to get a list of all UNIX processes, and then use grep to filter out all processes except this that contain the string “oracle.  The awk utility is used to extract the second column of output.

 

root> ps -ef|grep -i oracle

  oracle 23308     1  0   May 14 ?        0:06 ora_lgwr_prodb1
  oracle 25167     1  0   Apr 30 ?        0:26 ora_smon_prodc1
  oracle 25163     1  0   Apr 30 ?       41:27 ora_lgwr_prodc1
  oracle 12155     1  0 11:30:43 ?        0:01 oracleprodcars (LOCAL=NO)
  oracle 24065     1  0   Apr 30 ?        0:02 ora_pmon_rman
  oracle 24073     1  0   Apr 30 ?       10:39 ora_ckpt_rman
  oracle 24846     1  0   May 11 ?        0:48 oracleprodc1 (LOCAL=NO)

root> ps -ef|grep -i oracle|awk '{ print $2 }'

23308
25167
12193
25163
12155
24065
24073

     


Fo
r more details on Oracle utilities, see the book "Advanced Oracle Utilities" by Bert Scalzo, Donald K. Burleson, and Steve Callan.

You can buy it direct from the publisher for 30% off directly from Rampant TechPress.


 


 

     

Remote DBA Service
 

Oracle Tuning Book

 

Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

 

 

 

 

 

 

 

 

 

BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.