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



 

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

AWR的dump文件导出

 

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 Id    DB Name      Host

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

* 3569708122 FELIX        felix

 

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

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

 

---这里输出的是本oracle的dbid

 

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 <return> without

specifying a number lists allcompleted snapshots.

 

 

Enter value for num_days: 3

 

Listing the last 3 days ofCompleted Snapshots

 

DB Name        Snap Id    Snap Started

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

FELIX               15 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

End   Snapshot Id specified: 29

 

 

Specify the Directory Name

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

 

Directory Name                 Directory 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<return> 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

 

 

AWR的dump文件的导入:

 

 

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 Name                 Directory 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<return> 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_NAME                                             CONTENTS

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

DEFAULT TABLESPACE

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

EXAMPLE                                                     PERMANENT

 

 

STATSPACK                                                   PERMANENT

 

 

SYSAUX                                                       PERMANENT

*

 

USERS                                                       PERMANENT

 

 

 

Pressing <return> 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_NAME                                             CONTENTS

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

DEFAULT TEMP TABLESPACE

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

STATSPACKTEMP                                                TEMPORARY

 

 

TEMP                                                        TEMPORARY

*

 

 

Pressing <return> 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数据库中不存在的,不然会异常退出:

 

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

导出AWR的dump文件:

 

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

 

User created.

 

 

23:52:41 sys@felixSQL>grant  dba 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 Name                 Directory 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<return> 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 ~]$

 

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

从一个“普通”的Oracle DBA(Oracle数据库管理员)转变为Oracle Applications DBA(Oracle应用程序数据库管理员),有两个内容你必须去弄清楚。第一个内容是如何成为一个Oracle Applications DBA(Oracle应用程序数据库管理员)。第二个内容是你要搞清楚Oracle应用程序背后的架构体系,也就是说你要明白诸如以下产品的结构体系:Oracle电子商务套件、Oracle 11i数据库、Siebel产品等。 本文首先讲述如何从一个普通的Oracle DBA转变为一个Oracle Applications DBA(Oracle应用程序数据库管理员),接着讲述一些Oracle应用软件架构方面的内容 。 如何成为Oracle应用程序数据库管理员 首先是角色的转变 Oracle Applications DBA(Oracle应用程序数据库管理员)对“普通”的Oracle DBA(Oracle数据库管理员)来说是一个很大的挑战。拿Oracle EBS DBA(Oracle 电子商务套件DBA)来说,不仅需要了解EBS的各个组件、服务,而且还要更主动和其他相关人员接触。 一个Oracle Applications DBA(Oracle应用程序数据库管理员)不仅需要和其他DBA一样去负责managing、 sizing、maintaining和 tuning database这些日常的数据库管理的工作,如果他的Apps database是OLTP系统的话,他还需要监察wait和lock 。Oracle E-Business Suite还有一些特性需要DBA去完成,比如从外部资源里灌数据到Apps database里,或支持开发人员从已有数据中提取数据。 接着工作内容的转变 作为一个Oracle Applications DBA(Oracle应用程序数据库管理员),要想更好的对Oracle Application database做支持,需要仔细记住以下几项。 1.网络上没有什么比较容易简单的文档让你去熟悉Apps DBA,所以我建议去看帮助。 2.在你没有经过多次测试并且得到客户认可的时候不要去打补丁,并且你要确信这个补丁解决了现有的问题,而且没有带来其它新的问题。 3.记住Oracle Applications会有很多索引,定期rebuild index会对性能有好处,当然做这项工作应该在系统的空闲时间。 4.不要为了提高性能而在没有询问oracle Support前试着去增加额外的indexes。如果你一定要去做,那千万记住要有文档作记录,因为在这之后你再打patch的时候它可能会把你做的修改自动复原。 5. 知道怎么样是正确的打patch,先计划打哪个patch,然后取得patch,接着打patch,测试,最后文档记录。 6. 要知道任何时刻数据库都可能会有一些object 是invalid的,你的一些操作也会增加invalid objects,定期检查这些invalid objects的数量,然后定期用utlrp去重新编译,utlrp.squ在ORACLE HOME的rdbms/admin下,需要用SYS运行。在你的DB运行过程中如果碰到错误,就可以先重新编译invalid objects,如果没有解决问题再去递交iTAR(Internet created Technical Assistance Request). 7.能看懂日志。 8.了解Apps database的环境,包括操作系统和DB的,当你对你的工作环境了如指掌后,一切也就变得容易了,那时,你就是一个悠闲的Apps DBA了。 另外,对于APPS DB(应用程序数据库)来说,你可能需要创建或拷贝(克隆)多个生产库以外的数据库,比如测试和开发数据库,当然,需要多少数据库是由你的商业需求所决定的。开发环境数据库是供开发人员进行report,PL/SQL等开发的,这个环境可以在开发人员觉得数据已经不再满足开发需求的时候,当然也可以在这个环境测试补丁(patches)。当然最终使用patch的时候还需要在测试环境做测试,因为测试数据库是和生产数据库环境最接近的。(上面说的克隆cloning是一种将applications layer和database layer完全复制的一种方法。)所以,当你拥有这三个数据库的时候,打patch的步骤是先development database再test database最后才在production database环境应用。 构架应用体系 如果你研究过Oracle Forms,使用过Application Server和Devel
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值