11g--statspack安装

11g2中安装statspack,最好还是sys用户安装。安装过程如下:

1:首先创建表空间 用于放置statspack所产生的数据:
create tablespace perfstat datafile '/u01/app/oracle/oradata/orcl/perfstat01.dbf' size 500m;

2:执行
SQL> @?/rdbms/admin/spcreate.sql    其中@:表示执行某个sql  ?:号表示ORACLE_HOME变量
  在执行该sql时  oracle会自动创建用户perfstat并要求你定义一个密码
Choose the PERFSTAT user's password
-----------------------------------
Not specifying a password will result in the installation FAILING


Enter value for perfstat_password:   perfstat

然后 会叫你 指定perfstat的默认表空间 那就把刚刚指定的表空间给他:
Choose the Default tablespace for the PERFSTAT user
---------------------------------------------------
Below is the list of online tablespaces in this database which can
store user data.  Specifying the SYSTEM tablespace for the user's
default tablespace will result in the installation FAILING, as
using SYSTEM for performance data is not supported.


Choose the PERFSTAT users's default tablespace.  This is the tablespace
in which the STATSPACK tables and indexes will be created.


TABLESPACE_NAME                CONTENTS  STATSPACK DEFAULT TABLESPACE
------------------------------ --------- ----------------------------
PRESTAT                        PERMANENT
SYSAUX                         PERMANENT *
USERS                          PERMANENT


Pressing <return> will result in STATSPACK's recommended default
tablespace (identified by *) being used.


Enter value for default_tablespace: perfstat


oracle还会指定临时表空间,一般都使用系统自带的表空间 就行:

Choose the Temporary tablespace for the PERFSTAT user
-----------------------------------------------------
Below is the list of online tablespaces in this database which can
store temporary data (e.g. for sort workareas).  Specifying the SYSTEM
tablespace for the user's temporary tablespace will result in the
installation FAILING, as using SYSTEM for workareas is not supported.


Choose the PERFSTAT user's Temporary tablespace.


TABLESPACE_NAME                CONTENTS  DB DEFAULT TEMP TABLESPACE
------------------------------ --------- --------------------------
TEMP                           TEMPORARY *


Pressing <return> will result in the database's default Temporary
tablespace (identified by *) being used.


Enter value for temporary_tablespace: TEMP

如果安装失败的话:可以在sqlplus下运行: @?/rdbms/admin/spdrop.sql
安装完成后运行statspack需注意:
2次执行的间隔时间控制在20分钟内。不能跨越停机时间(就是不能再执行过程中关机)
手动执行采集:
execute statspack.snap 
执行该命令后 oracle会手机系统的信息(最少要执行2次该命令 oracle才能产生报告)

产生报表:
@?/rdbms/admin/spreport
执行该命令后,oracle会叫你输入开始的快照id,和 结束的快照id(oracle后利用这2个快照产生报表):
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 1
Begin Snapshot Id specified: 1

Enter value for end_snap: 2
End   Snapshot Id specified: 2
然后oracle会要求你指定报表名字,该名字默认 是  sp_<start id>_<end id>.lst  即:sp_1_2.lst。11g中该文件在默认放在:os中oracle用户的根目录下:即:

[root@test ~]# su - oracle
[oracle@test ~]$ pwd
/home/oracle
[oracle@test ~]$ ll
总计 632
-rw-r--r-- 1 oracle dba 143984 04-17 14:54 sp_1_2.lst
-rw-r--r-- 1 oracle dba    195 04-17 14:44 spcpkg.lis
-rw-r--r-- 1 oracle dba   5377 04-17 14:44 spctab.lis
-rw-r--r-- 1 oracle dba   2541 04-17 14:44 spcusr.lis
-rw-r--r-- 1 oracle dba  19878 04-17 14:42 spdtab.lis
-rw-r--r-- 1 oracle dba   2062 04-17 14:42 spdusr.lis

由于产生的Snapshot 还是相当的占用空间的,所以有必要把不需要的snapshot删除;有2个等级:
1:删除一行:delete stats$snapshot where snap_id=1;

2:truncate所有表,运行:@?/rdbms/admin/sptrunc.sql  该sql是直接将persstat用户的所有表都清空!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值