Oracle日志获取及AWR生成1、什么是AWR?AWR(AutomaticWorkloadRepository)是自动负载信息库的英文缩写,AWR报告是Oracle10g以后版本提供的一种性能收集和分析工具,能提供一个时间段内整个系统资源使用情况的报告,通过报告可以了解一个系统的整个运行情况。2、生成AWR报告SQL>conn/assysdbaConnected.SQL>@?/rdbms/admin/awrrpt.sql--跑这个脚本CurrentInstance~~~~~~~~~~~~~~~~DBIdDBNameInstNumInstance-------------------------------------------3918594034ORCL1orclSpecifytheReportType~~~~~~~~~~~~~~~~~~~~~~~WouldyoulikeanHTMLreport,oraplaintextreport?Enter'html'foranHTMLreport,or'text'forplaintextDefaultsto'html'Entervalueforreport_type:html--输入报告类型此处是htmlTypeSpecified:htmlInstancesinthisWorkloadRepositoryschema~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~DBIdInstNumDBNameInstanceHost--------------------------------------------------------*39185940341ORCLorclDCMSBDMUsing3918594034fordatabaseIdUsing1forinstancenumberSpecifythenumberofdaysofsnapshotstochoosefrom~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Enteringthenumberofdays(n)willresultinthemostrecent(n)daysofsnapshotsbeinglisted.Pressingwithoutspecifyinganumberlistsallcompletedsnapshots.Entervaluefornum_days:2--列出快照范围这里是2天Listingthelast2daysofCompletedSnapshotsSnapInstanceDBNameSnapIdSnapStartedLevel--------------------------------------------------------kobraKOBRA122720Aug201200:001122820Aug201201:001122920Aug201202:001123020Aug201203:001123120Aug201204:001...126321Aug201212:001126421Aug201213:001126521Aug201214:001126621Aug201215:001SpecifytheBeginandEndSnapshotIds~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Entervalueforbegin_snap:1227--输入起始快照BeginSnapshotIdspecified:1227Entervalueforend_snap:1265--输入结束快照EndSnapshotIdspecified:1265SpecifytheReportName~~~~~~~~~~~~~~~~~~~~~~~Thedefaultreportfilenameisawrrpt_1_1227_1265.html.Tousethisname,presstocontinue,otherwiseenteranalternative.Entervalueforreport_name:--输入报告名字Usingthereportnameawrrpt_1_1227_1265.htmlAWRReportforDB:KOBRA,Inst:kobra,Snaps:1227-1265EndofReportReportwrittentoawrrpt_1_1227_1265.html--生成的报告3、如何查询alert日志位置Sqlplus下输入select*fromv$diag_info;diag_trace指向的位置就是alert日志路径,如图所示: