As the DBA, when viewing the Oracle alert log file may not be available in a terminal landing, the landing may also troublesome terminal, the oracle external table techniques may view the alert log in the database, while the use of pretreatment technologies outside the table, You can filter the log to alert, to avoid access is very slow when alert log is too large, such as reading the most recent 400 lines. Specific steps are as follows:
1 as sysdba landing database is created in the database directory
create directory exec_dir as '\home\oracle\shell'
2 created under / home / oracle / shell reads the Oracle alert log directory script, named read_alert.sh, 400 reads the last line reads as follows:
tail -400 /$ORACLE_BASE/diag/rdbms/dbname/instancename/trace/alertinstancename.log
After 3 Create a script to give execute permissions
chmod +x read_alert.sh
4 to create an external table, using a script to create the pre-run the above options
create table t_alertlog
(
alertlog varchar2(255)
)
organization external
(
type oracle_loader
default directory exec_dir
access parameters
(
records delimited by newline
preprocessor exec_dir:'read_alert.bsh'
)
location
(
exec_dir:'read_alert.bsh'
)
)
/
5 query external tables created, you can see a log of the most recent 400 lines
select * from t_alertlog