1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

90
1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Transcript of 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Page 1: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Page 2: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express DBA Overview

Page 3: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

The following is intended to outline Oracle’s general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions.The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Page 4: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Agenda

• Oracle Application Express Overview

• Architecture

• Instance Administration

• Managing Environments / Deployment

• Tuning / Performance

• Reference Material Skip Overview

Page 5: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Fully supported no-cost feature of Oracle DB

• Distributed with

– Oracle Enterprise Edition

– Oracle Standard Edition

– Oracle Standard Edition One

– Oracle XE

• Supported Database Releases

– 10gR2 (10.2.0.4 and above)

– 11gR1

– 11gR2

Page 6: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Browser Based Application Development

Page 7: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Component: Application Builder

Page 8: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Component: SQL Workshop

Page 9: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Component: Team Development

Page 10: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Component: Workspace Administration and Analytics

Page 11: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Agenda

• Oracle Application Express Overview

• Architecture

• Instance Administration

• Managing Environments / Deployment

• Tuning / Performance

• Reference Material

Page 12: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Architectural Overview

• Simple 2-Tier Architecture• Pages dynamically rendered using database Meta data• No code generation or file based compilation• Runs everywhere Oracle Database runs

Page 13: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Integrated Solutions

Page 14: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Web Listener Choices

APEX Listener• Written in Java• Runs on J2EE compliant Web Servers• Fully supported on Oracle WebLogic Server / Oracle Glassfish

Oracle HTTP Server• Utilizes Apache and mod_plsql

Embedded PL/SQL Gateway (EPG)• Included with Oracle Database 11gR1 and above• Utilizes XML DB HTTP protocol server within the database

Page 15: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)APEX Listener

Page 16: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Oracle HTTP Server

mod_plsql

Page 17: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Embedded PL/SQL Gateway

HTTP ServerEmbedded PL/SQL Gateway

Page 18: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Configuration

APEX Listener• Database configuration maintained through SQL Developer

(APEX Listener 2.0) or APEX Listener Administration pagesOracle HTTP Server

• Apache Configuration files• Database Access Descriptor (DAD)o Nameo Database to connect to

Embedded PL/SQL Gateway• Database Access Descriptor within the database

Page 19: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Browser Requests

• Executes procedure• ‘f’ procedure with parameters ‘p=…’

f?p=105:12:1675::NO:ARG1:VAL1• Called procedure writes HTML to internal buffer using the

PL/SQL Web Toolkit (HTP, HTF, OWA, OWA_UTIL)• Results returned from buffer to browser• APEX is built on top of the PL/SQL Web Toolkit

Page 20: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Serving Many APEX Instances

apex_1

apex_2

apex_3

Page 21: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Load Balancing

server_1

server_2

server_3

Page 22: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Connection Pool

ConnectionPool

Page 23: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Connection Pool

• Only active page requests are consuming resources• Inactive sessions are idle

Page 24: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Connection Pool

• Maintains a pool of database connections• PL/SQL package state reset before every request• Database sessions are ACTIVE only when performing a request,

otherwise, connected but INACTIVE• APEX Listener

• JDBC Connection parameters• Single-threaded Oracle HTTP Server

• MinSpareServers / MaxSpareServers / MaxClients• Embedded PL/SQL Gateway (init.ora)

• SHARED_SERVERS / MAX_SHARED_SERVERS

Page 25: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Parsing of SQL

• Physical connection from pool established as APEX_PUBLIC_USER– Minimally privileged database user

• An APEX workspace is mapped to one or more database users (schemas)

• These DB users parse the SQL of APEX applications• SYS.DBMS_SYS_SQL enables the APEX engine to

parse SQL as another user

Page 26: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Page Processing

• Page Request / Submission processing adds minimal overhead

Page 27: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Multi-Tenant Hosting

• IT manage Database services• Departments manage application

development• Self-service provisioning of

workspaces• Example – Free hosted

“development” service http://apex.oracle.com

Page 28: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Database Schemas APEX_040100 APEX Engine Schema

• Should be installed into own tablespace and monitored• Holds APEX logs / application definitions (meta-data)

Application Schemas – Configured by Instance Administrator(s)• Specify if New Schema required

{ Manage Instance > Instance Settings > Storage }

• Specify if Tablespace Autoextend = True{ Manage Instance > Instance Settings > Storage }

• Define Initial Workspace Sizes{ Manage Instance > Instance Settings > New Workspace Request Size }

• Define Change Request Sizes{ Manage Instance > Instance Settings > Workspace Change Request Size }

Page 29: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)APEX Installation Create Tablespaces {Names arbitrary}

