Beruflich Dokumente
Kultur Dokumente
Enhanced SQL –
PIVOT and UNPIVOT
SELECT * FROM sales
PIVOT
PROD QUARTER AMOUNT (sum(amount)
Shoes Q1 2000 FOR quarter in
Shoes Q2 1000 ‘Q1’,’Q2’,’Q3’,’Q4’);
Jeans Q1 1000
Jeans Q3 500
PROD Q1 Q2 Q3 Q4
Jeans Q3 100
Shoes 2000 1000 Null Null
Jeans Q4 1000
Jeans 1000 Null 600 1000
begin
:New.ID := My_Seq.Nextval;
end;
/
PL/SQL Enhancements in 11g
Tools support
PL/Scope
Challenge
y Inherit code, find a problem in one area that links elsewhere, got
lost following reference after reference
y Impact Analysis: how do you determine who references a
particular variable?
Solution
y PL/Scope
Usage
alter session set PLScope_Settings = 'identifiers:all'
create or replace...
Solution
y PL/SQL Hierarchical Profiler
y reports dynamic execution profile organised by subprogram
y accounts for SQL and PL/SQL separately
y generates hypertexted HTML reports
Usage
> EXECUTE DBMS_HPROF.START_PROFILING('PLSHPROF_DIR', 'test.trc');
% plshprof
See:- New Features in Oracle XML DB, for Oracle Database 11g Release 1,
An Oracle White Paper, June 2007
In Place Schema Evolution
• 10.2 copyEvolve() unloads and reloads the data when the XML
Schema changes
• very flexible but expensive: time to evolve schema is proportionate
to the amount of data being managed
• 11.1 In Place Schema Evolution allows simple changes to
registered XML schemas with zero down-time
• no data copy required
• schema change takes a few seconds regardless of amount of data.
• changes to the XML must not invalidate existing documents
• add optional elements and attributes
• adding new values to enumerations
• increase in length
XMLType Partitioning
Challenge
<PurchaseOrder> • repeating elements typify XML documents and are
<Date>…</Date>
managed using nested tables
<Ref>…</Ref>
<LineItems> Solution
<LineItem>… • leverage 11.1 REF partitioning
<LineItem>…
• nested Tables are partitioned using the same key
<LineItem>
as the top level XMLType table
<LineItems>
• supports “partition maintenance” operations
• supports “partition pruning”
XML Misc Improvements
Challenge
• 10.2 schema-less XML not well optimized
Solution
• 11.1 binary XML optimized for schema-less and
flexible schema-based XML
• Post Parse compact representation of XML
• Flexible XML Schema Support
• High performance fragment access and extraction
with new XML Index
Binary XML
• Single format for “on-disk”, “in-memory” and “on-the-wire”
• Reduced CPU and Memory overhead
• single format avoids parse and serialize issue between tiers
• Reduced Network Overhead
• post-parse format used when XML moves between tiers
Database App Web
Server Cache Client
Challenge
• Ease of Use
Solution
• JDK-Like interface, with code on filesystem, using familiar notation,
e.g. –{classpath}, -D system properties
• Eases the migration for developers from JDK VM world
Enhancements for PHP developers
Accessing the database will never be the same
DBA -
u to ate WSDL
A er
en
G
PL/SQL SOAP
DB WS
? SOA
SQL
XQuery
Agent
Agent
• OLAP
• Data Mining
See:-
Oracle Database 11g for Data Warehousing
and Business Intelligence
An Oracle White Paper
July 2007
What is Oracle OLAP Option?
OPERATION
---------------------------------------
SELECT STATEMENT
HASH
HASH JOIN
HASH JOIN
CUBE SCAN CB$UNITS_CUBE Í Cube Access
VIEW
HASH
TABLE ACCESS PRODUCT_DIM
VIEW
HASH
TABLE ACCESS TIME_DIM
What is Oracle Data Mining?
• In-Database Mining Engine
• wide range of algorithms
• anomaly detection
• attribute importance
• association rules
• clustering
• classification & regression
• nonnegative matrix factorization
• structured & unstructured data (text mining)
• BLAST (life sciences similarity search algorithm)
• Oracle Data Miner (GUI)
• simplified, guided data mining
• Spreadsheet Add-In for Predictive Analytics
• “1-click data mining” from a spreadsheet
• PL/SQL API & Java (JDM) API
• develop advanced analytical applications
Oracle Data Mining 11g
New Features in Oracle Database 11g
• User Management
• Access Control
• Data Protection
• Monitoring
Regulatory Compliance
• Sarbanes-Oxley (SOX),
• Foreign Exchange Instruments and
Exchange Law (J-SOX)
• EU Privacy Directives, CA SB 1386….
• Payment Card Industry (PCI)
• Adequate IT controls, COSO, COBIT
• Separation of duty, Proof of compliance,
Risk Assessment and Monitoring
Insider Threats
• Large percentage of threats go undetected
• Outsourcing and off-shoring trend
• Customers want to monitor insider/DBA
Oracle Database Security Products
Core
Platform
Security
Core
Platform
Security
Core
Platform
Security
Core
Platform
Security
• Integrated with EM
• Label Security
• Virtual Private Database
• Application Context
• Enterprise Security
Manager
• Transparent Data
Encryption
11g Database Manageability
• Memory Management
• AWR Baselines
• Automatic SQL Tuning
• Advisors
• Upgrade Considerations
AWR Baseline
11g Database Manageability
Automatic SQL Tuning
Manual SQL Tuning Challenges
• Time consuming
• Each SQL statement is unique
• Potentially large number of statements to tune
Evaluate
Implement Recommendations
one hour
DBA
ADDM Invoke
Advisor
SQL Tuning
AWR SQL Tuning Candidates Advisor
Workload
Generate
Recommendations
Choose
Candidate
SQL SQL Tuning
one Candidates
week
It’s Automatic!
View Reports /
AWR Control
DBA Process
Result Summary
Result Details
Result Recommendations
11g Database Manageability
SQL Access Advisor
SQL Access Advisor: Partition Advice
SQL Access
Advisor Hash
partitions?
SQL cache
Interval
Complete partitions?
Hypothetical Workload
STS
Filter
Options
Realistic Testing
and Automatic Proactive
Intelligent
Diagnostic Patching
Automatic Health Resolution
Workflow
Checks
Prevention Resolution
Automatic Diagnostic Workflow
Automatic
Critical Diagnostic
Error Repository
DBA
Alert DBA
Auto incident creation
1 2 Targeted health checks
First failure capture Assisted SR filling
No Known
DBA bug?
Yes
EM Support Workbench:
4 Package incident info EM Support Workbench:
Data Repair
Apply patch / Data Repair DBA
3
Problems and Incidents
diag
rdbms
DB
Name
incdir_1 … incdir_n
ADRCI
log.xml
V$DIAG_INFO
alert_SID.log
Important points about ADR
• Space management
• Incident flood control minimizes number of traces
• ADR auto-purging reduces disk footprint
Incident Packaging Service (IPS)
• Limitations
• Package zip must be 2GB or less
• Cannot scrub traces or customize package
Prevention: Health Monitoring
• Reactive Checks
• Trigger on error via Intelligent dumping Rules
• E.g. Checks blocks around corrupted block
Business Requirement
• Bug resolution
• Test case required for fast bug resolution
• Not always easy to provide a test case
• What information should be provided?
• How much data is need?
• Getting the test case to Oracle can be tricky
Solution
• Oracle automatically creates a test case
• Collects necessary information relating to a SQL incident
• Collected data is packaged to be sent to Oracle
• Collected data allows a developer to reproduce the problem
SQL Repair Advisor
SQL Repair Advisor
Business Requirement
y The most common types of SQL problems - exception, performance
regression etc., are hard to diagnose
y A lot of time is spent trying to reproduce the problem
y If a workaround is found it has to be applied to entire system
Solution
• Advisor
• Investigates the incident locally
• Automatically determines the root cause
• Provides a workaround (SQL Patch) for just the effected SQL
• If not, sends necessary diagnostic information to Oracle
SQL Repair Advisor Flow
SQL Generate
statement Execute Statement incident in ADR
crashes automatically
Trace files
DBA
DBA accept Statement
executes
SQL patch successfully
again
Execute
SQL patch
generated SQL statement
patched
DB Management Pack Enhancements
• Diagnostic Pack
• ADDM for RAC
• AWR Baselines and Adaptive Thresholds
• Transportable AWR
• Tuning Pack
• Automatic SQL Tuning Advisor
• Partition Advisor
• Real-time SQL Monitoring
• SQL Plan Management and Plan Evolution
Upgrade Considerations
New Background Processes in 11g
Process
Description Found
Name
In an RAC environment, this per-instance process (Atomic Controlfile to Memory Service) is an agent
which contributes to ensuring a distributed SGA memory update is either globally committed on success
ACMS or globally aborted in the event of a failure. RAC
The Resource Manager process is responsible for setting Resource Plans and other Resource Manager
DBRM ALL
related tasks.
The process archives historical rows for tracked tables into flashback data archives and manages the
FBDA ALL.
flashback archives.
Provides transparent support for XA global transactions in a RAC environment. The database
GTX0-j RAC only
autotunes the number of these processes based on the workload of XA global transactions.
New Background Processes in 11g
Process
Description Found
Name
ASM, spawned on
KATE Performs proxy I/O to an ASM metafile when a disk becomes offline.
demand.
ASM, spawned on
MARK Marks ASM Allocation Units as stale following a missed write to an offline disk.
demand.
The RAC Management Processes perform manageability tasks for RAC, e.g. creation of RAC related
RMSn RAC only
resources when new instances are added to the clusters
In a RACenvironment, this process manages background slave process creation and communication on
RMSN remote instances. These background slave processes perform tasks on behalf of a coordinating process RAC only
running in another instance.
The space management coordinator process coordinates the execution of various space management
ALL (optional non-
SMCO / Wnnn related tasks, such as proactive space allocation and space reclamation. It dynamically spawns slave
fatal)
processes (Wnnn) to implement the task.
?
The Virtual Keeper of TiMe is responsible for providing a Wall-Clock time (updated every second) and
VKTM ALL
Reference-Time Counter (updated every 20ms and available only when running at elevated priority).
Oracle Database 11g Release 1
Upgrade Paths
• Direct upgrade to 11g is supported from 9.2.0.4 or higher,
10.1.0.2 or higher, and 10.2.0.1 or higher.
• If you are not at one of these versions you need to perform a
“double-hop” upgrade
• For example:
• 7.3.4 -> 9.2.0.8 -> 11.1
• 8.1.7.4->9.2.0.8->11.1
Choose an Upgrade Method
Solution
• an Access Control List (ACL) specifies a set of users and roles
• you assign an ACL to a host and port range
• you may need to explicitly grant this access in 11.1
Case Sensitive Password
• By default:
• Default password profile is enabled
• Account is locked after 10 failed login attempts
• In upgrade:
• Passwords are case insensitive until changed
• Passwords become case sensitive by ALTER USER
• On creation:
• Passwords are case sensitive
• Review:
• Scripts
• Database links with stored passwords
• Consider backward compatibility parameter,
SEC_CASE_SENSITIVE_LOGON
Log files changes
alert.log
• xml format
• $ORACLE_BASE/diag/rdbms/orcl/orcl/alert/log.xml
• adrci> show alert –tail
• $ORACLE_BASE/diag/rdbms/<dbname>/trace/alert_SID.log
Moving On
RBO
• Still there, same behavior as 10.2, but even move
tools to ease the move
• SQL performance analyzer
• SQL plan management
Moving On
These deprecated features / privileges are still
available for backward compatibility but the
recommendation is to move on
No longer supported
• Workflow BPEL
Real Application Testing
• Value
• Rapid technology adoption Deploy
• Higher testing quality
• Business Benefit Test
Change
• Lower cost
• Lower risk
Remediate
…
Changes
Unsupported
Middle Tier
Changes Supported
•Database Upgrades, Patches
•Schema, Parameters Recording of
External Client
•RAC nodes, Interconnect Requests
•OS Platforms, OS Upgrades Storage
•CPU, Memory
•Storage
•Etc.
Comparison of LoadRunner & DB Replay
Testing e-Business Suite
80
80
Time Taken (Days)
60
40 24
20 20
20 5 LoadRunner
4 0 0 2 5 DB Replay
0
Install & Setup Understand Identify Key Generate Run Test
Application Transactions Workload
Usage
From: To:
Artificial workloads Production workloads
Mid-Tier
Storage
Storage
Analysis &
Capture Process Replay
Reporting
Step 1: Workload Capture
Production System
• All external client requests
captured in binary files
Client Client Client
• System background, internal …
activity excluded
File System
• Minimal performance
overhead for capture Middle Tier
Storage
• Can capture on 10.2.0.4 and
replay on 11g
Capture Options
• Workload can be filtered to customize what is captured
• Filter Types
• Inclusion Filters: Specifies which sessions should be captured
• Exclusion Filters: Specifies which sessions should NOT be
captured
• Filter Attributes: Workload capture can be filtered using any of the
following session attributes
• User
• Program
• Module
• Action
• Service
• Session ID
• Workload capture can be run on-demand or scheduled to run at
later time
Step 2: Process Workload Files
• Setup test system
Test System
• Test DB is at same point in time
as before production capture
• Use RMAN to physically restore
production db from backup File 1
File 1
• Use Snapshot standby
File 2
• Use imp/exp, Data Pump, etc.
File 2
…
• Processing transforms captured
data into replayable format … File n
…
• Replay Driver consists of one
or more clients. For File n
workloads with high
concurrency, it may be Metadata
necessary to start multiple Replay Files
clients to drive workload
Replay Options
• Synchronized Replay (Default)
• Workload is replayed in full synchronized mode
• Exact same concurrency and timing as production workload
• Transaction commit order is honored
• Ensures minimal data divergence
• Unsynchronized Replay
• Workload can be replayed in unsynchronized mode
• Useful for load/stress testing
• High data divergence
• Three (3) parameters provided to control degree of synchronization
• Think time synchronization
• Connect (logon) time synchronization
• Commit order synchronization
Replay Options
• Number of Replay Clients
• Configurable by user
• Client Calibration Advisor recommends number of replay
clients needed for specific workload
• Replay clients are multithreaded clients that can drive multiple
workload sessions each
Analysis & Reporting
From: To:
Manual workload capture Automated workload capture
Capture SQL
… … Use SQL Tuning
Oracle DB Advisor to tune
regression
Storage
SPA Benefits
• Enables identification of SQL performance regressions before
end-users can be impacted
• SPA can help with any change that impacts SQL execution plan
• DB upgrades
• Optimizer statistics refresh
• New indexes, Materialized Views, Partitions, etc.
• Integrated with SQL Tuning Advisor and SQL Plan Baselines for
regression remediation
SQL Performance Analyzer Workflow
Production (10.2)
Clients
…
Test (11.1)
Mid-Tier
Storage
Storage
Cursor Cache
Save Result
• Re-execute SQL after change
Completed • Gathers new SQL execution plans
and statistics
nge e
e Cha Chang
Bef or After