Audit Configuration WLST Commands

24-28 Publishing Reports to the Web with Oracle Reports Services By counting the number of entries in the RW_SERVER_JOB_QUEUE table that have a status code indicating that the job has been queued but not completed, it is possible to return an accurate number of the current active users on the server. For example, you could use the following query: SELECT Count FROM RW_SERVER_JOB_QUEUE WHERE STATUS_CODE IN 1, -- ENQUEUED 2, -- OPENING 3 -- RUNNING AND JOB_TYPE = Scheduled

24.3.8.1 Updating the Database with Queue Activity

The Reports Server job queue is implemented through the use of a PLSQL case API. It functions to update the queue table with the queue information as requests are made. This implementation is defined in the following path: ORACLE_HOME\reports\admin\sql\rw_server.sql This script is certified to worked against Oracle 10g database. To implement the queue, perform the following steps:

1. Load the rw_server.sql file to a database this file is included with your Oracle

Reports Services installation: ORACLE_HOME\reports\admin\sql. This creates a schema that owns the report queue information and has execute privileges on the server queue API. For backward compatibility with Oracle6i Reports, this also creates a view called RW_SERVER_QUEUE.

2. Set the repositoryconn property of the jobStatusRepository element in

the server configuration file ORACLE_ INSTANCE\config\ReportsServerComponent\server_ name\rwserver.conf for Standalone servers and DOMAIN_ HOMEconfigfmwconfigserversWLS_SERVER_ NAMEapplicationsreports_ versionconfigurationrwserver.conf for In-process servers to the connection string of the schema that owns the queue data. For more information, see Section 8.2.1.12, jobStatusRepository . Alternatively, you can set the jobstatusRepository in Oracle Enterprise Manager. When the server starts, it connects as the defined user and logs job submissions. Note: While the table contains the date and time a report was queued, run, and finished, it is not a good idea to use a query based on the fact that a job has a defined QUEUED and STARTED time but no FINISHED value. If a report ends due to an unexpected error, such as invalid input, then the FINISHED column remains NULL. However, the STATUS_CODE and STATUS_MESSAGE both indicate there has been a failure and list the cause of that failure. Note: Oracle Reports uses the dbconn property of the jobstatusrepository element to connect to the database when updating the log information about job queues Diagnosing and Tuning Oracle Reports 24-29

24.3.9 SHOWJOBS Command Line Keyword

You can use SHOWJOBS on the command line to display a Web view of Reports Server queue status for reports run through rwservlet. For more information, see Section A.8.8, SHOWJOBS .

24.3.10 Efficient SQL

Oracle Reports uses SQL to retrieve data from the database. Inefficient SQL can cripple performance, especially in large reports. Thus, anyone tuning Oracle Reports must have a good working knowledge of SQL and understand how the database executes these statements. If you are less proficient in SQL, use the Data Wizard and Query Builder in the Oracle Reports Builder. However, the wizard cannot prevent inefficient SQL from being created, such as SQL that does not use available indexes. To tune your report SQL, use the trace functionality available in the Oracle database. SQL tracing enables you to determine the SQL statement sent to the database as well as the time taken to parse, execute, and fetch data. Once a trace file is generated, use the TKPROF database utility to generate an EXPLAIN PLAN map. The EXPLAIN PLAN map graphically represents the execution plan used by Oracle Optimizer. For example, the Oracle Optimizer shows where full table scans have been used. This may prompt you to create an index on that table depending on the performance hit. To turn on SQL tracing inside Oracle Reports Builder, add a report-level formula column named SQL_TRACE with the following code: SRW.DO_SQLALTER SESSION SET SQL_TRACE=TRUE; return1; The following EXPLAIN PLAN map was generated using the databases SQL trace facility. Refer to the Oracle Database PLSQL Language Reference documentation for more information. Example The statement being executed is: SELECT e.ename, d.dname FROM emp e, dept d WHERE e.deptno+ = d.deptno The EXPLAIN PLAN generated is: OPERATION OPTIONS OBJECT_NAME POSITION ------------------ ----------- --------------- -------- SELECT STATEMENT MERGE JOIN OUTER 1 SORT JOIN 1 TABLE ACCESS FULL DEPT 1 SORT JOIN 2 Note: Oracle Reports uses SQL for non-PDS queries only. Note: You can also call SQL_TRACE using either a Before Report trigger, or a Before Parameter Form trigger. 24-30 Publishing Reports to the Web with Oracle Reports Services TABLE ACCESS FULL EMP 1 When you tune data for Oracle Reports, understand that the Oracle RDBMS provides two optimizers: cost-based and rule-based. By default, the cost-based optimizer constructs an optimal execution plan geared towards throughput; that is, process all rows accessed using minimal resources. You can influence the optimizers choice by setting the optimizer approach and goal, and gathering statistics for cost-based optimization. While the cost-based optimizer removes most of the complexity involved in tuning SQL, understanding the distribution of the data and the optimizer rules allow you to choose the preferred method and gives you greater control over the execution plan. For example, in your SQL statement, you could do one of the following: ■ Provide optimizer hints with the goal of best response time; that is, process the first row accessed using minimal resources. ■ Decide that an index is not needed. The Oracle Fusion Middleware documentation provides more information on the database optimizers functionality.

24.3.11 PLSQL

Use the ORA_PROF built-in package to tune your reports PLSQL program units. The procedures, functions, and exceptions in the ORA_PROF built-in package allow you to track the amount of time that pieces of your code takes to run. Example PROCEDURE timed_proc test VARCHAR2 IS i PLS_INTEGER; BEGIN ORA_PROF.CREATE_TIMERloop2; ORA_PROF.START_TIMERloop2; ColorBand_Program_Unit; ORA_PROF.STOP_TIMERloop2; TEXT_IO.PUTFLoop executed in s seconds.\n, ORA_PROF.ELAPSED_TIMEloop2; ORA_PROF.DESTROY_TIMERloop2; END; This procedure creates a timer, starts it, runs a subprogram, stops the timer, and displays the time it took to run. It destroys the timer when finished. Note: For large queries, it is imperative to do one of the following: ■ Activate the cost-based optimizer and gather statistics by using the DBMS_STATS package, the COMPUTER STATISTICS option, or the ANALYZE command. ■ Optimize all SQL following the rules laid out by the rule-based optimizer. Note: For a description of the ORA built-in package see the Oracle Reports online Help.