• APEX_TS_040100 for the Application Express usero Tablespace Name is APEX Version specific

(e.g. APEX 4.0 would use APEX_TS_040000)oUpgrade APEX into new Tablespace allows for better management

• APEX_TS_FILES for the Application Express files user• APEX_TS_TEMP for temporary tablespace

@apexins APEX_TS_040100 APEX_TS_FILES APEX_TS_TEMP /i/ Define Database Parameters

• SHARED_POOL_SIZE

• JOB_QUEUE_PROCESSES

Page 30: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Database Configuration

• Undersized SGA can hamper APEX performance• Insufficient memory in Shared Pool for PL/SQL• Insufficient memory for Buffer Cache for APEX metadata

• Advice• V$SGA_TARGET_ADVICE / V$SGA_INFO• V$MEMORY_TARGET_ADVICE• SGA should always fit in real memory

Page 31: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Agenda

• Oracle Application Express Overview

• Architecture

• Instance Administration

• Managing Environments / Deployment

• Tuning / Performance

• Reference Material

Page 32: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Types of Application Express Users

Instance Administrator• Manage Requests (Workspace Provisioning)• Manage Instance (Settings, Shared Components, Meta Data, Messages, ...)• Manage Workspaces • Monitor Activity

Workspace Administrator• Manage Service (Requests, Preferences, Utilization)• Manage Users• Monitor Activity

DeveloperEnd User

Page 33: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Workspace Request Modes

Manual: Administrator must manually create each workspace

Request: Workspace requests from link on APEX home page, immediately created after Administrator approval

Email Verification: Like Request, but workspace created after e-mail verification (2-step process)

Page 34: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Workspace Request Modes

• Manual• Use for complete control over workspaces in your instance

• Email Verification• Workspace, tablespace, data file and database user not created

until e-mail address is confirmed• Will avoid users requesting workspaces with malformed e-mail

addresses, consuming space which will never be used

Page 35: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Workspace Provisioning Steps

1. * Tablespace and Data File created

2. * Database User created with unlimited quota on newly created tablespace

3. Workspace Created in APEX

4. Database User Mapped to Workspace

5. * Sample Application installed in workspace

6. * Email Notification Sent

Page 36: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Workspace Provisioning – Data File

• By default, workspace data files created in same directory as tablespace for APEX (APEX_xxx.DBF)

• Oracle Managed Files• Gives DBA complete control over file location• DB_CREATE_FILE_DEST init parameter• o1_mf_%t_%u_.dbf• /u03/oradata/apex/APXPRD/datafile/

o1_mf_flow_25_339bpw79_.dbf

Page 37: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Manage Instance - Feature Configuration

Application Development• Allow PL/SQL editing; Create demonstration objects, Websheet objects;

Enable SQL and PL/SQL in WebsheetsSQL Workshop

• Inactivity time; Max script output; Max workspace output; Max script size; Enable transactional SQL; Enable RESTful Services

Monitoring• Enable Database monitoring; Application Activity Logging; Application Tracing

Workspace Administration• Enable Service Requests

Page 38: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Manage Instance - Security

Security• Set Allow PL/SQL editing; Create demonstration objects, Websheet objects;

Enable SQL and PL/SQL in Websheets HTTPSRESTful AccessSession Timeout

• Max Session Length; Max Session Idle Time • Developers can overwrite for each Application

Workspace Login Control• Require User Account expiration and locking; Max login failures; Account

password lifetime

Page 39: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Manage Instance - Security

Workspace Password Policy• Max password length; Min password differences; Must contain at least one

Alphabetic character, numeric character, punctuation character, upper case character, lower case character; Must not contain username, workspace name

• Must not contain {specified words} – oracle:hello:welcome:guest:user:database• Alphabetic characters {specified characters}• Punctuation characters {specified characters} – !"#$%&()``*+,-/:;<=>?_

Service Administrator Password Policy• Use Workspace password policy or default strong password

Page 40: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Manage Instance – Instance Settings

Self Service• Provisioning Status; Require verification code; Notification

Email ProvisioningStorage

• Require new schema; Auto-extend tablespaces; Delete uploaded files afterEmail

• Instance URL; Images URL; SMTP host address, port, authentication username and password; Use SSL/TLS; Default From address; Max emails

Wallet• Path; Password

Page 41: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Manage Instance – Instance Settings

Report Printing• Print Server; Host address; Server Port; Server Script

Help• URL – Can host Help inside firewall

New Workspace Request Size• Specify size in Megabytes and default size

Workspace Change Request Size• Specify size in Megabytes and default size

Page 42: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Manage Instance – Others

