欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

如何查看数据库alert日志文件

程序员文章站 2023-11-30 10:56:40
1、查看操作系统版本 sql> select * from v$version; banner -----------------------------------...
1、查看操作系统版本
sql> select * from v$version;
banner
----------------------------------------------------------------
oracle database 10g enterprise edition release 10.2.0.1.0 - prod
pl/sql release 10.2.0.1.0 - production
core 10.2.0.1.0 production
tns for linux: version 10.2.0.1.0 - production
nlsrtl version 10.2.0.1.0 - production
sql>

2、查看预警日志文件(alert_sid.log)的位置
sql> show parameter dump
name type value
------------------------------------ ----------- ------------------------------
background_core_dump string partial
background_dump_dest string /u01/oracle/admin/bdump
core_dump_dest string /u01/oracle/admin/cdump
max_dump_file_size string 10240
shadow_core_dump string partial
user_dump_dest string /u01/oracle/admin/udump

3、创建目录alert
注意:directory不是实体,只是一个指向,指向os中一个路径
sql> create or replace directory alert as '/u01/oracle/admin/bdump';
directory created.
sql>

4、创建外部表alert
sql> create table alert
1 (log varchar2(1000))
2 organization external
3 (type oracle_loader
4 default directory alert
5 access parameters
6 (records delimited by newline)
7 location ('alert_prod.log'))
8 reject limit unlimited;
table created.

5、查看alert中的内容
sql> select * from alert where rownum<20;
log
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
wed feb 27 11:05:11 2013
starting oracle instance (normal)
cannot determine all dependent dynamic libraries for /proc/self/exe
unable to find dynamic library libocr10.so in search paths
rpath = /ade/aime1_build2101/oracle/has/lib/:/ade/aime1_build2101/oracle/lib/:/ade/aime1_build2101/oracle/has/lib/:
ld_library_path is not set!
the default library directories are /lib and /usr/lib
unable to find dynamic library libocrb10.so in search paths
unable to find dynamic library libocrutl10.so in search paths
unable to find dynamic library libocrutl10.so in search paths
license_max_session = 0
license_sessions_warning = 0
picked latch-free scn scheme 2
using log_archive_dest_1 parameter default value as /u01/oracle/product/10.2.0/db_1/dbs/arch
autotune of undo retention is turned on.
imode=br
ilat =10
license_max_users = 0
sys auditing is disabled
19 rows selected.
sql>

6、看看数据库有哪些 可爱的ora- 错误吧
sql> select * from alert where log like '%ora-%';
log
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ora-959 signalled during: alter database default tablespace users...
ora-959 signalled during: drop tablespace uses...
ora-12919 signalled during: drop tablespace users...
ora-1549 signalled during: drop tablespace users...
ora-1505 signalled during: alter database add logfile group 1
ora-1184 signalled during: alter database add logfile group 1
ora-1013 signalled during: alter tablespace tts read only...
ora-1013 signalled during: alter tablespace tts read only...
ora-1013 signalled during: alter tablespace users read only...
ora-1539 signalled during: alter tablespace users read only...