The ORACLE Database Log File $ ORACLE_BASE/admin/orasid/bdump/alert_orasid.log records the conversion of logs,
Database startup and shutdown, database structure change, rollback segment modification, deadlock, internal errors, and other information.
The database administrator needs to check whether this file has a ORA-error and regularly archive the log file.
In UNIX, you can use the grep command to save errors in alert_orasid.log to another file. Then find the cause.
$ Grep ORA-alert_orasid.log> error. log
As we all know, the larger the file, the higher the overhead of opening and reading/writing. If the log file is too large (more than 5 MB), it needs to be truncated.
It is not a good method to directly delete it and re-generate ORACLE. Because ORACLE writes data through a pointer to a file.
This file is deleted when the database is running. ORACLE still uses the original file pointer for write operations. It is possible to write a non-existent file.
This causes disk space usage.
We should adopt the following methods:
$ Tail-100 $ ORACLE_BASE/admin/orasid/bdump/alert_orasid.log>/tmp/oracle_temp.log
$ Cp/tmp/oracle_temp.log $ ORACLE_BASE/admin/orasid/bdump/alert_orasid.log
$ Rm/tmp/oracle_temp.log
Truncate log files.
The listener log File $ ORACLE_HOME/network/log/listener. log records network requests processed by listener.
Information, including the client request time, connection method (dedicated or shared), Connection Program, network protocol, host name, network port number, and other information.
We also need to periodically truncate it by stopping the log recording of listener first:
$ Lsnrctl set log_status off
Then process the file (Save the original log to the backup folder and leave the original listener. log empty)
$ Cp $ ORACLE_HOME/network/log/listener. log $ ORACLE_BACKUP/network/log/listener_1.log
$ Cp/dev/null $ ORACLE_HOME/network/log/listener. log
After the file operation is complete, open listener to log:
$ Lsnrctl set log_status on
If you write a simple shell program, you can solidify the above steps into a script, set a timetable for the operating system to do it.
The following is a file named auto_listener.sh that saves listener. log by day.
Bytes -------------------------------------------------------------------------------------
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"
Bytes -------------------------------------------------------------------------------------
You can define the environment variables ORACLE_HOME, ORACLE_BACKUP, or directly change the environment variables to the actual directory.
The root user of the operating system runs the shell script at to split the log files.
Bytes -------------------------------------------------------------------------------------
In Microsoft SQL Server, You can execute system stored procedures to split ERRRLOG logs:
Exec sp_cycle_errorlog
The ERRRLOG is automatically split every time the SQL Server database is restarted.