TOD – olsnodes hangs temporarily November 19, 2008
Posted by grumpydba in general, RAC, Tip 'o the day.Tags: olsnodes RAC oraenv
add a comment
In using rac, I have found it handy to modify oraenv to use the olsnodes -n -l command to find the local node number and append it to the database name for the real sid.
/home/oracle:()$ . oraenv ORACLE_SID = [oracle] ? qa /home/oracle:(qa1)$ echo $ORACLE_SID qa1
I find this easier than manually setting the sid as it is consistent on each node. One issue I have run into is that after a node has been around for a while there can be a lag time in using oraenv to set the sid.
Tracing the problem, I found it would hang for several seconds on the olsnodes command. Minor, but annoying, especially when in a hurry. In trying to find the cause I discovered that olsnodes would write a logfile to the $CRS_HOME/log//client directory. If there are a large number of log files (css*.log) it will slow down as unix has to create new inode for the new file and unix has to take the number of files in a directory into account when allocating a new inode.
The obvious solution is to remove these files, in most cases an “rm” command will not work as the file list is too long so a find command would be used:
find . -name "*.log" -exec rm -f {} \;
The best resolution would be to create a cron job that would remove all old logs:
00 03 * * * /usr/bin/find /oracle/product/10.2.0/crs_1/log/lx52/client \( -name "css*.log" -o -name "*.trc" \) -mtime +1 -exec /bin/rm -f {} \;
In the example above at 3am we find all the css*.log and *.trc files older than midnight yesterday and remove them. Based on running at 3am, it would remove all files over 27 hours old.