Workspace Purge Settings• Automatically remove inactive workspaces• Very good on Development instances where many signing up but not utilizing

Define Login MessageDefine System MessageManage Site-Specific TasksManage New Service Sign-Up Wizard

• Agreement; Survey questions and answers (formed into radio group); Pre text; Post text

Page 43: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Manage Workspace

Manage Developers and Users• Unlock user accounts• Create / remove workspace administrators

Manage Component Availability• Allow or disallow access to:oApplication BuilderoSQL WorkshopoPL/SQL EditingoTeam Development

Page 44: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Agenda

• Oracle Application Express Overview

• Architecture

• Instance Administration

• Managing Environments / Deployment

• Tuning / Performance

• Reference Material

Page 45: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)APEX Environments - Development

• Install “Full” Application Express; BI Publisher*• Configure SSO* • Create Workspaces / Schemas• Grant rights to common schemas• Allow Workspace Administrators to manage own workspaceoDefine other Workspace Administrators; Developers; End Users

Unlock / reset passwords for accountsoRequest spaceoRequest additional Schema(s)

Page 46: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)APEX Environments – QA / Test and Production

• Install “Runtime Only” Application Express; BI Publisher*• Configure SSO* • Define schemas• Create Workspaces or export Workspaces from Development• Grant rights to common schemas• Import Applications from Source Control• Run DDL Scripts from Source Control• Run DML Scripts from Source Control• [Optional] Create End Users (Application Administrators) o Should manage end users from within application if not using SSO / LDAP

Page 47: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

47 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Database Jobs• ORACLE_APEX_PURGE_SESSIONS

– Delete session information from APEX tables for sessions older than 12 hours– Runs every hour

• ORACLE_APEX_MAIL_QUEUE– For e-mail messages authored with APEX_MAIL– Send e-mail in queue– Runs every 5 minutes

• ORACLE_APEX_DAILY_MAINTENANCE– Archive activity log– Automatic file deletion– Runs at 0100 system time

• ORACLE_APEX_WS_NOTIFICATIONS

Page 48: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

48 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Database Backup

• Use Java programs provided with APEX Installation– Define job to perform nightly application exports to Source Control– Define job to perform nightly application component exports

• Standard Oracle Backup of complete database– Can restore “workspace” schemas

– Restores the developer defined database objects and data– Does not restore application definitions

– Can restore APEX Engine Schema– Restores APEX meta-data for all workspaces and applications

– Can NOT restore individual workspaces or applications– Must import APEX Engine Schema into separate database and then export

Page 49: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

49 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Database Flashback

Flashback availability based on DB settings and space allocation• Can export application “as of”• Can retrieve report source, etc.

Page 50: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

50 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Standards

Application Security • Authorization and authentication standards (Can define Plug-Ins)

Application Naming standards• Application Numbering / Groups

PL/SQL Components• Naming Conventions; Headers; APIs; Use of Common Packages

Deployment standards• Application Exports; DDL Scripts; DML Scripts• Use of Source Control

Change Control• Testing / Sign-Off procedures; Training procedures; Roll-out procedures

Page 51: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

51 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Deploying Applications

1. Developer exports Application

2. Export generates a SQL Script

4. Developer provides Run Sheet to DBA

6. DBA Runs Script(s) in QA / Production

@f123.sql

3. Developer adds SQL Script(s) to Source Control

5. DBA obtains files from Source Control

Page 52: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

52 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Agenda

• Oracle Application Express Overview

• Architecture

• Instance Administration

• Managing Environments / Deployment

• Tuning / Performance

• Reference Material

Page 53: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

53 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Slow Running Applications

Determine where the bottleneck iso Cliento Networko Middle-Tiero Databaseo Disk / Storage

Check Database Healtho SGAo CPU Utilizationo Lockso Database Parameters

Page 54: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

54 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Slow Running Applications

Determine what else is runningo Legacy Applicationso Data Warehouseo Batch Programso Database Jobs

Use Standard Performance Tuning techniques Review the data model Modify the Application

o 80/ 20 Rule Dissect business requirementso Use “progress bar”; Prevent “multiple-clicks”o Use collections

Page 55: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

55 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Activity Log and Monitoring

• Monitoring by Workspace Administrators, Instance Administrators

Page 56: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

56 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Activity Log and Monitoring

APEX_ACTIVITY_LOG shows all page views in a workspaceAPEX activity log is circular and does not persist (log switch every N days, default = 14)Preserve yesterday’s log activity:

INSERT INTO my_activity_logSELECT * from apex_activity_log WHERE time_stamp BETWEEN TRUNC(SYSDATE-1) and TRUNC(SYSDATE)

Page 57: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

