AWS Database Blog
Analyzing performance management in Oracle SE using Amazon RDS for Oracle
Organizations are aggressively adopting cloud as a standard and actively evaluating their database needs. Amazon RDS for Oracle is a managed service that makes it easy to quickly create Oracle Database instances, enabling you to migrate existing on-premises workloads to the cloud. Migration from on-premises Oracle Database to Amazon RDS for Oracle is quick because it doesn’t involve code conversion.
Oracle Database Enterprise Edition (Oracle EE) has become the standard for many organizations. However, if you do a more in-depth database assessment, you may find that not every application needs all the features of the Oracle EE, and you may be overpaying.
You can significantly reduce your Oracle commercial license usage switching to Oracle Database Standard Edition (Oracle SE), which is even easier with the Amazon RDS for Oracle License Included (LI) option. Applications with no or minimum Oracle EE features usage are excellent candidates for migrating to Oracle SE.
This post discusses the Oracle performance analysis offerings available within Oracle SE. We can use Oracle Statspack, an option pack in Oracle SE, in place of Oracle Automatic Workload Repository (AWR) and Oracle Active Session History (ASH) reports provide performance insights for Amazon RDS for Oracle at no cost in Oracle SE. You can use Statspack in place of ASH and AWR reports. You can also use SQLT, which is an add-on action for response analysis.
Solution overview
To implement this solution, we complete the following steps:
- Monitor the performance of a full table and index scan
- Deploy Statspack for Amazon RDS for Oracle
- Use SQLT for Amazon RDS for Oracle
Amazon RDS Performance Insights for Amazon RDS for Oracle
Amazon RDS Performance Insights is an AWS cloud-native database performance monitoring and tuning tool. You can configure Performance Insights for Oracle SE with one click. The tool dashboard enables you to detect performance problems by evaluating top waits, SQLs, hosts, and top users. It provides 22 types of metrics in graph visualization formats. Performance Insights and enhanced monitoring provide almost all the functionality a database administrator needs to do database performance analysis and tuning.
Performance Insights expands on existing Amazon Relational Database Service (Amazon RDS) and Amazon Aurora monitoring features to illustrate your database’s performance and analyze any issues that affect it. With the Performance Insights dashboard, you can visualize the database load and filter the load by waits, SQL statements, hosts, or users.
Performance Insights sends three additional metrics to Amazon CloudWatch:
- DBLoad – Gives the number of active sessions for the database engine. An active session is a connection that has submitted a query to the database for which the database hasn’t yet returned the results. Ideally, the query spends all of its time running on the CPU processing the query instead of waiting. You can get a quick view of the load on the database by seeing how many connections are concurrently active and what states they are in. Further combining this core metric with wait event data provides a complete picture of the state of the database.
- DBLoadCPU – Gives the number of active sessions where the wait event type is CPU. This metric helps you monitor how much time connections are running on the CPU. Ideally, if the host has enough CPU resources, all these connections are running on the CPU.
- DBLoadNonCPU – Gives the number of active sessions where the wait event type is not CPU. This metric helps you monitor connections that are waiting for a database resource.
Configuring Performance Insights for Amazon RDS for Oracle SE
We can configure Performance Insights by selecting the check-box to Enable Performance Insights in the Additional configuration section when we create the database. You can also enable Performance Insights for existing databases without any downtime by using the modify option.
Performance Insights is an independent tab on the left navigation pane. To access the database in Performance Insights, complete the following steps:
- On the Amazon RDS console, choose Performance Insights.
- From the drop-down menu, choose your Oracle SE database.
Choosing the database opens the Performance Insights dashboard, which allows you to view database performance.
You can use Performance Insights to understand the OS and database statistics. For example, to dive deep into OS statistics of the database host, choose Manage Metrics and select the required OS and database level metrics. The following screenshot shows the OS metrics tab.
The following screenshot shows the Database metrics tab.
Monitoring database performance
The following use case shows how to use Performance Insights to monitor database performance. For this post, we used the sample database from Working with the Sample Database for Migration. We demonstrate tuning a full table scan and index scan.
Full table scan
Log in to the database as the user dms_sample
and enter the following code for a full table scan:
On the Performance Insights dashboard, we can see resource utilization during the runtime. We can see an increase in resource usage as soon as the query starts. The query is complete in 7 minutes, 42 seconds. The following screenshot shows the Counter Metrics section.
The following screenshot shows the Database Load section and Top SQL tab.
We can analyze the top waits during the query by viewing the database load and choosing the Top waits tab.
When the query is complete, we can review details like the query plan and elapsed time of the query. See the following code:
Index scan
In this section, we perform an index scan. The query runs faster because it’s soft parsed and the data is in the cache. This query took approximately 5 minutes, 53 seconds to complete.
When the query is complete, you can review the plan and elapsed time of the query. See the following code:
Additional analysis
We can summarize these two scans using 1-hour dashboard graphs that show variance in resource usage, and highlight different wait events. The following screenshot shows the Counter Metrics section.
The following screenshot shows the Database Load section and Top SQL tab.
The following screenshot shows the Database Load section and Top waits tab.
We can also analyze performance using various metrics based on disk I/O and CPU usage. Hovering your mouse over the points displays the exact value.
The Database Load section shows CPU usage, top waits, top SQL, top hosts, and top users. The following screenshot shows the top 10 SQLs resource consumption slice by wait events. The color legend explains the system and session wait events.
The following screenshot shows SQL resource consumption slice by SQL.
We can also view the graphs by slice by user, slice by host (client), and slice by SQLs. We can choose the Top hosts or Top users tab for more details.
To get SQLID
, choose the Top SQL tab, choose the + icon, and select the SQL query. You can find the SQL statement at the bottom.
Oracle Statspack on Amazon RDS for Oracle
Oracle Statspack provides functionality to store Oracle database performance statistics in tables, which you can use to report and analyze database performance. You can use Statspack in Oracle SE to determine your database performance benchmark. You can reference the Statspack data to troubleshoot your database performance issues by comparing values between two time periods. In Amazon RDS for Oracle, you can install Statspack using an option group. Statspack installation creates a perfstat
schema to store database performance statistics. You need to use the rdsadmin.rds_run_spreport
package to generate the Statspack report between two snap IDs.
This section explains how to configure Statspack on Amazon RDS for Oracle.
Creating option group
To create your option group, complete the following steps:
- On the Amazon RDS console, choose Option groups.
- Choose Create group.
- Enter the group details.
- Choose Create.
- Select the option group you just created and choose Add option.
- For Option name, choose
- Choose Add option.
- Select the database and choose Modify.
- For Option group, choose the Statspack option group.
- Choose Continue.
- Select Apply immediately.
- Choose Modify DB Instance.
- On the Configuration tab, confirm that the option group is added in the database.
Validating the PERFSTAT user
To validate the PERFSTAT
user, complete the following steps:
- Log in to the database and confirm that the Statspack user and objects are created. See the following code:
- Log in to the database as an admin user to reset the perfstat schema password and unlock the account:
- Log in as
PERFSTAT
and configure Statspack:
Accessing the Statspack report
To access the Statspack report, complete the following steps:
- On the Amazon RDS dashboard, select your database.
- On the Logs tab, select the report that contains
spreport
in the name. - Choose Download.
- Choose the link to download and save the log.
- Open the report in your preferred text editor.
Oracle SQLT on Amazon RDS for Oracle
You can use SQLT reports to tune a SQL statement’s explain plan. The report helps identify the step were a statement is taking a long time to run. We can tune the SQL statement by modifying the query or by introducing objects like an index. You can add SQLT using an option group. It creates the SQLTXPLAIN
and SQLTADMIN
schema. You need to install the SQLT client to your Oracle client machine to run the SQLT utility. You can download SQLT.zip
from Oracle Document ID 21518701. For instructions, see Using SQLT.
This section explains how to configure SQLT for Amazon RDS for Oracle.
Creating an option group
You follow similar instructions as before to create your option group:
- On the Amazon RDS console, choose Option groups.
- Choose Create group.
- Enter your group details.
- Choose Create.
- Select the SQLT option group and choose Add option.
- For Option name, choose SQLT.
- For the value of LICENSE_PACK, enter N.
Options D and T require Diagnostics Pack and Tuning Pack licensing.
- For Apply immediately, select Yes.
- Choose Add option.
- Select the database and choose Modify.
- In the Database options section, for Option group, choose sqlt.
- Choose Continue.
- In the Scheduling of modifications section, select Apply immediately.
- Choose Modify DB Instance.
- On the Configuration tab, confirm that the option group is added in the database.
Installing the SQLT client
You can install the SQLT client to any Oracle client machine to run the SQLT utility. Download SQLT.zip
from Oracle Document ID 21518701 and unzip the file in any folder.
Analyzing the SQL statement
You can run the SQLT utility to trace the SQL ID. For instructions, see Using SQLT.
- Log in to the database and get the SQL ID of the SQL statement:
- Grant
SQLT_USER_ROLE
to the schema owner. For this post, I use theDMS_SAMPLE
schema:
You can now analyze the SQL statement using SQLT.
- Run the
sqltxtract.sql
script and provide the input asked during runs. In the following code, I choose all the default options:
When sqltxtract.sql
has run successfully, it creates a .zip file that has all the data required to analyze the SQL statement. For example, for this use case it created the file sqlt_s31633_sqldx_b7bruw4ku0xtn_log.zip
. You can also upload this file to Oracle support when opening a performance tuning ticket.
Conclusion
This post discussed Amazon RDS Performance Insights, Statspack, and the SQLT tool, which you can use to troubleshoot performance issues on Oracle SE on Amazon RDS for Oracle. Each tool comes with a unique feature, and depending on the use case, you either choose one of them or use them in combination.
About the Authors
Srinivas Potlachervoo is a Consultant with the Professional Services team at Amazon Web Services. He works as database migration specialist to help AWS customers to move their on-premises database environment to AWS cloud database solutions.
Bhavesh Rathod is an Oracle Database Cloud Architect with the Professional Services team at Amazon Web Services. He works as database migration specialist to help Amazon customers to move their on-premises database environment to AWS cloud database solutions.
Samujjwal Roy is a Database Specialty Architect with the Professional Services team at Amazon Web Services. He has been with Amazon for 15+ years and has led migration projects for internal and external Amazon customers to move their on-premises database environment to AWS Cloud database solutions.