- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
4#
发表于 2012-5-7 19:20:50
请自行修改 以下脚本:- #!/bin/bash
- # edit by maclean 2012-05-07 www.oracledatabase12g.com
- export ORACLE_BASE=
- export ORACLE_HOME=
- export PATH=$ORACLE_HOME/bin:.:$PATH
- export ORACLE_SID=
- sqlplus -s /nolog <<EOF
- connect / as sysdba
- set echo off
- set veri off
- set feedback off
- set termout on
- set heading off
- set linesize 1500
- set termout off
- VARIABLE BgnSnap NUMBER
- VARIABLE EndSnap NUMBER
- VARIABLE DID NUMBER
- VARIABLE INST_NUMBER number
- VARIABLE DB_UNIQUE_NAME varchar2(20)
- exec select max(snap_id) -1 into :BgnSnap from dba_hist_snapshot ;
- exec select max(snap_id) into :EndSnap from dba_hist_snapshot ;
- exec select DBID into :DID from v\$database;
- exec select DB_UNIQUE_NAME into :DB_UNIQUE_NAME from v\$database ;
- exec select INSTANCE_NUMBER into :INST_NUMBER from v\$instance ;
- alter session set nls_date_format='YYYY-MM-DD';
- column filename new_val filename
- select 'awr_'||:DB_UNIQUE_NAME||'_'||sysdate||'_'||:BgnSnap||'_'||:EndSnap||'.html' filename from dual ;
- spool &filename;
- SELECT output FROM TABLE (dbms_workload_repository.awr_report_html (:DID,:INST_NUMBER,:BgnSnap,:EndSnap ) );
- spool off
- exit
- EOF
复制代码 |
|