57 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)APEX Debug Mode

• Debug within APEX to identify expensive elements within a page or process

Page 58: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

58 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Tracing

• Generate Oracle Trace file for detailed examination of all SQL associated with a page or process

• p_trace=YES name/value in URLf?p=105:12:1675::NO:ARG1:VAL1&p_trace=YES

• Instrument code using ALTER SESSION– DBMS_SESSION.SESSION_TRACE_ENABLE– DBMS_SESSION.SESSION_TRACE_DISABLE

• Use TKPROF to analyze and format output

Page 59: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

59 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)PL/SQL Profiler

PL/SQL Profiler (10g)

PL/SQL Hierarchical Profiler (11g)

• Reports the dynamic execution profile of a PL/SQL program organized by function calls

• Accounts for SQL and PL/SQL execution times separately

• No special source or compile-time preparation is required

Page 60: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

60 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Query Plans and Statistics

• APEX is a database application• Cost-based optimizer will develop better

query plans with accurate statistics• GATHER_STATS_JOB

Page 61: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

61 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Limiting Resources

• Resource Profiles– Limit types of system resources (CPU, Logical Reads)– Per Call Level applicable in APEX environment

•CPU_PER_CALL•LOGICAL_READS_PER_CALL•Not Applicable:SESSIONS_PER_USER, CPU_PER_SESSION, CONNECT_TIME, IDLE_TIME, LOGICAL_READS_PERS_SESSION

Page 62: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

62 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Database Resource Manager

– Guarantee minimum amount of resources, regardless of load

– Multiple Groups and resource plans among those groups

– Automatically switch between groups (HIGH, LOW, BATCH)

– Cancel SQL or Kill Session– * EE only feature

Page 63: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

63 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Database Resource Manager used on apex.oracle.com

APEX_HIGH

APEX_MEDIUM

APEX_LOW

OTHER_GROUPS

APEX_HIGH – default group, 70% for 10 secondsAPEX_MEDIUM – 8% for 120 secondsAPEX_LOW – 2% for 1800 secondsOTHER_GROUPS – 20%

Page 64: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

64 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)CPU Resource Manager

• Very fine-grained scheduling– Resource Manager schedules at a 100 ms quantum– Low-priority session will yield to a high-priority session in ~1

quantum

• Background processes are not managed– Backgrounds are either high-priority or not CPU-intensive

• Maximize CPU utilization– If one consumer group doesn’t use its allocation, it is redistributed

to other consumer groups based on the resource plan

Page 65: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

65 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Monitor Resource Plan Utilization

• V$RSRC_PLAN – Currently active resource plan• V$RSRC_CONSUMER_GROUP – Cumulative amount of CPU stats• V$RSRC_PLAN_HISTORY – History of resource plan, when enabled,

disabled or modified• V$RSRC_CONS_GROUP_HISTORY – History of consumer group

statistics• V$RSRCMGRMETRIC – Information about resources consumed and

wait times per consumer group• V$RSRCMGRMETRIC_HISTORY – History of Resource Manager

metrics

Page 66: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

66 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)V$SESSION

• Client Information: Authenticated Username:Workspace ID

• Client Identifier: Authenticated Username:Session ID

• Module: Parsing DB User/APEX:APP Application ID:Page ID

Page 67: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

67 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Agenda

• Oracle Application Express Overview

• Architecture

• Instance Administration

• Managing Environments / Deployment

• Tuning / Performance

• Reference Material

Page 68: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

68 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Technology Network (OTN)http://otn.oracle.com/apex

Page 69: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

69 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

OTN APEX Forumhttps://forums.oracle.com/forums/forum.jspa?forumID=137

Page 70: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

70 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Page 71: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

71 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Page 72: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

72 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Page 73: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

73 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Additional Slides

© 2012 Oracle Corporation

Page 74: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

74 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Copyright © 2012, Oracle and/or its affiliates. All rights reserved.74

Oracle Application Express Performance & Monitoring

Page 75: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

75 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Tracing

• TKPROF is an Oracle utility that formats SQL trace files

• No graphical interface for TKPROF

• Look in the user dump destination directory on the database server file system. – On OFA compliant systems this will be

$ORACLE_BASE/admin/$ORACLE_SID/udump

Page 76: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

76 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Tracing

• Pay attention to the parsing user_id in tkprof output

• Most APEX tables are named with a WWV_ prefix

• “Bind Peeking” and Adaptive Cursor Sharing:– Are available for the SQL of the APEX engine– Are not available for user SQL (your application SQL)

Page 77: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

77 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Database Time

• Total time in database calls by foreground sessions• Includes CPU time, IO time and non-idle wait time• DB time <> Response time

