SlideShare ist ein Scribd-Unternehmen logo
1 von 3
Anar Godajev
http://anargodjaev.wordpress.com/
Statspack Reports
/*
When installing the Statspack package, you can either change to
theORACLE_HOME/rdbms/admin directory, or fully specify
theORACLE_HOME/rdbms/admin DIRECTORY WHEN calling the installation script,
SPCREATE.SQL.
*/
-- install statspack
@?/rdbms/ADMIN/spcreate
/*
Enter appropriate information when prompted for the PERFSTAT user's
password, default tablespace, and temporary tablespace.
The SPCREATE.SQL install script runs the following scripts automatically:
*/
/*
SPCUSR.SQL: Creates the user and grants privileges
SPCTAB.SQL: Creates the tables
SPCPKG.SQL: Creates the package
*/
-- To install without prompting
SQL> CONNECT / AS SYSDBA
SQL> define default_tablespace='TOOLS'
SQL> define temporary_tablespace='TEMP'
SQL> define perfstat_password='my_perfstat_password'
SQL>@?/rdbms/ADMIN/spcreate
/*
-- automatic collection of statistics
oracle_home/rdbms/admin/spauto.sql
*/
-- executing statspack
SQL> CONNECT perfstat/my_perfstat_password
SQL> EXECUTE statspack.snap;
-- For better performance analysis, set the initialization parameter
TIMED_STATISTICS to TRUE.
-- Statspack will then include important timing information in the data it
collects.
-- create statspack report
SQL> CONNECT perfstat/my_perfstat_password
SQL>@?/rdbms/ADMIN/spreport
-- statspack in a pl/sql block
DECLARE
variablesnap NUMBER;
BEGIN
snap:= statspack.snap;
dbms_output.put_line(snap);
END;
Anar Godajev
http://anargodjaev.wordpress.com/
-- automaticstatspac
-- A sample script on how to do this is supplied in SPAUTO.SQL
-- create statspack report without prompt
SQL> CONNECT perfstat/my_perfstat_password
SQL> define begin_snap=1
SQL> define end_snap=2
SQL> define report_name=batch_run
SQL>@?/rdbms/ADMIN/spreport
/*
When you examine the instance report, you often find high-load SQL
statements that you want to examine more closely. The SQL report,
SPREPSQL.SQL, displays statistics, the complete SQL text, and (if a level
six snapshot has been taken), information on any SQL plan(s) associated
with that statement.
*/
SQL> CONNECT perfstat/my_perfstat_password
Connected.
SQL>@?/rdbms/ADMIN/sprepsql
-- truncate all statspack data
SQL> CONNECT perfstat/my_perfstat_password
SQL>@?/rdbms/ADMIN/sptrunc
-- remove statspack
SQL> CONNECT / AS SYSDBA
SQL>@?/rdbms/ADMIN/spdrop
/*
SPDTAB.SQL - drops tables and public synonyms
SPDUSR.SQL - drops the user
*/
-- Purge unnecessary data by using the SPPURGE.SQL script
SQL> CONNECT perfstat/my_perfstat_password
SQL> SET TRANSACTION USE ROLLBACK SEGMENT rbig;
SQL>@?/rdbms/admin/spurge
SQL> CONNECT perfstat/my_perfstat_password
SQL> DEFINE losnapid=1
SQL> DEFINE hisnapid=2
SQL>@?/rdbms/admin/spurge
-- snap parameters
EXECUTE STATSPACK.SNAP(i_ucomment=>'this is a temporary commment');
EXECUTE STATSPACK.MODIFY_STATSPACK_PARAMETER(i_ucomment=>'this is a
commment that is saved');
EXECUTE STATSPACK.SNAP(i_snap_level=>10, i_modify_parameter=>'true');
EXECUTE STATSPACK.SNAP(i_snap_level=>6);
Levels
Levels
Levels
Levels

>=
>=
>=
>=

0
5
6
7

General Performance STATISTICS
Additional Data: SQL Statements
Additional Data: SQL Plans AND SQL PLAN Usage
Additional data: SEGMENT LEVEL STATISTICS
Anar Godajev
http://anargodjaev.wordpress.com/
Levels >= 10 Additional STATISTICS: Parent AND Child Latches

Weitere ähnliche Inhalte

Mehr von Anar Godjaev

Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Anar Godjaev
 
Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Anar Godjaev
 
Instance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeInstance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeAnar Godjaev
 
Conditional Control
Conditional ControlConditional Control
Conditional ControlAnar Godjaev
 
Audit Mekani̇zmasi
Audit Mekani̇zmasiAudit Mekani̇zmasi
Audit Mekani̇zmasiAnar Godjaev
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and RecoveryAnar Godjaev
 
Oracle Managed Files
Oracle Managed FilesOracle Managed Files
Oracle Managed FilesAnar Godjaev
 
Recovery Manager (RMAN)
Recovery Manager (RMAN)Recovery Manager (RMAN)
Recovery Manager (RMAN)Anar Godjaev
 
Oracle Enterprise Linux 5
Oracle Enterprise Linux 5Oracle Enterprise Linux 5
Oracle Enterprise Linux 5Anar Godjaev
 

Mehr von Anar Godjaev (20)

Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇
 
Contraints
ContraintsContraints
Contraints
 
Oracle SQL
Oracle SQLOracle SQL
Oracle SQL
 
Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇
 
Instance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeInstance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını Inceleme
 
Conditional Control
Conditional ControlConditional Control
Conditional Control
 
PL/SQL Blocks
PL/SQL BlocksPL/SQL Blocks
PL/SQL Blocks
 
Wait Interface
Wait InterfaceWait Interface
Wait Interface
 
Audit Mekani̇zmasi
Audit Mekani̇zmasiAudit Mekani̇zmasi
Audit Mekani̇zmasi
 
Tuning SGA
Tuning SGATuning SGA
Tuning SGA
 
Parallel Server
Parallel ServerParallel Server
Parallel Server
 
Table Partitions
Table PartitionsTable Partitions
Table Partitions
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and Recovery
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
LogMiner
LogMinerLogMiner
LogMiner
 
Undo Management
Undo ManagementUndo Management
Undo Management
 
ASM
ASMASM
ASM
 
Oracle Managed Files
Oracle Managed FilesOracle Managed Files
Oracle Managed Files
 
Recovery Manager (RMAN)
Recovery Manager (RMAN)Recovery Manager (RMAN)
Recovery Manager (RMAN)
 
Oracle Enterprise Linux 5
Oracle Enterprise Linux 5Oracle Enterprise Linux 5
Oracle Enterprise Linux 5
 

Kürzlich hochgeladen

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Kürzlich hochgeladen (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Statspack Reports

  • 1. Anar Godajev http://anargodjaev.wordpress.com/ Statspack Reports /* When installing the Statspack package, you can either change to theORACLE_HOME/rdbms/admin directory, or fully specify theORACLE_HOME/rdbms/admin DIRECTORY WHEN calling the installation script, SPCREATE.SQL. */ -- install statspack @?/rdbms/ADMIN/spcreate /* Enter appropriate information when prompted for the PERFSTAT user's password, default tablespace, and temporary tablespace. The SPCREATE.SQL install script runs the following scripts automatically: */ /* SPCUSR.SQL: Creates the user and grants privileges SPCTAB.SQL: Creates the tables SPCPKG.SQL: Creates the package */ -- To install without prompting SQL> CONNECT / AS SYSDBA SQL> define default_tablespace='TOOLS' SQL> define temporary_tablespace='TEMP' SQL> define perfstat_password='my_perfstat_password' SQL>@?/rdbms/ADMIN/spcreate /* -- automatic collection of statistics oracle_home/rdbms/admin/spauto.sql */ -- executing statspack SQL> CONNECT perfstat/my_perfstat_password SQL> EXECUTE statspack.snap; -- For better performance analysis, set the initialization parameter TIMED_STATISTICS to TRUE. -- Statspack will then include important timing information in the data it collects. -- create statspack report SQL> CONNECT perfstat/my_perfstat_password SQL>@?/rdbms/ADMIN/spreport -- statspack in a pl/sql block DECLARE variablesnap NUMBER; BEGIN snap:= statspack.snap; dbms_output.put_line(snap); END;
  • 2. Anar Godajev http://anargodjaev.wordpress.com/ -- automaticstatspac -- A sample script on how to do this is supplied in SPAUTO.SQL -- create statspack report without prompt SQL> CONNECT perfstat/my_perfstat_password SQL> define begin_snap=1 SQL> define end_snap=2 SQL> define report_name=batch_run SQL>@?/rdbms/ADMIN/spreport /* When you examine the instance report, you often find high-load SQL statements that you want to examine more closely. The SQL report, SPREPSQL.SQL, displays statistics, the complete SQL text, and (if a level six snapshot has been taken), information on any SQL plan(s) associated with that statement. */ SQL> CONNECT perfstat/my_perfstat_password Connected. SQL>@?/rdbms/ADMIN/sprepsql -- truncate all statspack data SQL> CONNECT perfstat/my_perfstat_password SQL>@?/rdbms/ADMIN/sptrunc -- remove statspack SQL> CONNECT / AS SYSDBA SQL>@?/rdbms/ADMIN/spdrop /* SPDTAB.SQL - drops tables and public synonyms SPDUSR.SQL - drops the user */ -- Purge unnecessary data by using the SPPURGE.SQL script SQL> CONNECT perfstat/my_perfstat_password SQL> SET TRANSACTION USE ROLLBACK SEGMENT rbig; SQL>@?/rdbms/admin/spurge SQL> CONNECT perfstat/my_perfstat_password SQL> DEFINE losnapid=1 SQL> DEFINE hisnapid=2 SQL>@?/rdbms/admin/spurge -- snap parameters EXECUTE STATSPACK.SNAP(i_ucomment=>'this is a temporary commment'); EXECUTE STATSPACK.MODIFY_STATSPACK_PARAMETER(i_ucomment=>'this is a commment that is saved'); EXECUTE STATSPACK.SNAP(i_snap_level=>10, i_modify_parameter=>'true'); EXECUTE STATSPACK.SNAP(i_snap_level=>6); Levels Levels Levels Levels >= >= >= >= 0 5 6 7 General Performance STATISTICS Additional Data: SQL Statements Additional Data: SQL Plans AND SQL PLAN Usage Additional data: SEGMENT LEVEL STATISTICS
  • 3. Anar Godajev http://anargodjaev.wordpress.com/ Levels >= 10 Additional STATISTICS: Parent AND Child Latches