最终版-perl工具解析数据库的报告文件0120

mac2022-06-30  115

 

********************需要根据自己的实际环境修改哦****************************

********************

1. 收集awr报告样本   awrreport.sql

--该脚本请用具有 dba 权限的用户执行,普通用户没有权限访问数据库的基表

conn &usr/ &pass @ &oracle_sid

set linesize 1200 ;set pagesize 0;set long 99999;set heading off;--set termout off;set echo off;set feedback off;set timing off;set serveroutput on;

exec dbms_output.put_line('report_name,for example:hydk');spool awrrpt_tmp.sql;select'spool &report_name'||'_awrrpt_'||snap_id||'_'||(snap_id+1)||'.lst'||chr(10)||'select output '||chr(10)||' from table(dbms_workload_repository.awr_report_text('||dbid||',1,'||snap_id||','||(snap_id+1)||'));'||chr(10)||'spool off;'||chr(10)from dba_hist_snapshot;whenever sqlerror continue;spool off ;@awrrpt_tmp.sql;

---- 这里要等一段时间,多敲几下回车以保证上面的语句都执行 ---

host del awrrpt_tmp.sql;exit;

 

********************

2.    .bat文件 批量执行sql脚本,避免 重复的复制粘贴

@echo offecho ***************************************************echo * *echo * 此脚本用于数据库的awr报告文件 *echo * *echo *************************************************** echo echo 请按照[ ]中的提示输入参数,如不输入,则自动设为默认 echo.

rem -------------------------------------------------------%~d0cd %~dp0

set setup=setup.sql

set NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK

echo set echo off >> %setup

转载请注明原文地址: https://mac.8miu.com/read-4970.html
最新回复(0)