How do I check the performance statistics of an Amazon RDS DB instance that is running Oracle?

4 minutos de lectura
0

I want to analyze and tune the performance of my Amazon Relational Database Service (Amazon RDS) instance that is running Oracle. How can I check the performance statistics of an Amazon RDS instance that is running Oracle?

Short description

You can use Oracle Statspack on an Amazon RDS DB instance to collect, store, and display performance data. Statspack generates reports based on Statspack snapshots, which you can then use to analyze your DB instance's performance over a period of time. For more information, see the Oracle documentation for Oracle Statspack.

Resolution

Use Oracle Statspack on an Amazon RDS

1.    If Statspack is installed, and the PERFSTAT account is associated with Statspack, then skip to Step 3. If Statspack isn't installed, and the PERFSTAT account exists, then drop the account by running this command:

SQL> DROP USER perfstat CASCADE;

2.    Add the Statspack option to the DB option group. If you don't have an option group, create a new option group, and then assign the option group to the DB instance.

3.    When you add the Statspack option, Amazon RDS instances running Oracle automatically install Statspack. This creates a perfstat user to collect database statistics and to generate reports. But, be aware that the perfstat user is locked by default. To unlock the perfstat user, log in to the DB instance as the Amazon RDS primary user and then reset the password for the perfstat user by running a query similar to this:

ALTER USER perfstat IDENTIFIED BY <new_password> ACCOUNT UNLOCK;

Note: Be sure to replace new_password with your own password.

4.    If you are using Oracle Database 12c Release 2 (12.2) or lower, skip this step. If you are using Oracle Database 19c or higher, then grant the CREATE JOB privilege to the PERFSTAT account by running this statement:

GRANT CREATE JOB TO PERFSTAT;

5.    Because of Oracle Bug 28523746, the idle wait events in PERFSTAT.STATS$IDLE_EVENT might not be populated. To be sure that the idle wait events in the PERFSTAT.STATS$IDLE_EVENT table are populated, run this statement:

INSERT INTO PERFSTAT.STATS$IDLE_EVENT (EVENT)
SELECT NAME FROM V$EVENT_NAME WHERE WAIT_CLASS='Idle'
MINUS
SELECT EVENT FROM PERFSTAT.STATS$IDLE_EVENT;
COMMIT;

6.    While logged in as the perfstat user, run this command to manually take a Statspack snapshot:

SQL> exec statspack.snap (i_snap_level => 7, i_modify_parameter => 'TRUE');

Note: You can also change the Statspack snapshot capture level to get more detailed information. This example command takes a Statspack snapshot at level 7, which includes usage, row locks, and segment-level I/O statistics for SQL.

7.    Optionally, configure Oracle to take Statspack snapshot automatically. This procedure creates a job that automatically takes one Statspack snapshot per hour:

SQL> set serveroutput on 
SQL> variable jn number; 
SQL> execute dbms_job.submit (:jn, 'statspack.snap;', sysdate, 'trunc(SYSDATE+1/24,''HH24'')');
SQL> execute dbms_output.put_line ('statspack job number:' || :jn);
SQL> commit;

6.    To see the available Statspack snapshots, run this command:

SQL> set linesize 32767; 
SQL> alter session set nls_date_format = 'YYYY/MM/DD HH24:MI:SS';
SQL> select snap_id, snap_time from stats$snapshot order by 1;
    SNAP_ID SNAP_TIME
---------- -------------------
        :: ::
        11 2019/06/03 03:18:30
        12 2019/06/03 04:18:30
        :: ::

7.    After more than two Statspack snapshots are created, create a Statspack report by running a command similar to this:

SQL> exec RDSADMIN.RDS_RUN_SPREPORT (11,12);

Note: This example command creates a report using SNAP_IDs of 11 and 12, and the report name is similar to trace/ORCL_spreport

_

.lst.

8.    To view and download the report, open the Amazon RDS console, and then choose Databases from the navigation pane. Choose the DB instance, and then choose the Logs & Events tab.

9.    Stored Statspack snapshots aren't deleted automatically, which can consume storage space on your DB instance. To manually purge the Statspack snapshots, specify a start SNAP_ID and an end SNAP_ID similar to this:

SQL> execute statspack.purge(<INITIAL_SNAP_ID>, <END_SNAP_ID>);

Stop using Oracle Statspack on Amazon RDS

1.    To stop the automatic creation of snapshots, delete the job that you created. To get the job number, run this command:

SQL> select job, what FROM user_jobs;

2.    To delete the job, run this command:

SQL> execute dbms_job.remove (<job_id>);

Note: Be sure to replace job_id with your own job ID.

After you remove the Statspack option from the DB option group, the perfstat user and all stored Statspack snapshots are purged.


Related information

Oracle Statspack

OFICIAL DE AWS
OFICIAL DE AWSActualizada hace 2 años