Home Database Mysql Tutorial 分析Oracle生成Statpack步骤

分析Oracle生成Statpack步骤

Jun 07, 2016 pm 05:55 PM
oracle step Configuration

本文将介绍ORACLE配置STATSPACK步骤,需要了解更多的朋友可以参考下

1、telnet到远程的数据库服务器
CMD>telnet 远程数据库的IP
2、切换到数据库的用户
DQXXDBS01:/> su - oracle
3、用超级用户进入数据库
$ sqlplus "/as sysdba"
4、查看参数,是否可以用job(可以用job进行自动的收集Statpack Report的数据)
SQL> show parameter job_queue_processes
5、该参数可以收集操作系统的信息
SQL> show parameter timed_statistics
6、为了创建表空间,表空间的数据文件放在哪比较好
代码如下:
SQL> select file_name from dba_data_files;

7、查看哪个目录的空间比较大,确定perfstat表空间的数据文件的位置
$ df -g
8、创建表空间:
代码如下:
SQL> create tablespace perfstat datafile '/oracle/product/10.2.0/db_1/dbs/perfstat.dbf'size 500M;

--表空间用于存储快照时搜集的数据
9、创建Statspack需要的脚本
SQL> @:/oracle/product/10.2.0/db_1/rdbms/admin/spcreate.sql --"/oracle/product/10.2.0/db_1/rdbms/admin/"为脚本目录
运行该脚本后,输入perfstat_password、default_tablespace、temporary_tablespace
10、测试是否成功,生成数据库的一个快照
SQL> execute statspack.snap
11、再生成一个快照
SQL> execute statspack.snap
12、取两个快照之间时间段的Statspack报告
SQL> @/oracle/product/10.2.0/db_1/rdbms/admin/spreport.sql
输入生成Statspack报告的起始点和终止点,如上生成了两个时间点的快照,输入begin_snap:1和end_snap:2,然后输入生成快照的名称(如1.txt)
--备注:如果没有指定报告放置的位置,则该报告在启动sqlplus时所在的路径
13、用job进行定时产生Statspack的快照,便于收集数据(默认为1小时产生一个快照)
SQL> @/oracle/product/10.2.0/db_1/rdbms/admin/spauto.sql
14、删除历史数据
select max(snap_id) from stats$snapshot;--删除stats$snapshot表中的相应数据,其他表中的相应数据也会级连删除
delete from stats$snapshot where snap_id也可以通过执行sptrunc.sql该脚本直接删除这些统计表的信息
注意事项:
1、生成需要的Statspack之后,记住移除任务,查看任务:
SQL> select job, log_user, priv_user, last_date,next_date, interval from user_jobs;
2、移除生成Statspack快照的任务:
SQL> execute dbms_job.remove('41')
3、如果在运行spcreate.sql这个脚本出错的话,可以通过运行spdrop.sql这个脚本删除创建的对象,然后再执行spcreate.sql
4、运行spcreate.sql这个脚本后,可以查找相关的lis文件查看安装信息(在sqlplus默认路径下)
其他相关的一些脚本
1、spuexp.par脚本 --可用于导出statpack报告相关的数据的dmp,如下所示
exp userid=perfstat/fyzh parfile=spuexp.par
注意:spuexp.par文件必须在sqlplus登陆的当前路径。如登陆的sqlplus路径是C:\Documents and Settings\Administrator,
那么spuexp.par就要在该目录下,否则提示“LRM-00109: 无法打开参数文件 'spuexp.par'”
2、sprepsql.sql脚本 --用于根据给定的sql hash值生成sql报告
调整STATSPACK的收集门限
Statspack有两种类型的收集选项:
级别(level):控制收集数据的类型
门限(threshold):设置收集的数据的阈值.
1、级别(level)
Statspack共有三种快照级别,默认值是5
a.level 0: 一般性能统计.包括等待事件、系统事件、系统统计、回滚段统计、行缓存、SGA、会话、锁、缓冲池统计等等.
b.level 5: 增加SQL语句.除了包括level0的所有内容,还包括SQL语句的收集,收集结果记录在stats$sql_summary中.
c.level 10: 增加子锁存统计.包括level5的所有内容.并且还会将附加的子锁存存入stats$lathc_children中.在使用这个级别时需要慎重,建议在Oracle support的指导下进行.
可以通过statspack包修改缺省的级别设置
SQL> execute statspack.snap(i_snap_level=>0,i_modify_parameter=>'true');
如果你只是想本次改变收集级别,可以忽略i_modify_parameter参数.
SQL> execute statspack.snap(i_snap_level=>0);
2、快照门限
快照门限只应用于stats$sql_summary表中获取的SQL语句.
因为每一个快照都会收集很多数据,每一行都代表获取快照时数据库中的一个SQL语句,所以stats$sql_summary很快就会成为Statspack中最大的表.
门限存储在stats$statspack_parameter表中:
executions_th这是SQL语句执行的数量(默认值是100)
disk_reads_tn这是SQL语句执行的磁盘读入数量(默认值是1000)
parse_calls_th这是SQL语句执行的解析调用的数量(默认值是1000)
buffer_gets_th这是SQL语句执行的缓冲区获取的数量(默认值是10000)
任何一个门限值超过以上参数就会产生一条记录.
通过调用statspack.modify_statspack_parameter函数改变门限的默认值:
代码如下:
SQL>execute statspack.modify_statspack_parameter(i_buffer_gets_th=>100000,i_disk_reads_th=>100000);
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

