热门标签 | HotTags
当前位置:  开发笔记 > 数据库 > 正文

DUMP的AWR报告如何导入到Oracle详解

AWR的dump文件导出1.在导出数据之前,一般需要创建以下路径:DATA_PUMP_DIREXPIMPDATA_FILE_DIR23:54:29sys@felixSQ

AWR的dump文件导出 1.在导出数据之前,一般需要创建以下路径: DATA_PUMP_DIR EXP IMP DATA_FILE_DIR 23:54:29 sys@felix SQ

AWRdump文件导出

1.在导出数据之前,一般需要创建以下路径:

DATA_PUMP_DIR

EXP

IMP

DATA_FILE_DIR

23:54:29 sys@felix SQL>create directoryexp as '/u01/exp';

Directory created.

23:55:33 sys@felix SQL>create directorydate_dir as'/u01/dir';

Directory created.

2.导出AWR数据

$Oracle_HOME/rdbms/admin目录下,我们会看到很多以awr开头的sql脚本

可以使用awrextr.sql脚本导出AWR数据到dmp文件,实现AWR数据的迁移。步骤大致如下:

00:03:54 sys@felix SQL>@?/rdbms/admin/awrextr

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

AWR EXTRACT

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

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

~This script will extract the AWR data for arange 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 WorkloadRepository schema

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

DB IdDB NameHost

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

* 3569708122 FELIXfelix

The default database id isthe local one: '3569708122'.To use this

database id, press to continue, otherwise enter an alternative.

---这里输出的是本oracledbid

Enter value for dbid: 3569708122

Using 3569708122 for DatabaseID

Specify the number of days ofsnapshots to choose from

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

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

(n) days of snapshots beinglisted.Pressing without

specifying a number lists allcompleted snapshots.

Enter value for num_days: 3

Listing the last 3 days ofCompleted Snapshots

DB NameSnap IdSnap Started

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

FELIX15 08 Nov 2013 00:00

16 08 Nov 2013 01:01

17 08 Nov 2013 02:00

18 08 Nov 2013 03:00

19 08 Nov 2013 04:00

20 08 Nov 2013 05:00

21 08 Nov 2013 06:11

22 08 Nov 2013 07:00

23 08 Nov 2013 08:00

24 08 Nov 2013 09:00

25 08 Nov 2013 10:00

26 08 Nov 2013 11:00

27 08 Nov 2013 12:00

28 08 Nov 2013 13:00

29 08 Nov 2013 14:00

30 09 Nov 2013 21:12

31 09 Nov 2013 22:00

32 09 Nov 2013 23:00

33 10 Nov 2013 00:00

Specify the Begin and EndSnapshot Ids

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

Enter value for begin_snap: 26

Begin Snapshot Id specified: 26

Enter value for end_snap: 29

EndSnapshot Id specified: 29

Specify the Directory Name

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

Directory NameDirectory Path

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

DATA_FILE_DIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/s

ales_history/

DATA_PUMP_DIR/u01/app/oracle/admin/felix/dpdump/

DATE_DIR/u01/dir

EXP/u01/exp

LOG_FILE_DIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/l

og/

MEDIA_DIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/p

roduct_media/

ORACLE_OCM_CONFIG_DIR/u01/app/oracle/product/11.2.0/db_1/ccr/state

SS_OE_XMLDIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/o

rder_entry/

SUBDIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/o

rder_entry//2002/Sep

XMLDIR/u01/app/oracle/product/11.2.0/db_1/rdbms/xml

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

Enter value for directory_name: DATE_DIR---记得要大写

Using the dump directory:DATE_DIR

Specify the Name of theExtract Dump File

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

The prefix for the defaultdump file name is awrdat_26_29.

To use this name, press to continue, otherwise enter

an alternative.

Enter value for file_name: AWREXPIMP

Using the dump file prefix:AWREXPIMP

|

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

|The AWR extract dump file will be located

|in the following directory/file:

|/u01/dir

|AWREXPIMP.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/dir

|AWREXPIMP.log

|

End of AWR Extract

AWRdump文件的导入:

1.导入之前需要创建DIREXTORY,将要导入的文件存放到此路径的操作系统目录下:

Create directory data_dir as'/u01/dir';

2.我们使用$ORACLE_HOME/rdbms/admin/awrload.sql脚本加载awr导出的dump文件数据:

00:15:27 sys@felixSQL>@?/rdbms/admin/awrload

~~~~~~~~~~

AWR LOAD

~~~~~~~~~~

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

~This script will load the AWR data from adump file. The~

~script will prompt users for the followinginformation:~

~(1) name of directory object~

~(2) name of dump file~

~(3) staging schema name to load AWR datainto~

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

