Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Oracle deploys Statspack and generates reports

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article describes in detail the corresponding analysis and answers to the question of how Oracle deploys Statspack and generates reports, hoping to help more partners who want to solve this problem to find a simpler and easier way.

Oracle deployment Statspack

[experimental environment]

Operating system RedHat 5.5

Hostname lxh

Database version Oracle 10.2.0

Character set GHS16GBK

Production library instance name prod

[experimental process]

1. Deploy statspack

1.1.Create a tablespace statspack dedicated to statspack

SYS@ prod > create tablespace statspack datafile'/ u01 size

1.2. execute the script to create the prefstat object as sysdba

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 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 will result in the database's default Temporary

Tablespace (identified by *) being used.

Enter value for temporary_tablespace: enter

... ...

NOTE:

SPCPKG complete. Please check spcpkg.lis for any errors.

PERFSTAT@ prod >

The Statstack installation is complete.

1.3.Setting the interval for statspack to generate snapshots automatically is 15 minutes.

[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. Set the default level of snapshots to level 7

SYS@ prod > exec statspack.modify_statspack_parameter (iSnapshot level = > 7)

two。 Generate statspack report

2.1.Starting the automatic snapshot of statspack

SCOTT@ prod > conn perfstat/oracle

PERFSTAT@ prod > @? / rdbms/admin/spauto

2.2.Verification of reports automatically generated by 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.Generate statspack analysis report

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 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:

Cancel the automatic generation of snapshots by statspack

View 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')

This is the answer to the question about how Oracle deploys Statspack and generates a report. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report