Miscellaneous Shell Scripts
The topics in this section deal with miscellaneous Unix commands and scripts that are useful for Oracle DBAs.
Create a Soft Link for a File
It is important to have a single tnsnames.ora file on each server. This is because database servers with multiple Oracle homes will have many default locations for the tnsnames.ora file. For example, each home will have its own $ORACLE_HOME/network /admin directory. The resulting proliferation of files can cause some confusion. The ideal is to create a single tnsnames.ora file for the database server with soft links pointing from every $ORACLE_HOME/network /admin directory to the single copy.
Oracle uses the following search order for finding the tnsnames.ora file:
/etc (or /var/opt/oracle for Solaris)
Most AIX and HP-UX sites keep a single copy of the tnsnames.ora, oratab, sqlnet.ora, and listener.ora files in the /etc directory. Under Solaris, these files are kept in /var/opt/oracle.
Even though the search path will look in /etc anyway, it is good practice for you to soft-link all such configuration files to /etc. This removes the possibility of the wrong file being accessed, and shows that you have made an effort to consolidate the common Oracle files.
The following script will create a soft link to /etc for every database on the server:
# Loop through each database name # on the host /etc/oratab. for db in `cat /etc/oratab|egrep ':N|:Y'|\ grep -v \*|cut -f1 -d':'` do # Get the ...