系统环境:Linux version 2.6.32-358.el6.x86_64 

数据库版本:11.2.0.1.0

环境变量:$ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

              $ORACLE_BASE=/u01/app/oracle

             $ORACLE_SID=orcl


1.监听 TNS等配置文件位置

1.1 linux

[oracle@localhost audit]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/

[oracle@localhost admin]$ ls

listener.ora  samples  shrept.lst  sqlnet.ora  tnsnames.ora

[oracle@localhost admin]$ pwd

/u01/app/oracle/product/11.2.0/dbhome_1/network/admin

[oracle@localhost admin]$ 

1.2 windows

%ORACLE_HOME%\network/admin

2.初始静态参数文件位置

关于oracle实例的spfile和pfile文件存放位置:

linux和unix环境则存放在$ORACLE_HOME\dbs目录下,windows环境下文件存放在$ORACLE_HOME\database目录下

2.1 linux

[oracle@localhost dbs]$ pwd

/u01/app/oracle/product/11.2.0/dbhome_1/dbs

[oracle@localhost dbs]$ ls

hc_DBUA0.dat  hc_orcl.dat  init.ora  lkORCL   orapworcl     spfileorcl.ora

hc_KM.dat     initKM.ora   lkKM      orapwKM  spfileKM.ora

2.2 windows

%ORACLE_BASE%\database

无论在linux还是windows在$ORACLE_HOME/admin/[SID]/pfile里都有一个pfile文件,这个文件的名字类似init.ora.5292018151558,在网上查了些资料,说这个是oracle的pfile自动备份

3.动态参数文件位置

3.1 linux

[oracle@localhost dbs]$ pwd

/u01/app/oracle/product/11.2.0/dbhome_1/dbs

[oracle@localhost dbs]$ ls

hc_DBUA0.dat  hc_orcl.dat  init.ora      lkKM    orapwKM    spfileKM.ora

hc_KM.dat     initKM.ora   initorcl.ora  lkORCL  orapworcl  spfileorcl.ora

3.2 windows

%ORACLE_HOME%\dbs

4.审计信息

4.1 linux

[oracle@localhost adump]$ pwd

/u01/app/oracle/admin/orcl/adump

[oracle@localhost adump]$ ls

orcl_ora_100382_1.aud  orcl_ora_75484_1.aud  orcl_ora_76285_1.aud  orcl_ora_92140_1.aud

orcl_ora_100416_1.aud  orcl_ora_75484_2.aud  orcl_ora_76291_1.aud  orcl_ora_92232_1.aud

orcl_ora_100707_1.aud  orcl_ora_75563_1.aud  orcl_ora_76305_1.aud  orcl_ora_92247_1.aud

orcl_ora_100817_1.aud  orcl_ora_75646_1.aud  orcl_ora_76306_1.aud  orcl_ora_92251_1.aud

orcl_ora_100924_1.aud  orcl_ora_75647_1.aud  orcl_ora_76328_1.aud  orcl_ora_92263_1.aud

orcl_ora_100927_1.aud  orcl_ora_75647_2.aud  orcl_ora_76329_1.aud  orcl_ora_92268_1.aud

[oracle@localhost adump]$ 


4.2 windows

%ORACLE_BASE%\admin\[SID]\adump

5.EM配置\监听配置\数据库创建的日志

5.1 linux

[oracle@localhost adump]$ cd /u01/app/oracle/cfgtoollogs/

[oracle@localhost cfgtoollogs]$ ls

dbca  emca  netca


[oracle@localhost cfgtoollogs]$ cd dbca/

[oracle@localhost dbca]$ ls

KM  orcl

[oracle@localhost dbca]$ cd orcl/

[oracle@localhost orcl]$ ls

cloneDBCreation.log   mkplug_v3_orcl.log                           rmanRestoreDatafiles.sql

CloneRmanRestore.log  OraDb11g_home1_orcl_creation_checkpoint.xml  trace.log

emConfig.log          postDBCreation.log                           tts_example_imp.log

lockAccount.log       postScripts.log


[oracle@localhost cfgtoollogs]$ cd emca/

[oracle@localhost emca]$ ls

emca_2018_09_12_18_13_33.log  KM  orcl

[oracle@localhost emca]$ cd orcl/

[oracle@localhost orcl]$ ls

