搜索
首页数据库mysql教程DUMP的AWR报告如何导入到Oracle详解

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 ~]$

linux

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
MySQL索引基数如何影响查询性能?MySQL索引基数如何影响查询性能?Apr 14, 2025 am 12:18 AM

MySQL索引基数对查询性能有显着影响:1.高基数索引能更有效地缩小数据范围,提高查询效率;2.低基数索引可能导致全表扫描,降低查询性能;3.在联合索引中,应将高基数列放在前面以优化查询。

MySQL:新用户的资源和教程MySQL:新用户的资源和教程Apr 14, 2025 am 12:16 AM

MySQL学习路径包括基础知识、核心概念、使用示例和优化技巧。1)了解表、行、列、SQL查询等基础概念。2)学习MySQL的定义、工作原理和优势。3)掌握基本CRUD操作和高级用法,如索引和存储过程。4)熟悉常见错误调试和性能优化建议,如合理使用索引和优化查询。通过这些步骤,你将全面掌握MySQL的使用和优化。

现实世界Mysql:示例和用例现实世界Mysql:示例和用例Apr 14, 2025 am 12:15 AM

MySQL在现实世界的应用包括基础数据库设计和复杂查询优化。1)基本用法:用于存储和管理用户数据,如插入、查询、更新和删除用户信息。2)高级用法:处理复杂业务逻辑,如电子商务平台的订单和库存管理。3)性能优化:通过合理使用索引、分区表和查询缓存来提升性能。

MySQL中的SQL命令:实践示例MySQL中的SQL命令:实践示例Apr 14, 2025 am 12:09 AM

MySQL中的SQL命令可以分为DDL、DML、DQL、DCL等类别,用于创建、修改、删除数据库和表,插入、更新、删除数据,以及执行复杂的查询操作。1.基本用法包括CREATETABLE创建表、INSERTINTO插入数据和SELECT查询数据。2.高级用法涉及JOIN进行表联接、子查询和GROUPBY进行数据聚合。3.常见错误如语法错误、数据类型不匹配和权限问题可以通过语法检查、数据类型转换和权限管理来调试。4.性能优化建议包括使用索引、避免全表扫描、优化JOIN操作和使用事务来保证数据一致性

InnoDB如何处理酸合规性?InnoDB如何处理酸合规性?Apr 14, 2025 am 12:03 AM

InnoDB通过undolog实现原子性,通过锁机制和MVCC实现一致性和隔离性,通过redolog实现持久性。1)原子性:使用undolog记录原始数据,确保事务可回滚。2)一致性:通过行级锁和MVCC确保数据一致。3)隔离性:支持多种隔离级别,默认使用REPEATABLEREAD。4)持久性:使用redolog记录修改,确保数据持久保存。

MySQL的位置:数据库和编程MySQL的位置:数据库和编程Apr 13, 2025 am 12:18 AM

MySQL在数据库和编程中的地位非常重要,它是一个开源的关系型数据库管理系统,广泛应用于各种应用场景。1)MySQL提供高效的数据存储、组织和检索功能,支持Web、移动和企业级系统。2)它使用客户端-服务器架构,支持多种存储引擎和索引优化。3)基本用法包括创建表和插入数据,高级用法涉及多表JOIN和复杂查询。4)常见问题如SQL语法错误和性能问题可以通过EXPLAIN命令和慢查询日志调试。5)性能优化方法包括合理使用索引、优化查询和使用缓存,最佳实践包括使用事务和PreparedStatemen

MySQL:从小型企业到大型企业MySQL:从小型企业到大型企业Apr 13, 2025 am 12:17 AM

MySQL适合小型和大型企业。1)小型企业可使用MySQL进行基本数据管理,如存储客户信息。2)大型企业可利用MySQL处理海量数据和复杂业务逻辑,优化查询性能和事务处理。

幻影是什么读取的,InnoDB如何阻止它们(下一个键锁定)?幻影是什么读取的,InnoDB如何阻止它们(下一个键锁定)?Apr 13, 2025 am 12:16 AM

InnoDB通过Next-KeyLocking机制有效防止幻读。1)Next-KeyLocking结合行锁和间隙锁,锁定记录及其间隙,防止新记录插入。2)在实际应用中,通过优化查询和调整隔离级别,可以减少锁竞争,提高并发性能。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解锁Myrise中的所有内容
1 个月前By尊渡假赌尊渡假赌尊渡假赌

热工具

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

功能强大的PHP集成开发环境

安全考试浏览器

安全考试浏览器

Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

EditPlus 中文破解版

EditPlus 中文破解版

体积小,语法高亮,不支持代码提示功能

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具