Database time is total time spent by user processes either actively working or

actively waiting in a database call.

Page 78: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

78 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Enterprise Manager Performance Page

• Active Sessions by wait class over time

• Colored area = amount of DB time

Page 79: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

79 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Where to find Database Time?• V$SYS_TIME_MODEL, V$SESS_TIME_MODEL

– STAT_NAME = ‘DB time’– Cumulative database processing time

• V$SYSMETRIC_HISTORY – “Database Time Per Second”, “CPU Usage Per Sec” – 10g units = centi-secs/sec (100xAvg. Active Sessions)– 11g new metric “Average Active Sessions”

• V$SQL– ELAPSED_TIME and CPU_TIME– Wait class times:

APPLICATION, CONCURRENCY, CLUSTER, USER_IO

• V$ACTIVE_SESSION_HISTORY

Page 80: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

80 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Active Session History (ASH)

• All ‘Active’ sessions captured every second– Foregrounds and backgrounds are sampled– Active foregrounds contribute to DB Time

• In-memory: V$ACTIVE_SESSION_HISTORY – Sampling interval = 1 second

• On-disk: DBA_HIST_ACTIVE_SESS_HISTORY– Sampling interval = 10 second

• ASH is a system-wide record of database activity

Page 81: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

81 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Automatic Workload Repository (AWR)• Collects performance statistics

– By default, every hour and retained for 7 days

• Active Sessions

• Resource Intensive SQL Statements

• Wait events

• Can establish baseline and compare with current.

• DBA_HIST_SNAPSHOT

• Shows top-level numbers about all snapshots in the Workload Repository

Page 82: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

82 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)APEX Views

• The database catalog of everything APEX

• Application definitions, workspaces, logs

• Display all views and columns– select * from apex_dictionary

• Display all view names– select distinct apex_view_name from apex_dictionary

• Can be queried via SQL*Plus, SQL Developer or other command-line tools

• If granted APEX_ADMINISTRATOR_ROLE role, can view across entire instance

Page 83: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

83 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)APEX Views

• APEX_WORKSPACES – all workspaces defined on the instance

• APEX_APPLICATIONS – all APEX applications

• APEX_WORKSPACE_ACTIVITY_LOG – all logged page views

• APEX_WORKSPACE_APEX_USERS – all developers, administrators and end users of a workspace

• APEX_APPLICATION_PAGE_REGIONS – HTML regions, class SQL reports

Page 84: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

84 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Identifying Performance Issues

• 98% of the time, the developer-authored SQL & PL/SQL is the culprit

• 1% of the time, the problem is APEX – and it’s a bug

• 1% of the time, it’s something else

• AWR provides a wealth of information about database performance

• Easy to correlate APEX applications to performance issues

Page 85: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

85 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Performance Diagnosis Steps

1. Identify time window

2. Isolate largest consumers of DB Time (sql_id, module)

3. Identify APEX workspaces, applications

4. Correlate SQL with specific location in an APEX application by querying the APEX views

Page 86: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

86 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Copyright © 2012, Oracle and/or its affiliates. All rights reserved.86

Oracle Application Express Security

Page 87: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

87 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Instance Security

Application Builder User Guide – Chapter 15 : Administrator Security

1. Use HTTPS { Instance Administration > Manage Instance > Security > HTTPS }

2. Set Password Complexity and Expiration{ Instance Administration > Manage Instance > Security > Workspace Login Control / Password Policy }

3. Runtime only for Production / QA / Test environments{ Installation Guide – Chapter 3.3.2 (6.) Select the appropriate installation option }

4. Session Timeout{ Instance Administration > Manage Instance > Security > Session Timeout }

5. Enable Network ACL

Page 88: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

88 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Schema Isolation / Privileges

1. Only allow schemas to be assigned to workspaces if required

a) Don’t assign workspaces to sensitive schemas

b) Assign grants and synonyms to schema associated with workspace

2. Grant least privileges on tables

3. Use views / VPD to restrict access to sensitive columns

Page 89: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

89 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Application Security

Application Builder User Guide – Chapter 15 : Developer Security

1. Understand Items of type Password

2. Understand Cross-Site Scripting protection

3. About Session State and Security

4. Understand Session State Protection

Page 90: 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

90 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express (Oracle APEX)Application Security Review

1. Use Application Advisor { Application Builder > Application xxx > Utilities > Advisor }

2. Utilize 3rd party tool to analyze applications in depth for vulnerabilities

a) APEXSec Security Tool {https://secure.recx.co.uk/apexsec/ }

b) eSert {http://www.sumneva.com/apex/f?p=15000:1070:0 }