Maintenance
From dbawiki
- Purging trace and dump files in 11g with adrci
- Rotate alert logs (alertlog) with shell script
- Patching
Rotate the listener logs[edit]
Get hold of the listener log files using a method that should be usable for all versions from 9i. This can then be fed into the rotate script.
#!/usr/bin/ksh
ps -ef | grep tnslsnr | grep inherit | grep -v grep | while read -r psline
do
listener_name=$(echo ${psline} | awk '{print $(NF-1)}')
listener_process=$(echo ${psline} | awk '{print $(NF-2)}')
ORACLE_HOME="$(echo ${listener_process} | sed -e 's;/bin/tnslsnr;;')"
export TNS_ADMIN=$(echo ${ORACLE_HOME}/network/admin)
listener_log_file=$(${ORACLE_HOME}/bin/lsnrctl status ${listener_name} | awk '/Listener Log File/ {print $NF}')
if [[ -r "${listener_log_file}" ]]; then
echo rotate_listener_log "${listener_log_file}"
else
echo "No listener log file found for ${listener_name}, skipping."
fi
done