This Apple ID is not yet in use in the iTunes Store: Fix This Apple ID is not yet in use in the iTunes Store: Fix Jun 10, 2024 pm 05:42 PM

When logging into iTunesStore using AppleID, this error saying "This AppleID has not been used in iTunesStore" may be thrown on the screen. There are no error messages to worry about, you can fix them by following these solution sets. Fix 1 – Change Shipping Address The main reason why this prompt appears in iTunes Store is that you don’t have the correct address in your AppleID profile. Step 1 – First, open iPhone Settings on your iPhone. Step 2 – AppleID should be on top of all other settings. So, open it. Step 3 – Once there, open the “Payment & Shipping” option. Step 4 – Verify your access using Face ID. step

Steps to upgrade to the latest version of WeChat (Easily master the upgrade method to the latest version of WeChat) Steps to upgrade to the latest version of WeChat (Easily master the upgrade method to the latest version of WeChat) Jun 01, 2024 pm 10:24 PM

WeChat is one of the social media platforms in China that continuously launches new versions to provide a better user experience. Upgrading WeChat to the latest version is very important to keep in touch with family and colleagues, to stay in touch with friends, and to keep abreast of the latest developments. 1. Understand the features and improvements of the latest version. It is very important to understand the features and improvements of the latest version before upgrading WeChat. For performance improvements and bug fixes, you can learn about the various new features brought by the new version by checking the update notes on the WeChat official website or app store. 2. Check the current WeChat version We need to check the WeChat version currently installed on the mobile phone before upgrading WeChat. Click to open the WeChat application "Me" and then select the menu "About" where you can see the current WeChat version number. 3. Open the app

How long will Oracle database logs be kept? How long will Oracle database logs be kept? May 10, 2024 am 03:27 AM

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

Shazam app not working in iPhone: Fix Shazam app not working in iPhone: Fix Jun 08, 2024 pm 12:36 PM

Having issues with the Shazam app on iPhone? Shazam helps you find songs by listening to them. However, if Shazam isn't working properly or doesn't recognize the song, you'll have to troubleshoot it manually. Repairing the Shazam app won't take long. So, without wasting any more time, follow the steps below to resolve issues with Shazam app. Fix 1 – Disable Bold Text Feature Bold text on iPhone may be the reason why Shazam is not working properly. Step 1 – You can only do this from your iPhone settings. So, open it. Step 2 – Next, open the “Display & Brightness” settings there. Step 3 – If you find that “Bold Text” is enabled

The order of the oracle database startup steps is The order of the oracle database startup steps is May 10, 2024 am 01:48 AM

The Oracle database startup sequence is: 1. Check the preconditions; 2. Start the listener; 3. Start the database instance; 4. Wait for the database to open; 5. Connect to the database; 6. Verify the database status; 7. Enable the service (if necessary ); 8. Test the connection.

WiFi calling not working on iPhone: Fix WiFi calling not working on iPhone: Fix Jun 03, 2024 am 11:16 AM

Can't enable Wi-Fi calling on iPhone? Call quality is improved and you can communicate even from remote locations where cellular networks are not as strong. Wi-Fi Calling also improves standard call and video call quality. So, if you can't use Wi-Fi calling on your phone, these solutions might help you fix the problem. Fix 1 – Enable Wi-Fi Calling Manually You must enable the Wi-Fi Calling feature in your iPhone settings. Step 1 – For this, you have to open Settings. Step 2 – Next, just scroll down to find and open the “Phone” settings Step 3 – In the phone settings, scroll down and open the “Wi-Fi Calling” setting. Step 4 – In the Wi-Fi Calling page, change “This iPhone

How much memory does oracle require? How much memory does oracle require? May 10, 2024 am 04:12 AM

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

Clear gray Safari history in iPhone: Fixes Clear gray Safari history in iPhone: Fixes Jun 08, 2024 pm 06:44 PM

Is the Clear History button gray in Safari on iPhone? If this is the case, you won't be able to clear history in Safari at all. Stored cookies and website data may cause unsolicited events in your browser. However, if you follow the steps below, you can easily resolve the issue and delete stored user history from Safari. Fix 1 – Disable Content Restrictions Content restrictions on iPhone may limit the correct use of Safari browser. Step 1 – Open iPhone settings. Step 2 – Next, go to Screen Time settings. Step 3 – In Screen Time settings, turn on Content & Privacy Restrictions

See all articles