There are hundreds of commands for managing Oracle in UNIX. Now let's take a look at some of the UNIX techniques that are especially useful for Oracle experts.
Locating files anywhere on a UNIX server
You can use the Find command in UNIX to locate a particular file.
root> pwd
/
Root> find. -print|grep-idbmspool.sql
./oracle/product/9.1.2/rdbms/admin/dbmspool.sql
Locate an Oracle file that contains a specific string
This is a shell command that is used to find all the most commonly used shells that contain the specified string. For example, suppose you are trying to locate a script that queries the V$process table.
You can use the following command, UNIX will search all subdirectories and find v$process forms in all files.
Root> find. -print|xargsgrep v\ $process
./tx_rbs.sql:v$process p,
./unix_who.sql:from V$session A, v$process b
./session.sql:fromv$session B, v$process a
Locating the most recently created UNIX file
The following commands are useful for finding the Unix files that were recently added to your server. Part of the task of Oracle database administrators is to monitor the background_dump_dest and user_dump_dest that are used to track files, and to clear out trace files that are no longer needed.
The following command lists all the files that have been created in the last two weeks.
Root> find. -mtime-14-print
.
./janet1_ora_27714.trc
./janet1_ora_27716.trc
Find large files on UNIX servers
The following commands are useful when the Unix file system is filled up. As you may know, Oracle hangs when Oracle has to expand a table space and cannot extend the Unix file system.
The following script shows all files that are larger than 1MB. Note that you want to specify the size parameter in kilobytes.
Root> find. -size +1024-print
./prodsid_ora_22951.trc
Get a list of installed ORACLE products in the current $oracle_home
The following commands are useful for locating all the safe products in your Oracle environment.
Cat $ORACLE _HOME/UNIX.PRD |\
Nawk-f\ "' {printf ("%-40s%-10s%-20s\n ", $, $, $)} ' |\
grep ' ^[^] '