Documente Academic
Documente Profesional
Documente Cultură
Abstract
This document discusses performance monitoring and optimization of the Oracle database
tier in Siebel eBusiness application. The document provides detailed information on key
items that can influence the performance of a Siebel application database and solutions to
some common problems.
November 2008
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Acknowledgements
I would like to acknowledge the contribution of Girma Watumo a Senior Principal
Consultant at Oracle Corporation. Girma and I worked on several projects and I
truly value his friendship. Besides being a friend, Girma is a highly skilled Siebel
consultant with in-depth technical knowledge of the Siebel Application. He
provided me with important insights on some key Siebel Applications items
related to performance.
Copyright © 2008 Total APM Corporation. 1580 Sherman #801 Evanston, IL 60201 U.S.A.
All rights reserved.
2
2
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Contents
Introduction .................................................................................................. 4
Bind variable vs. literals—a large result set vs. a small result set .........................17
Stats ...........................................................................................................33
3
3
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Introduction
Oracle's Siebel Customer Relationship Management (CRM) ™ application offers
market-leading CRM solutions based on the latest Web technologies. It is a
complex enterprise application consisting of multiple architectural tiers (N-tiers).
Siebel performance monitoring and tuning have become a critical aspect of any
Siebel deployment with the need to satisfy the demands of partners, suppliers,
and customers.
Siebel application performance is defined as the Siebel application's ability to
function, and generally measured in response time or throughput. Some of the
factors affecting a Siebel application’s performance include inadequate hardware,
poor network infrastructure, heavy customization, excessive network round
trips, extensive data volume, poor tuning of database objects, and improper
database configuration. The best way to tackle Siebel application’s performance
issues is to anticipate, plan, and consequently avoid the problems. However, this
is not always possible. For example, it is often difficult to anticipate and account
for all the performance issues that can arise during a major Siebel version
upgrade, with an accompanying database platform upgrade. Furthermore, while
pre-deployment testing is the most cost-effective and risk-averse approach
toward ensuring that Siebel eBusiness enterprise applications operate at
acceptable levels of performance, many performance problems arise only in
production. Consequently, regardless of the time you spend testing, you will still
need to have a good solution for monitoring and tuning Siebel production.
Tuning Siebel appears complicated, as Siebel is a multi-tier environment.
However, and perhaps not surprisingly, we find that 90% of all slow response
events can be traced back to slow database queries.
This document focuses on the performance of the database tier in the Siebel
application. It examines the performance issues encountered, and the remedies
used during several Siebel upgrades, from Siebel 6 to 7, in several Siebel
implementations. In some cases, a Siebel upgrade was accompanied by an
Oracle version upgrade, for example, from 9.x to 10g, which added additional
complications and compounded performance issues.
The most common problem Siebel customers face when trying to tune Siebel
queries is that the SQL that is generated through Siebel cannot be easily tuned
and fixed with database-provided hints. Further complicating the tuning effort is
the fact that while the DBA may discover slow, top-heavy SQL queries in the
database, they will have a hard time relating these SQL queries to a user-
specific navigation event in the browser interface. This type of analysis is time-
consuming and requires an advanced level of expertise.
4
4
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Missing indexes
In our experience, a typical customized Siebel implementation requires an
extensive amount of additional indexes. The two primary reasons for missing
indexes are the existence of Siebel customizations and because Siebel uses the
new Oracle CBO in many implementation of Siebel 7.7 and later. Navigation to a
view or execution of a specific ad hoc query or PDQ in a certain view can be very
slow and time-consuming. Some views may simply not respond, resulting in a
Siebel timeout. One of the first issues that need to be addressed when
troubleshooting a problem is that of 'Missing Indexes', since this solution is the
easiest solution to implement.
In heavily customized Siebel implementations, there is an extensive use of
extension columns on Siebel base tables. Performance problems surface when
these extension columns are not indexed appropriately. In addition, performance
deteriorates when these extension columns are used to store foreign keys and
are not indexed.
5
5
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
When upgrading, one typically assumes that if the Siebel 6 implementation was
performing well (probably after spending time tuning the system by adding
many customized indexes), the post-upgrade will perform equally well. However,
several internal changes within Siebel (for example, the addition of Intersection
tables), and database changes (for example, changes to the CBO) may cause
the previously-customized indexes to not be used, and create a need for new
indexes.
Index manipulation results in best performance improvements when carried out
correctly. Consider the following guidelines when analyzing slow running queries:
Create new indexes - mainly to support existing custom configurations.
Modify existing indexes to add/remove columns, or change the order of
columns.
Remove unused custom indexes that were created in previous versions of
Siebel.
Note that even some out-of-the-box indexes may need to be modified or
removed.
6
6
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
The following is an example of the results received after tuning a Workflow query
by creating a new index. The autotrace output comparing the results before and
after indexing, exemplifies the magnitude of the change:
7
7
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Figure 1: A statement with high I/O Wait, high Memory wait, and high CPU consumption
As a rule of thumb, a statement that has high I/O Wait or a high Using CPU
value is a candidate for a missing index. An I/O wait can be reduced with the
introduction of a new index, if the index filters out many rows. Take, for
example, the following query:
8
8
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Let’s assume that S_OPTY has 10 millions rows and X_ACCT_NUM has 1 million
distinct values. On an average, 10 rows would be returned from the above
query. If an index on X_ACCT_NUM is missing, Oracle CBO would need to read
the entire S_OPTY table in order to find the 10 rows. This would result in
thousands of I/O requests. If an index exists, the optimizer would be able to
return the rows in 10-15 I/O requests.
10 rows 10 rows
10 rows
Index
4-5 I/Os
X_ACCT_NUM
For the same reason, CPU Usage can be reduced by introducing a new index. If
the table in question is relatively small then the table data would be stored in
the Oracle buffer. In this case, the unnecessary thousands of I/O requests will
be Logical I/Os, reported by i³ as CPU utilization.
If you determine that the main resource consumption in the database is I/O
wait, your next step would be to identify the list of objects that I/O performs on.
This information would prove to be invaluable when investigating and analyzing
the Explain plan of the query.
9
9
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
With this information, we can start looking at the Execution plan. Most Siebel
queries are complicated and involve many tables and joins. Precise i³ visually
displays the plan and provides you with dictionary information on the objects
involved in the statements—mainly tables, indexes and columns. Together with
the information obtained before, it is possible to focus on the step in the plan
that refers to the hottest object in the query.
Figure 3: Focus on S_ACT_EMP steps in the plan and verify that the operator is optimal
Now that we have identified the problematic object and its access path, we can
investigate the columns that appear in the Where or Join clause and verify that
they are indexed correctly.
10
10
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
See Appendix B for a general template for executing SQL from SQLPLUS.
11
11
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Let's take a look at the performance problem behind the usage of the
FIRST_ROWS optimization mode. Consider the following simple query (this can
be part of a complex Siebel query):
SELECT
T2.EMP_ID,
…..
FROM SIEBEL.S_EVT_ACT T1,
SIEBEL_S_ACT_EMP T2
…..
WHERE T2.EMP_ID=:1 AND
T1.ROW_ID = T2.ACTIVITY_ID
….
ORDER BY T1.OWNER_LOGIN
This is a simple query that returns activities for a single employee and sorts the
result by the OWNER_LOGIN column. The main idea is that the predicate for
filtering is done on S_ACT_EMP while the sort is requested on a column of
S_EVT_ACT. The optimizer needs to select the optimal plan for this query. There
are two main options to pick from:
(1) start with an index for the predicate EMP_ID=:1 or,
(2) start with the index on OWNER_LOGIN that will avoid the sort.
In complex implementations, we have seen cases where the optimizer preferred
avoiding the sort order at all cause.
Let’s try and understand the cost associated with each option. The calculation
here is simplified but the basic idea is the same. We will assume there are 10
Million rows in each table (S_ACT_EMP and S_EVT_ACT) and an average of 100
activities for each employee.
Option 1: The optimizer starts with an Index on S_ACT_EMP (EMP_ID) to check
the EMP_ID=:1 predicate and eventually sorts the result set.
Using i³ we can view the full execution plan. Below is a screenshot from i³
showing a subset of the execution plan. In this case the plan was simplified to
display only these two tables.
12
12
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
The plan consists of a Nested loop join and a sort. The optimizer chooses
S_ACT_EMP as the outer table in the join and S_EVT_ACT as the inner table.
S_ACT_EMP is the driving table because the EMP_ID=:1 predicate has a good
level of selectivity. The plan starts with the Index S_ACT_EMP_M6 which
includes the EMP_ID column. This index finds the 100 rows that have
EMP_ID=:1. The cost associated with this step is around 4–5 I/O requests
required to traverse the index. For each row found, a table ROWID lookup (1
I/O) is performed on S_ACT_EMP and the ACTIVITY_ID column is obtained.
Since this table lookup is performed on each of the 100 rows, the cost associated
with the outer table of the nested loop is 100–104 I/O requests.
For each row in the outer table, Oracle needs to find all rows in the inner table
that satisfy the join condition. Since there are no additional local predicates on
S_ACT_EMP, the join will be performed 100 times—once for each row.
For each inner table execution, an index lookup is performed using the
S_EVT_ACT_P1 (ROWID) and then the S_EVT_ACT table is accessed. The cost
associated with the inner table part of the join is 3–4 I/O requests per execution.
Since there are no additional local predicates on S_EVT_ACT, the 100 rows that
the outer table identified constitute the complete result set.
The last step in the plan is to sort these 100 rows and return them to the client.
Index Index
3-4 I/Os EMP_ID ROW_ID 4-5 I/Os
13
13
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
The total cost associated with this plan is around 400–500 logical I/Os and a sort
of 100 rows.
Now let's take a look at the second option? In this case, the sort is avoided. The
optimizer starts with S_EVT_ACT as the leading table and for each row it checks
the EMP_ID predicate in S_ACT_EMP. Once the requested number of rows is
found, the result can be sent to the client and there is no need to continue
reading the entire result set. The CBO may prefer this option in a heavily
customized implementation.
The following figure, showing how this scenario is rendered in i³, displays a
subset of the execution plan when a sort is avoided:
14
14
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
The total cost associated with this plan depends on how quick we can find the
first rows having EMP_ID=:1. For this calculation, we assume that these 10 rows
were found after processing half of the rows in S_EVT_ACT.
25 M I/Os JOIN
Performed 5 M times
once for each row in
5M rows S_EVT_ACT
5M rows 1 row
The cost of a Full Index scan on S_EVT_ACT_M17 is high. The real problem is
that the S_EVT_ACT ROWID lookup and the inner join are performed 5 million
times (half of the total number of rows), but the total cost of this plan is around
25 million logical I/Os—just to avoid carrying out a sort.
One may ask why this problem arose in the first place. Why didn't the CBO pick
the correct plan? The answer can be found in the customization columns in the
tables, the skew of data between employees, and the usage of bind variables.
This problem can be fixed by changing the Business Component (BC) default
optimization level hint. The question you should ask yourself is how would you
know on which BC the optimization hint should be changed?
15
15
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
16
16
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Identify the BC and check out the object or Project under which the BC is
contained.
In Object Explorer navigate to BC then to the BC User Property child object.
Create a new record with the following attributes:
Property: Name; Value: OracleCBOHint
Property: Value; Value: ALL_ROWS
Property: Comment; Value: Your comment
Compile SRFs and deploy the changes in PTE.
Test for performance improvement in the targeted queries.
Deploy the changes in production.
After performing this change, perform regression tests on other areas where this
BC is in use, and make sure that they have not been negatively impacted.
An alternative solution for changing the optimizer hint to ALL_ROWS can be
tested by setting the init parameter _SORT_ELIMINATION_COST_RATIO.
Theoretically, setting this parameter—which influences the cost ratio for sort
elimination under first_rows mode—allows you to force the optimizer to perform
the sort and use the correct index. However, you are advised to thoroughly test
this setting throughout the entire application, prior to implementing it in a
Production environment as it affects the entire Siebel Application and not just
the problematic BC.
17
17
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
(4) Automatic Trailing Wildcard is not disabled in the Siebel Search Center. This
parameter is also typically disabled. This is done through a configuration
change in OOTB business service Search Execution Service. A new Business
Service User Prop would be created with the following parameters: Name =
AppendWildcard; Value = FALSE to prevent unnecessary trailing wildcards
that impact performance. It is assumed that this is done.
In most cases, (1) and (2) above are unavoidable, based on how users use
Siebel. In both cases the solution was to use a little known Field User Property
configuration solution that instructs Siebel to pass the literal rather than the bind
variable. With this change, a query predicate T23.NAME LIKE ‘ABC%’ is sent to
the database instead of T23.NAME LIKE :5. Performance, in these cases,
changes from minutes to sub-seconds, thereby avoiding Siebel timeout, in some
cases.
Let's take a look at why performance has improved. Consider the following
statement:
SELECT ...
FROM ...
SIEBEL.S_PARTY T9,
SIEBEL.S_CONTACT T25
WHERE
T25.CON_CD != .... AND -- some criteria on S_CONTACT
(T9.ROW_ID LIKE :2)
i³ identifies that the hottest object in this query is S_CONTACT with 99% of the
waits.
18
18
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
If you take a look at the plan that i³ captured, you can see that the criteria on
S_PARTY.ROW_ID LIKE is not the first predicate that the optimizer checks. For
some reason the optimizer decided to ignore the search criteria and focus on the
S_CONTACT criteria. The question is, why is that?
The optimizer does not know the value of the :2 parameter used in the Like
predicate. Obviously, bind picking does not work here. If the value of :2 is
somewhere around ‘1-2345%’, then only a small number of rows will return
from this predicate and the plan should first check on this criteria. However, if
the parameter contains something around ‘1%’ or even ‘%1%’, then millions of
rows will be returned and this criteria should not be used as a leading predicate.
We found that the optimizer makes the wrong decision, in this case, and chooses
to ignore the predicate in cases where it should have used it instead. In these
cases, switching to literals would provide the optimizer with the missing
information it needs to pick the correct plan:
If the statement is (T9.ROW_ID LIKE ‘1-2345%’) then the index on
ROW_ID will be used.
If the statement is (T9.ROW_ID LIKE ‘%1%’) then the same plan that
was used before, will be used. It will still be slow and we will need to train
the user how to properly perform a query.
Here is the new plan when a literal is used:
19
19
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
20
20
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
21
21
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
22
22
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
that are not denormalized into the intersection table S_ACT_EMP used by the
Siebel BC class as query-driving tables for these views. While S_EVT_ACT is the
base table for these BCs, many of the OOTB's frequently used columns in
S_EVT_ACT are denormalized into S_ACT_EMP. For example,
S_EVT_ACT.EVT_STAT_CD, which holds the activity status, has a corresponding
denormalized column S_ACT_EMP.ACT_EVT_STAT_CD. During any data
manipulation operation, the data in these tables is kept in sync by the BC class.
23
23
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
SELECT
T1.EMP_ID,
…..
FROM SIEBEL.S_EVT_ACT T1,
SIEBEL_S_ACT_EMP T2
…..
WHERE T2.EMP_ID=:1 AND
T1.TODO_CD=:2
T1.ROW_ID = T2.ACTIVITY_ID
We will assume that this employee has a total of 2000 activities in the tables,
and 5 rows were returned by this query (TODO_CD=:2 filters out 1995 rows).
Below is the Explain plan that i³ captured (simplified to only display the two
tables):
In this plan, the optimizer correctly starts with an index on S_ACT_EMP to check
the EMP_ID predicate. For the index, the matching rows in S_ACT_EMP are
located to obtain the ACTIVITY_ID. With each activity ID, the index on
S_EVT_ACT (ROW_ID) is used to locate the corresponding row. Finally, the
check on TODO_CD is performed and the row is returned to the client if the
criterion on TODO_CD holds.
We will now try to understand the cost associated with this plan. The calculations
here are simplified but the basic idea remains.
To identify the 2000 rows in S_ACT_EMP that belong to this employee, a total of
~2000 I/O requests are required, 4–5 I/Os are required to traverse the index,
and an additional one I/O per row is required for the ROWID lookup. For each
row in S_ACT_EMP Oracle needs to identify the matching row in S_EVT_ACT (2–
3 I/Os for the index S_EVT_ACT_P1 and one I/O for the table ROWID lookup).
24
24
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Eventually, the check is performed on TODO_CD, and 5 rows are returned in the
result set.
Total cost: approximately 10000 logical I/Os to retrieve 5 rows.
This query will perform considerably slower (can take up to 2 minutes).
Now imagine the same query for the My_Staff view. If the manager has a large
number of employees reporting to him, this query can result in a timeout (1 to 2
minutes per employee).
There are several issues with this plan, all related to the fact that the TODO_CD
predicate that filtered out 5 rows out of 2000 is the last element that has been
checked. As a quick solution, we created an index on S_EVT_ACT
(ROW_ID,TODO_CD). We found that the CBO will not use this index and will
continue to use the S_EVT_ACT_P1 index. We forced the use of this index with a
stored outline; as a result that performance improved dramatically. However, we
had to have a solution that was not based on stored outlines. (The limitations of
stored outlines are discussed below).
We have managed to permanently fix this issue by denormalizing several
columns in S_ACT_EMP. After denormalization the query text changed similar to
the following example:
25
25
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
26
26
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Figure 13: i³ identifies the .NET and IIS interfaces as the bottleneck
27
27
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Connection pooling
Connection pooling in Siebel is very important for performance. Siebel Bookshelf
contains a section on “Database Connection Pooling Usage Guidelines” that
provides general recommendations with regards to connection pooling. Several
factors should be considered when determining whether to use connection
pooling in an implementation. For example, number of users, type of
connections etc.
An implementation with connection pooling is characterized by the following
behavior:
Opening a connection is relatively fast. The shared connection eliminates
the need to creating a physical database connection, which takes a long
time.
For the same reason, database resource utilization may be reduced.
On the other hand, as users need to share the connection, additional
overhead is added to obtain the connection for every request.
Long-running queries utilize a connection for a long time and may result
in users waiting a long time for a connection.
Therefore, when considering connection pooling it is important to analyze the
behavior of the implementation with regards to database connections. Are the
connections mostly end-users? What is the average think time? What is the
maximum number of connections?
In addition, one should use i³ to examine database resource utilization.
Connection pooling may reduce database resources. However, in order to
understand the implications of this reduction, one first needs to understand the
database behavior.
Consider the following example. Assume a site that made an executive decision
not to use connection pooling. The site has only 2,000 users and therefore
decided to create a dedicated database connection when users log on to the
Siebel Application. The database connection created upon login was kept alive
until the user logged out (or timed-out). With only 2,000 users and enough
database resources, this decision appears to make sense. Only 2,000 physical
database connections will be created and users will have no delays related to
connection management, except when first logging into the application.
However, If this site also uses a lot of EAI Web calls, this may be a mistake. The
nature of these EAI requests is as follows: there are many short requests that
use an anonymous browser user. As a result, each Web service call results in
creating a physical database connection, and then dropping it, which slows
performance. Moreover, on the database side, this behavior can lead to a high
level of overhead by the Oracle listener process. This site should therefore
enable connection pooling only on EAI connections.
It is recommended to use i³ to monitor CPU utilization of the listener process. In
addition, you should use i³ to examine the number of new physical connections
created over time, and identify if too many logons are performed.
The following figure shows how this information is displayed in i³.
28
28
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Workflow scheduling
Performance issues may stem from setting an inadequate Batch Workflow
Process schedule. While each Batch Workflow Process may be tuned and
efficient, frequent executions may result in high overhead on the entire system.
It is therefore important to examine the schedule of the Workflow Processes and
make sure the scheduling is optimized. i³ can also help spot runaway Batch
Workflow processes that are running hundreds of times per day, when there is
no business need for that level of frequency.
i³ will identify batch processes that consume a high amount of resources. For
each process, you can display the list of top queries executed. You can then
examine the number of executions for the top queries over time and verify that
the number of executions meets expectations.
29
29
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
30
30
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Siebel timeout
It is common for users to complain that their Siebel session has been timed out
when the query is very slow. In this section we describe how Siebel and Oracle
DB handle the timeout issue in terms of user experience, Siebel Application
Object Manager (AOM), and Oracle DB levels.
31
31
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
When a user runs a query, Siebel displays the cancel query dialog box, if the
query runs longer than the value specified in the CancelQueryTimeOut
parameter in the [SWE] section of the application configuration file (CFG). Out of
the box, a value of '3' is used, meaning that the dialog appears whenever a
query takes 3 seconds or longer. Based on our observations, we have seen that
this dialog box stays open for 10 minutes. If a query takes more than 10
minutes, the dialog box is replaced by a more familiar hourglass for the
additional amount of time. The browser times out according to whichever is the
earlier—the browser's timeout setting (10 minutes) or Siebel's SessionTimeout
parameter (default is 300) set in seconds, in eApps.cfg. In either case, if the
Oracle 10g DB has not completed the request when the browser client times out,
it will continue processing even after the browser times out. We have seen cases
where a query ran for more than 24 hours, while the end-user was timed out
after 15 minutes.
In order to solve this problem, customers should use i³’s monitoring and alerting
features. Once i³ identifies these extremely slow queries, the DBA should
implement DB session kill scripts to free DB resources. This process would allow
you to analyze the source of the performance problem and solve it.
32
32
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
Note, when killing the session from the database, Siebel 7.8 launches a Retry
(up to two times) for each DB kill. The Siebel Retry feature is useful in
minimizing disruptions due to NW issues, but the Kill scripts needs to take this
into consideration and kill the queries each time they are restarted.
Export + count(*)
The usage of data export from list views in Siebel applications to spreadsheets
varies across different customer applications. Some customers depend on data
export for their data analysis, whereby they export data into spreadsheet and
manipulate it to obtain the information they need. It is common for such
customers to run into performance problems when attempting to export Siebel
data. When exporting data, Siebel first runs a COUNT(*) SQL query to count the
number of records that need to be exported. This is followed by launching a
second SQL query to obtain the data for the export. Here, the SQL structure is
the same as the one used to populate the list applet in the view, with one
exception: the ALL_ROWS optimizer hint is used. It is common for one or more
of the following conditions to hold, when Siebel export is slow:
(1) Users attempt to export a large number of records from the All or My Team’s
view.
(2) The underlying ad hoc or PDQ query is complex and/or not tuned. The impact
is magnified at export since three different SQLs are being executed—one to
populate the list view (this SQL returns only a small set of rows), and one to
count the records in the actual export.
Stats
Oracle optimizer statistics on tables, columns and indexes are the single most
important factor that drives the generation of optimal query plans. Therefore, it
is important for customers to have a good process for regenerating statistics.
Oracle Corporation suggests that accurate statistics are collected and made
available to the query optimizer. The suggested method for collecting statistics is
the DBMS_STATS package.
In a large implementation, it is a challenge to follow this suggestion. In some
cases, calculating the statistics for a single table can take several hours. Since
statistics are calculated when the system is down to avoid locks, one must have
a good strategy for the timing and methods of creating statistics. Some
customers run statistics every 2 to 3 weeks, while others calculate them every
few months. It is critical that you understand the risk associated with applying
incorrect statistics and have the ability to identify that a performance problem is
a result of this.
This task is fairly easy with i³. Simply identify the performance problem and
drill-down to the SQL level. i³ identifies whether the plan was changed, and
identifies the problematic object in the plan.
33
33
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
If the plan was not changed, examine the statistics on the object in comparison
with the one used by the optimizer. The optimizer may not have access to
correct information, which it needs in order to choose the best plan. In this case,
you will need to recreate the statistics.
If the plan was changed, i³ will report for which objects, used in the query,
statistics were recently collected.
Stored Outline
When creating a stored outline for an SQL, you instruct the CBO as to which
execution plan to use when the SQL is running. In Siebel Applications, stored
outlines become a very important tool during the emergency tuning process.
Tuning queries is challenging and time-consuming as you have little control over
the query’s text. By creating a stored outline for an SQL performance problem,
you ensure that the SQL performs well, at least on a temporary basis. This gives
you the time to investigate potential permanent solutions. Several init parameter
changes are required (such as Cursor_sharing=FORCE and
Query_rewrite_enabled=TRUE) and a trigger is required in order for stored
outlines to work. Even if you do not use stored outlines at this time, it is a good
idea to make these changes in preparation for the future. Refer to Oracle
documents for a list of required init.ora parameters.
Stored outlines, however, should not be treated as a permanent solution. The
reasons for this are:
The outline is defined to match a specific query text, exactly. The outline would
not be used if any modification to the text is made. For example, assume you
created a stored outline for a query to navigate to a problematic view which
timed out. When the users navigate to the view, performance is good. If,
however, users decide to sort the results, the generated query is different (since
it has a different sort order), the outline will not be used, and performance
would slow down again. Another example can be users who decide to add
additional criteria. In this case, the query will again be different and the outline
will not be used.
Stored outlines require maintenance and pose a potential risk. Since you did not
actually find the cause of the problem and fix it, you used stored outlines to
force the optimizer to use the “correct” plan. As a result, you always need to
know that the stored outlines are still valid and that the same queries are still
executed. For example, you don’t want to find out that a new build, installed for
production on Sunday night, caused some of the problematic queries to change,
because the stored outlines are not used anymore. Also, if stored outlines are
not being used, you do not want to discover this only when users start working
with the system. The best solution is to find the root cause of the performance
problem (why the optimizer is using a poor plan) and fix it.
See Appendix B for a general template for creating a stored outline.
34
34
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
SQLPlus Template
The following is a template for running Siebel queries from SQLPlus or other SQL tools.
-- Assign values to the bind variables. Obtain the list of values from i3
begin
select '????' into :v1 from dual;
select '????' into :v2 from dual;
select '????' into :v3 from dual;
end;
/
-- Set autotrace and other sqlplus settings
set autotrace traceonly
set lines 1000
-- Execute the query as reported by i3. Don’t replace the bind variables with the literal in the text
SELECT …..
/
spool off
35
35
Total APM Corporation
Siebel Oracle Database Monitoring and Tuning
- Detailed Techniques
36
36
Total APM Corporation