1、AWR原始数据与AWR报告的差别

AWR原始数据:

是oracle数据库mmon进程定期将统计量从内存转储至磁盘,并以结构化的形式存入若干张表组成自己主动工作负荷存储仓库(AutomaticWorkload repository﹐简写为AWR)的原始数据,有经验的DBA能够自由的查询所须要的历史数据

AWR报告:

使用awrrpt.sql、awrrpti.sql、awrddrpt.sql、awrddrpi.sql所生成的为AWR报告,一般为保存为HTML或TXT格式文件,使用Toad等工具生成的AWR报告也是通过调用上面几个sql脚本所生成的。我们所示是已经分析好或已经排版好了的在一段时间内的报告文件

2、AWR原始数据导出的意义

(1)起到备份的作用

(2)导出后,导入到其他数据库中进行深度分析

3、awrextr.sql存放位置

(1)存放路径:$ORACLE_HOME/rdbms/admin

(2)查看存在情况

[root@INFA ~]# su - oracle

[oracle@INFA ~]$ cd $ORACLE_HOME/rdbms/admin

[oracle@INFA admin]$ ls -l |grep awrextr.sql

-rw-r--r--. 1 oracle oinstall   11082 Mar 24  2009 awrextr.sql

4、使用awrextr.sql前提条件准备(创建directory)

使用awrextr.sql,数据库中必须具有directory

4.1 在操作系统上创建directory的文件夹

[root@INFA ~]# mkdir -p /u01/awr_extr

[root@INFA ~]# chown -R oracle:oinstall /u01/awr_extr

4.2 在数据库上创建directory

SQL> create directory awr_extr as '/u01/awr_extr';

Directory created.

5、使用awrextr.sql导出awr数据

SQL> @?/rdbms/admin/awrextr.sql

~~~~~~~~~~~~~

AWR EXTRACT

~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~  This script will extract the AWR data for a range of snapshots  ~

~  into a dump file.  The script will prompt users for the         ~

~  following information:                                          ~

~     (1) database id                                              ~

~     (2) snapshot range to extract                                ~

~     (3) name of directory object                                 ~

~     (4) name of dump file                                        ~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Databases in this Workload Repository schema

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DB Id     DB Name      Host

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

* 3248492087 INFADB       INFA

1542553735 CRMOUT       TSRRAC01

1542553735 CRMOUT       TSRRAC02

The default database id is the local one: '3248492087'.  To use this

database id, press <return> to continue, otherwise enter an alternative.

Enter value for dbid:            --输入需导出AWR数据库的DBID

Using 3248492087 for Database ID

Specify the number of days of snapshots to choose from

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Entering the number of days (n) will result in the most recent

(n) days of snapshots being listed.  Pressing <return> without

specifying a number lists all completed snapshots.

Enter value for num_days:         --输入须要导出AWR数据所选择的天数

Listing the last day's Completed Snapshots

DB Name        Snap Id    Snap Started

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

INFADB             612 03 Aug 2014 00:06

613 03 Aug 2014 00:15

614 03 Aug 2014 00:30

615 03 Aug 2014 00:45

616 03 Aug 2014 01:00

617 03 Aug 2014 01:15

618 03 Aug 2014 01:30

619 03 Aug 2014 01:45

620 03 Aug 2014 02:00

621 03 Aug 2014 02:15

Specify the Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Enter value for begin_snap:           --选择開始snap_id号

Begin Snapshot Id specified: 612

Enter value for end_snap: 620        
--选择结束snap_id号

End   Snapshot Id specified: 620

Specify the Directory Name

~~~~~~~~~~~~~~~~~~~~~~~~~~

Directory Name                 Directory Path

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

AWR_EXTR                       /u01/awr_extr

DATA_PUMP_DIR                  /dba/oracle/admin/infadb/dpdump/

EXPDP_DIR                      /u01/expdp_dir

ORACLE_OCM_CONFIG_DIR          /dba/oracle/product/11.2.0/db_1/ccr/state

XMLDIR                         /dba/oracle/product/11.2.0/db_1/rdbms/xml

Choose a Directory Name from the above list (case-sensitive).

Enter value for directory_name: AWR_EXTR      --输入存放导出dump档的directory名称

Using the dump directory: AWR_EXTR

Specify the Name of the Extract Dump File

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The prefix for the default dump file name is awrdat_612_620.

To use this name, press <return> to continue, otherwise enter

an alternative.

Enter value for file_name: awr_dump_612_620       --输入dump档名称,注意仅仅要带.dmp后缀

Using the dump file prefix: awr_dump_612_620

|

| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

|  The AWR extract dump file will be located

|  in the following directory/file:

|   /u01/awr_extr

|   awr_dump_612_620.dmp       --dump文件名自己主动带上了.dmp后缀

| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

|

|  *** AWR Extract Started ...

|

|  This operation will take a few moments. The

|  progress of the AWR extract operation can be

|  monitored in the following directory/file:

|   /u01/awr_extr

|   awr_dump_612_620.log

|

End of AWR Extract

SQL>

6、查看dump文件是否存在

[oracle@INFA ~]$ cd /u01/awr_extr

[oracle@INFA awr_extr]$ ls -l

total 12780

-rw-r-----. 1 oracle oinstall 13058048 Aug  3 02:18 awr_dump_612_620.dmp

