Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

trace file is too big can I delete, empty trace files?

user10792052Feb 16 2025

Oracle Database 11.2.0.4 on Oracle Linux 7.9 , the trace files are not moved to another trace file for the next day, but build up based on same trace file name. The trace files grow, from 16MB, 226MB to 668 MB

Can I backup the trace file, and than do a

cat /dev/null >> database_ora_49626.trc ?

cat /dev/null >> database_lgwr_49626.trc ?

Does this require restart of Database?

Thanks

Comments

Hi.,

- Trace files can be move from one location to another location, thats not a problem at all.
- Yes trace files will keep growing in database as database grow., This trace files are logs which is going to be recorded for your reference.
- You can backup the trace files and keep in some backup location for further references.
- Use the best practice to delete the old trace files as per your organization requirement.
- Consider you organization require to keep trace files logs for 1 months., then you can use this method to delete the older than 1 month trace files by using the crontab jobs as shown below.
- You can also empty the trace file by using this command., > alert_TESTDB.log , Hence there is no need to restart the database.

[oracle@testdb ~]$ crontab -l

############################################################################
##Schedule the script by Mir to Delete old .trc,.trm,.xml,.aud files from DB
############################################################################
00 22 * * * /home/oracle/scripts/del_trc_trm_aud_xml_files.sh

[oracle@testdb ~]$ cat /home/oracle/scripts/del_trc_trm_aud_xml_files.sh
export ORACLE_SID=TESTDB
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
find /u01/app/oracle/diag/rdbms/testdb/TESTDB/trace/ -type f -name "*.trc" -mtime +30 -exec rm {} \;
find /u01/app/oracle/diag/rdbms/testdb/TESTDB/trace/ -type f -name "*.trm" -mtime +30 -exec rm {} \;
find /u01/app/oracle/diag/rdbms/testdb/TESTDB/alert -type f -name "*.xml" -mtime +30 -exec rm {} \;
find /u01/app/oracle/diag/tnslsnr/testdb/listener/alert -type f -name "*.xml" -mtime +30 -exec rm {} \;
find /u01/app/oracle/admin/TESTDB/adump -type f -name "*.aud" -mtime +30 -exec rm {} \;

Warm Regards,
Mir Sayeed Hassan
Oracle ACE Pro
Oracle Certified OCP | OCI

Solomon Yakobson

Trace file name database_ora_49626.trc suggest it is user session trace. Question is why that large trace file was created? Is this some development environment where users can enable trace for their sessions? Or is trace enable on database level (then why)? Also why would database_lgwr_49626.trc we that large? Did you check what's in lgwr trace? And, btw, you can cap trace file size (MAX_DUMP_FILE_SIZE).

SY.

1 - 2

Post Details

Added on Feb 16 2025
2 comments
172 views