The log file of the Oracle database is $ ORACLE_BASE / Admin / ORASID / BDUMP / ALERT_ORASID.LOG records the conversion of the re-author log.
The database starts and off, the change of the database structure, the modification of the refund, the deadlock, internal error and other information.
Database administrators need to check this file or ORA-error and regularly install this log file.
Under UNIX, you can save the errors in Alert_ORASID.Log to another file with the grep command. Then look for the reason.
$ grep ora - alert_orasid.log> error.log
Everyone knows that the greater the file, the greater the overhead of opening and reading and writing. If the log file is too large (more than 5m), it needs to be truncated to it.
Delete it directly, let Oracle regenerate is not a good method. Because Oracle is written by a pointer to a file.
Delete this file when the database is run, Oracle still writes with the original file pointer, it is possible to write a file that does not exist
Resulting in hard disk space occupation.
We should use the following methods:
$ tail -100 $ oracle_base / admin / oasid / bdump / alert_orasid.log> /TMP/Orcle_temp.log
$ cp /tmp/oracle_temp.log $ oracle_base / admin / oasid / bdump / alert_orasid.log
$ RM /TMP/Oracle_Temp.log
Truncate the log file.
Listener's log file $ oracle_home / network / log / listener.log records network requests by Listener processing
Information, it contains information such as client request, connection mode (dedicated or shared), connection program, network protocol, hostname, network port number, etc.
We also need to truncate it cycle, the method is to stop the Listener's job:
$ LSNRCTL SET log_status off
Then perform file processing (saving the original log to the backup folder, making the original listener.log)
$ cp $ oracle_home / network / log / listener.log $ oracle_backup / network / log / listener_1.log
$ CP / DEV / NULL $ Oracle_Home / Network / Log / Listener.log
Once the file operation is complete, open the work of the Listener Remember:
$ lsnrctl set log_status on
If you write a simple shell program, you can cure the above steps into a script, set a schedule, let the operating system do.
Here is a file that I wrote to save listener.log, auto_listener.sh
-------------------------------------------------- -----------------------------------
RQ = `Date "% D "`
CP $ ORACLE_HOME / NETWORK / LOG / LISTENER.LOG $ ORACLE_BACKUP / NETWORK / LOG / LISTENER_ $ RQ.LOG
Su - Oracle-C "LSNRCTL SET LOG_STATUS OFF"
CP / DEV / NULL $ Oracle_Home / Network / Log / Listener.log
Su - Oracle-C "LSNRCTL SET LOG_STATUS ON"
-------------------------------------------------- ----------------------------------- You can define environment variables according to your situation Oracle_Home, Oracle_Backup or directly It can be made into actual directory
Operating system root user 23:59 assigns this shell script to complete the segmentation processing of the log file.
-------------------------------------------------- ----------------------------------- Microsoft SQL Server can perform the system stored procedure to split Errrlog log:
EXEC SP_CYCLE_ERRORLOG
Errlog logs are automatically split each time the SQL Server database is restarted.