-rw-r--r--. 1 oracle oinstall    25359 Aug  3 02:18 awr_dump_612_620.log

不仅看到了导出的dmp文件,还看到了导出的log文件,导出成功。

本文作者:黎俊杰(网名:踩点),从事”系统架构、操作系统、存储设备、数据库、中间件、应用程序“六个层面系统性的性能优化工作

欢迎增加 系统性能优化专业群,共同探讨性能优化技术。群号:258187244

使用awrextr.sql导出awr原始数据的更多相关文章

  1. PL/SQL导出到execl中,数据前面的0发生丢失的解决办法

    ERR出现的场景再现: 使用 PL/SQL导出按钮,选择‘CSV文件’,保存为1.csv,后用execl打开,复制到VuGen中作为login脚本的参数化文件username. ERR及发现过程: 在 ...

  2. 转 使用SQL从AWR收集数据库性能变化趋势

    使用SQL从AWR收集数据库性能变化趋势 为了对数据库一段时间的性能情况有个全面了解,显然AWR是一个非常有用的工具, 但很多人只会在数据库有性能问题时才会生成问题时段的awr报告去分析.虽然AWR ...

  3. oracle批量导出AWR报告

    工作需求:项目中需要把生产库中所有的AWR报告dump出来,然后导入到方便测试的数据库中.在测试库中的AWR报告需要根据dbid和实例名逐个导出,如果遇到很多再加上RAC系统,会很麻烦.在网上找了一些 ...

  4. SQL导出excel

    我在SQL 2008R2 里面用下面的命令成功导出excel 文件. EXEC master..xp_cmdshell 'bcp "select * from Car_data.dbo.Ca ...

  5. pl/sql 导出oracle表结构

    tools->export tables 是导出表结构还有数据 tools->export user objects是导出表结构   可以用tools->export tables ...

  6. sql导出

    第一步: 要求:把Library里面的Readers表导出到MyDB中(注意:读者编号.设置了主键)

  7. powerDesigner生成数据结构图以及对应sql导出方法

    1.下载powerDesigner 链接地址为http://soft.onlinedown.net/soft/577763.htm 2.打开软件,file -> new project,新建一个 ...

  8. 关于SQL 导出脚本失败 及SQL 的重装

    说点题外话 最近跳到一家新公司 薪资比较客观 但是技术可能不太尽如人意 而且对.Net方向的开发好像不是很友好  自己也不知道该怎么办 一个人大老远跑这边来 附近也没有什么.net的公司和职位 房子租 ...

  9. powerdesigner 使用技巧 建模工具 导出sql 导出实体类 导出word

    显示comment列 Table Properties(表属性)=>Columns(列)=>Customize Columns and Filter(自定义列过滤) 勾上 comment ...

随机推荐

  1. HTML5和CSS3实例教程[总结一]

    关于onclick的行为与内容分离 通过链接触发弹出窗口方式 (不推荐使用此方法!!!) <a href='#' onclcik = "window.open('holiday_pay ...

  2. Try,Catch,Finally三块中如果有Return是怎么个运行顺序

    今天看一个Java SSH的面试题,题目大概意思是:try.catch中存在return语句,还会执行finally块吗?如果执行,是return先执行还是finally先执行?如果有多个return ...

  3. 定义Foo() 函数,弹出对话框提示当前选中的是第几个单选框

    function foo(){ var ele = document.getElementsByName("radioElement"); for(var i = 0;i<e ...

  4. Linux升级C基本运行库CLIBC

    在你准备升级GLIBC库之前,你要好好思考一下, 你真的要升级GLIBC么? 你知道你自己在做什么么? glibc是gnu发布的libc库,即c运行库.glibc是linux系统中最底层的api,几乎 ...

  5. java.sql.SQLException: ORA-00604: 递归 SQL 级别 1 出现错误

    后台报出如下错误: Caused by: java.sql.SQLException: ORA-00604: 递归 SQL 级别 1 出现错误 ORA-01000: 超出打开游标的最大数 ORA-00 ...

  6. Objective-C 笔记 字符串操作

    这次总结下OC里一些对字符串的一些操作. 创建字符串对象时,会创建一个内容不可更改的对象,称为不可变对象.可以使用NSString类处理不可变字符串.你经常需要处理字符串并更改字符串中的字符.例如,可 ...

  7. Secure CRT 如何连接虚拟机里面的CentOS系统 当主机使用有线网的时候 作者原创 欢迎转载

    1.虚拟机的网卡配置如下图所示: 2.在CentOS 5.8的命令行界面:输入如下指令 然后准备修改里面的网关地址和自己的IP地址 3.同时查看自己的IP地址和网关 4.在第二步里面修改,网关地址应该 ...

  8. mysql中的JOIN用法总结

    join是mysql中一个基础的关键词,一般在多表连接查询中使用,这里做一下总结 1.JOIN的语法格式 table_references: table_reference [, table_refe ...

  9. IO定时器

    IoInitializeTimer 初始化定时器 IoStartTime 开启定时器 IoStopTimer 停止定时器 回调函数 VOID IoTimer( __in struct DEVICE_O ...

  10. Application.Count.ToString()和Application["count"].ToString()的区别

    当属性名中包括特殊字符如 “.”或“-”就不能使用“.”操作符了.操作符只能使用[ ]操作符 为了统计网站的在线人数,我们可以在Global.asa文件中包含如下代码: <SCRIPT LANG ...