Specify the Directory Name

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

Directory NameDirectory Path

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

DATA_FILE_DIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/s

ales_history/

DATA_PUMP_DIR/u01/app/oracle/admin/felix/dpdump/

DATE_DIR/u01/dir

EXP/u01/exp

LOG_FILE_DIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/l

og/

MEDIA_DIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/p

roduct_media/

ORACLE_OCM_CONFIG_DIR/u01/app/oracle/product/11.2.0/db_1/ccr/state

SS_OE_XMLDIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/o

rder_entry/

SUBDIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/o

rder_entry//2002/Sep

XMLDIR/u01/app/oracle/product/11.2.0/db_1/rdbms/xml

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

Enter value fordirectory_name: DATE_DIR

Using the dump directory:DATE_DIR

Specify the Name of the DumpFile to Load

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

Please specify the prefix ofthe dump file (.dmp) to load:

Enter value for file_name:AWREXPIMP

Loading from the file name:AWREXPIMP.dmp

Staging Schema to Load AWRSnapshot Data

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

The next step is to createthe staging schema

where the AWR snapshot datawill be loaded.

After loading the data intothe staging schema,

the data will be transferredinto the AWR tables

in the SYS schema.

The default staging schemaname is AWR_STAGE.

To use this name, press to continue, otherwise enter

an alternative.

Enter value for schema_name:AWRUSE

Using the staging schemaname: AWRUSE

Choose the Default tablespacefor the AWRUSE user

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

Choose the AWRUSE users'sdefault tablespace.This is the

tablespace in which the AWRdata will be staged.

TABLESPACE_NAMECONTENTS

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

DEFAULT TABLESPACE

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

EXAMPLEPERMANENT

STATSPACKPERMANENT

SYSAUXPERMANENT

*

USERSPERMANENT

Pressing willresult in the recommended default

tablespace (identified by *)being used.

Enter value for default_tablespace:USERS

Using tablespace USERS as thedefault tablespace for the AWRUSE

Choose the Temporarytablespace for the AWRUSE user

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

Choose the AWRUSE user'stemporary tablespace.

TABLESPACE_NAMECONTENTS

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

DEFAULT TEMP TABLESPACE

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

STATSPACKTEMPTEMPORARY

TEMPTEMPORARY

*

Pressing willresult in the database's default temporary

tablespace (identified by *)being used.

Enter value fortemporary_tablespace: TEMP

Using tablespace TEMP as thetemporary tablespace for AWRUSE

... Creating AWRUSE user

|

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

|Loading the AWR data from the following

|directory/file:

|/u01/dir

|AWREXPIMP.dmp

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

|

|*** AWR Load Started ...

|

|This operation will take a few moments. The

|progress of the AWR load operation can be

|monitored in the following directory/file:

|/u01/dir

|AWREXPIMP.log

|

begin

*

ERROR at line 1:

ORA-20105: unable to move AWRdata to SYS

ORA-06512: at"SYS.DBMS_SWRF_INTERNAL", line 2950

ORA-20107: not allowed tomove AWR data for local dbid

ORA-06512: at line 3

... Dropping AWRUSE user

End of AWR Load

00:17:56 sys@felix SQL>

Schaema小插曲:schema名称必须是oracle数据库中不存在的,不然会异常退出:

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

导出AWRdump文件:

23:50:40 sys@felixSQL>createuser awrexp identified byoracle account unlock;

User created.

23:52:41 sys@felixSQL>grantdba to awrexp;

Grant succeeded.

00:11:46 sys@felixSQL>@?/rdbms/admin/awrload

~~~~~~~~~~

AWR LOAD

~~~~~~~~~~

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

~This script will load the AWR data from adump file. The~

~script will prompt users for the followinginformation:~

~(1) name of directory object~

~(2) name of dump file~

~(3) staging schema name to load AWR datainto~

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

Specify the Directory Name

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

Directory NameDirectory Path

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

DATA_FILE_DIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/s

ales_history/

DATA_PUMP_DIR/u01/app/oracle/admin/felix/dpdump/

DATE_DIR/u01/dir

EXP/u01/exp

LOG_FILE_DIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/l

og/

MEDIA_DIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/p

roduct_media/

ORACLE_OCM_CONFIG_DIR/u01/app/oracle/product/11.2.0/db_1/ccr/state

SS_OE_XMLDIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/o

rder_entry/

SUBDIR/u01/app/oracle/product/11.2.0/db_1/demo/schema/o

rder_entry//2002/Sep

XMLDIR/u01/app/oracle/product/11.2.0/db_1/rdbms/xml

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

Enter value fordirectory_name: DATE_DIR

Using the dump directory:DATE_DIR

