Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
Oracle database listener logs are used to keep records of connection to the database and problems.
When the database runs for a long time, the log files keep getting bigger and bigger, so you need to clean them regularly! If you do not clear logs, the database may break down and become unavailable when the log size reaches about 4G.
In order toLinux
For example, the detailed procedure for clearing listening logs is as follows:
1. Query the location of the listening log
lsnrctl stat
Copy the code
The box in the picture is where the listening log is stored!
2. Check the size of the listening log file
cd /u01/app/oracle/diag/tnslsnr/orcl/listener/
du -sh *
cd trace
Copy the code
The folder in the box is the listener log file that needs to be cleared:listener.log
Be careful not to exceed1-2G !
3. Stop listening to write
lsnrctl set log_status off
Copy the code
📢 Note: This operation only stops writing log files and does not affect database running.
4. Delete or back up and rebuild logs
## 1
rm -rf listener.log
# 2, rename the backup file first, then rebuild the log file
mv listener.log listener.log0922
tail -100 listener.log0922 > listener.log
Copy the code
5. Enable listening log writing
lsnrctl set log_status on
Copy the code
At this point, the database listening log has been cleared!
This is the end of sharing ~
If you think the article is helpful to you, please like it, favorites it, pay attention to it, comment on it, and support it four times with one button. Your support is the biggest motivation for my creation.
❤️ technical exchange can follow the public number: Lucifer think twice before you do ❤️