emca_2018_08_17_01_01_55.log               emca_repos_config_2018_08_17_02_15_18.log

emca_2018_08_17_02_09_33.log               emca_repos_create_2018_08_17_02_11_13.log

emca_repos_config_2018_08_17_01_02_01.log  emca_repos_drop_2018_08_17_02_10_20.log


[oracle@localhost cfgtoollogs]$ cd netca/

[oracle@localhost netca]$ ls

netca_OraDb11g_home1-18081712AM5937.log  trace_OraDb11g_home1-18081712AM5937.log


[oracle@localhost orcl]$ 

5.2 windows

          %ORACLE_BASE%\cfgtoollogs


6.会话跟踪文件-即trace文件

6.1 linux

SQL> select value from v$diag_info where name='Diag Trace';


VALUE

--------------------------------------------------------------------------------

/u01/app/oracle/diag/rdbms/orcl/orcl/trace


SQL> 

6.2 windows

%ORACLE_BASE%\diag\rdbms\orcl\orcl\trace

7.数据库alert警告日志

7.1 linux

SQL> select value from v$diag_info where name='Diag Alert';


VALUE

--------------------------------------------------------------------------------

/u01/app/oracle/diag/rdbms/orcl/orcl/alert


通过adr 查看日志:

[oracle@localhost dbs]$ adrci


ADRCI: Release 11.2.0.1.0 - Production on Sun Sep 16 09:34:35 2018


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


ADR base = "/u01/app/oracle"

adrci> show alert


Choose the alert log from the following homes to view:


1: diag/tnslsnr/localhost/listener

2: diag/rdbms/orcl/orcl

3: diag/rdbms/km/KM

Q: to quit


Please select option: 2

Output the results to file: /tmp/alert_8142_13976_orcl_1.ado


Please select option: 


7.2 windows

%ORACLE_BASE%\diag\rdbms\dw\dw\alert


Oracle 10g之前,告警日志位于bdump文件夹下,但11g对此做了变更,引入了ADR(一个存放数据库诊断日志、跟踪文件的目录),它对应的初始化参数为DIAGNOSTIC_DEST,如果设置了$ORACLE_BASE环境变量,那么DIAGNOSTIC_DEST等于$ORACLE_BASE,如果没有设置$ORACLE_BASE,则等于$ORACLE_HOME/log

可使用如下语句查询11g告警日志存放路径:


--显示DIAGNOSTIC_DEST的位置


1.show parameter DIAGNOSTIC_DEST; --查询xml文件的目录


2.select value from v$diag_info where name='Diag Alert';


--查询文本文件的目录


3.select value from v$diag_info where name='Diag Trace';


4.show parameter background_dump_dest; 


5.select value from v$parameter where name='background_dump_dest';


--查询警告日志文件路径 

6.select value from v$diag_info where name='Diag Trace';


注:Oracle 11g的告警日志以两种格式存储:一种是xml格式,另一种是文本格式。

8.oracle自带监控排错脚本

8.1 linux

$ORACLE_HOME/rdbms/admin

/u01/app/oracle/product/11.2.0/db_1/rdbms/admin


8.2 windows

%ORACLE_HOME%\RDBMS\ADMIN


9.数据库备份恢复默认位置

9.1 linux

$ORACLE_BASE/fast_recovery_area/ORCL

/u01/app/oracle/fast_recovery_area/ORCL/autobackup 

/u01/app/oracle/fast_recovery_area/ORCL/backupset

/u01/app/oracle/fast_recovery_area/ORCL/onlinelog

/u01/app/oracle/fast_recovery_area/orcl/control02.ctl

9.2 windows

%ORACLE_BASE%\flash_recovery_area\orcl


10.数据库备份恢复默认位置

    show parameter db_recovery_file_dest;

    select * from v$recovery_file_dest;


11.TNS日志与监听日志位置:

11.1   linux  TNS监听日志:

    $ORACLE_BASE/diag/tnslsnr/机器名/listener/trace

    $ORACLE_BASE/diag/tnslsnr/$HOSTNAME/listener/trace

    windows TNS监听日志:

    /u01/app/oracle/diag/tnslsnr/机器名/listener/trace

11.2  linux 监听日志:

      $ORACLE_BASE/diag/tnslsnr/机器名/listener/alert/log.xml

    windows 监听日志:

    /u01/app/oracle/diag/lsnrctl