Specify the Name of the DumpFile to Load

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

Please specify the prefix ofthe dump file (.dmp) to load:

Enter value for file_name:AWREXPEMP

Loading from the file name:AWREXPEMP.dmp

Staging Schema to Load AWRSnapshot Data

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

The next step is to createthe staging schema

where the AWR snapshot datawill be loaded.

After loading the data intothe staging schema,

the data will be transferredinto the AWR tables

in the SYS schema.

The default staging schemaname is AWR_STAGE.

To use this name, press to continue, otherwise enter

an alternative.

Enter value for schema_name:AWREXP

Using the staging schemaname: AWREXP

declare

*

ERROR at line 1:

ORA-20104: schema name'AWREXP' already exists

ORA-06512: at line 17

Disconnected from OracleDatabase 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP,Data Mining and Real Application Testing options

[oracle@felix ~]$


推荐阅读
  • 在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ... [详细]
  • 本文介绍了使用kotlin实现动画效果的方法,包括上下移动、放大缩小、旋转等功能。通过代码示例演示了如何使用ObjectAnimator和AnimatorSet来实现动画效果,并提供了实现抖动效果的代码。同时还介绍了如何使用translationY和translationX来实现上下和左右移动的效果。最后还提供了一个anim_small.xml文件的代码示例,可以用来实现放大缩小的效果。 ... [详细]
  • VScode格式化文档换行或不换行的设置方法
    本文介绍了在VScode中设置格式化文档换行或不换行的方法,包括使用插件和修改settings.json文件的内容。详细步骤为:找到settings.json文件,将其中的代码替换为指定的代码。 ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 本文介绍了使用AJAX的POST请求实现数据修改功能的方法。通过ajax-post技术,可以实现在输入某个id后,通过ajax技术调用post.jsp修改具有该id记录的姓名的值。文章还提到了AJAX的概念和作用,以及使用async参数和open()方法的注意事项。同时强调了不推荐使用async=false的情况,并解释了JavaScript等待服务器响应的机制。 ... [详细]
  • Java序列化对象传给PHP的方法及原理解析
    本文介绍了Java序列化对象传给PHP的方法及原理,包括Java对象传递的方式、序列化的方式、PHP中的序列化用法介绍、Java是否能反序列化PHP的数据、Java序列化的原理以及解决Java序列化中的问题。同时还解释了序列化的概念和作用,以及代码执行序列化所需要的权限。最后指出,序列化会将对象实例的所有字段都进行序列化,使得数据能够被表示为实例的序列化数据,但只有能够解释该格式的代码才能够确定数据的内容。 ... [详细]
  • 本文介绍了Java工具类库Hutool,该工具包封装了对文件、流、加密解密、转码、正则、线程、XML等JDK方法的封装,并提供了各种Util工具类。同时,还介绍了Hutool的组件,包括动态代理、布隆过滤、缓存、定时任务等功能。该工具包可以简化Java代码,提高开发效率。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 本文讨论了Alink回归预测的不完善问题,指出目前主要针对Python做案例,对其他语言支持不足。同时介绍了pom.xml文件的基本结构和使用方法,以及Maven的相关知识。最后,对Alink回归预测的未来发展提出了期待。 ... [详细]
  • 本文讲述了如何通过代码在Android中更改Recycler视图项的背景颜色。通过在onBindViewHolder方法中设置条件判断,可以实现根据条件改变背景颜色的效果。同时,还介绍了如何修改底部边框颜色以及提供了RecyclerView Fragment layout.xml和项目布局文件的示例代码。 ... [详细]
  • 本文介绍了在SpringBoot中集成thymeleaf前端模版的配置步骤,包括在application.properties配置文件中添加thymeleaf的配置信息,引入thymeleaf的jar包,以及创建PageController并添加index方法。 ... [详细]
  • 本文讨论了在Spring 3.1中,数据源未能自动连接到@Configuration类的错误原因,并提供了解决方法。作者发现了错误的原因,并在代码中手动定义了PersistenceAnnotationBeanPostProcessor。作者删除了该定义后,问题得到解决。此外,作者还指出了默认的PersistenceAnnotationBeanPostProcessor的注册方式,并提供了自定义该bean定义的方法。 ... [详细]
  • eclipse学习(第三章:ssh中的Hibernate)——11.Hibernate的缓存(2级缓存,get和load)
    本文介绍了eclipse学习中的第三章内容,主要讲解了ssh中的Hibernate的缓存,包括2级缓存和get方法、load方法的区别。文章还涉及了项目实践和相关知识点的讲解。 ... [详细]
  • ZSI.generate.Wsdl2PythonError: unsupported local simpleType restriction ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
author-avatar
佩弦_秦子轩_188
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有