中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Oracle怎樣部署Statspack并生成報告

發布時間:2021-11-30 11:14:32 來源:億速云 閱讀:199 作者:柒染 欄目:關系型數據庫

Oracle怎樣部署Statspack并生成報告,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

Oracle 部署 Statspack


[實驗環境]
操作系統 RedHat 5.5
主機名 lxh
數據庫版本 Oracle 10.2.0
字符集 GHS16GBK
生產庫實例名 prod

[實驗過程]
1.部署statspack

1.1、創建一個專門用于statspack的表空間statspack

SYS@ prod>create tablespace statspack datafile '/u01/app/oracle/oradata/prod/statspack01.dbf' size 300m;

1.2、以sysdba身份執行創建prefstat對象的腳本
SYS@ prod>@?/rdbms/admin/spcreate.sql
Choose the PERFSTAT user's password
-----------------------------------
Not specifying a password will result in the installation FAILING

Enter value for perfstat_password:oracle
oracle
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
------------------------------ --------- ----------------------------
EXAMPLE                        PERMANENT
STATSPACK                      PERMANENT
SYSAUX                         PERMANENT *
TBS1                           PERMANENT
TEST3                          PERMANENT
USERS                          PERMANENT

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

Enter value for default_tablespace:statspack
Using tablespace STATSPACK as PERFSTAT default tablespace.
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:回車
… …
NOTE:
SPCPKG complete. Please check spcpkg.lis for any errors.
PERFSTAT@ prod>

Statstack安裝完成。

1.3、設置statspack自動產生快照的間隔時間為15分鐘

[oracle@James ~]$vi /u01/app/oracle/product/10.2.0/db_1/rdbms/admin/spauto.sql
variable jobno number;
variable instno number;
begin
 select instance_number into :instno from v$instance;
 dbms_job.submit(:jobno, 'statspack.snap;',trunc(sysdate+1/96,'MI'), 'trunc(SYSDATE+1/96,''MI'')', TRUE, :instno);
 commit;
end;
/
1.4、設置快照的默認級別為7級

SYS@ prod>exec statspack.modify_statspack_parameter(i_snap_level=>7);


2.產生statspack報告

2.1、啟動statspack的自動快照

SCOTT@ prod>conn perfstat/oracle
PERFSTAT@ prod>@?/rdbms/admin/spauto

2.2、驗證statspack自動生成的報告

PERFSTAT@prod>alter session set nls_date_format='yyyy-mm-dd hh34:mi:ss';
PERFSTAT@prod>select snap_id,snap_time,snap_level from stats$snapshot order by snap_time;

  SNAP_ID SNAP_TIME           SNAP_LEVEL
---------- ------------------- ----------
        1 2014-08-25 17:52:02          7
        2 2014-08-25 19:05:03          7
        3 2014-08-25 19:20:04          7
        4 2014-08-25 19:35:05          7
        5 2014-08-25 19:50:05          7
        6 2014-08-25 20:05:01          7

2.3、生成statspack分析報告
SQL>@?/rdbms/admin/spreport

Current Instance
~~~~~~~~~~~~~~~~
  DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 199802235 PROD                1 prod
Instances in this Statspack schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  DB Id    Inst Num DB Name      Instance     Host
----------- -------- ------------ ------------ ------------
 199802235        1 PROD         prod         lxh

Using  199802235 for database Id
Using          1 for instance number
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.
Listing all Completed Snapshots
                                                      Snap
Instance     DB Name        Snap Id   Snap Started    Level Comment
------------ ------------ --------- ----------------- ----- --------------------
prod         PROD                 1 25 Aug 2014 17:52     7

                                 2 25 Aug 2014 19:05     7
                                 3 25 Aug 2014 19:20     7
                                 4 25 Aug 2014 19:35     7
                                 5 25 Aug 2014 19:50     7
                                 6 25 Aug 2014 20:05     7
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap:2
Enter value for end_snap: 3
Enter value for report_name:

@?/rdbms/admin/spreport

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 3
Enter value for end_snap: 4
Enter value for report_name:

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 4
Enter value for end_snap: 5
Enter value for report_name:

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 5
Enter value for end_snap: 6
Enter value for report_name:

2.4、取消statspack自動生成快照
查看job ID
PERFSTAT@ prod>select job,log_user,last_date,next_date from user_jobs;

      JOB LOG_USER                       LAST_DATE           NEXT_DATE
---------- ------------------------------ ------------------- -------------------
       22 PERFSTAT                       2014-08-25 20:05:01 2014-08-25 20:20:00

PERFSTAT@ prod>exec dbms_job.remove('22');

關于Oracle怎樣部署Statspack并生成報告問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

泾源县| 志丹县| 丰原市| 平乐县| 买车| 德钦县| 安岳县| 邹平县| 兴文县| 浦江县| 天峻县| 图们市| 苏尼特左旗| 塔河县| 武鸣县| 临高县| 专栏| 东丽区| 泰宁县| 上犹县| 建始县| 株洲市| 黄陵县| 海原县| 新竹县| 汶川县| 渝中区| 莱州市| 中牟县| 巴彦淖尔市| 顺昌县| 鄂托克前旗| 曲阳县| 于田县| 尼玛县| 赣州市| 镇原县| 通山县| 伊通| 福贡县| 永吉县|