Transcript Materialized Views: Simple Replication? - Go
Materialized Views: Simple Replication?
David Kurtz Go-Faster Consultancy Ltd.
www.go-faster.co.uk
UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
1
Who Am I?
• • • Oracle Database Specialist – Independent consultant System Performance tuning – PeopleSoft ERP – Oracle RDBMS UK Oracle User Group – PeopleSoft Director • Book – www.psftdba.com
2 UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
Agenda
• Simple Replication using Materialized Views – Database Links – Limitations • Aspects of the application (PeopleSoft) • Workarounds UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
3
Resources
• • • If you can’t hear me say so now.
Please feel free to ask questions as we go along.
The presentation will be available from –
www.ukoug.org
in the library
4 UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
Initial Scenario
HRMS Assentia l Data Stage CRM
UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
EPM
5
Initial Scenario
• Extract from HR and CRM to EPM – Via Assential Data Stage • • • Table by Table replication by SQL Capability to transform data Limited Capability to handle long columns – Performance Bottleneck • Taking too much of batch window which was needed for other batch processing UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
6
Materialized Views – v- Streams
• Materialized Views – Used to be called snapshots – – Old stable technology Database links between databases – Also used for query rewrite • Not discussed in this presentation • Streams – – Introduced 9i Supplemental logging shipped to target database.
– No support for Longs in Oracle 9i • PeopleTools 8.45
• Lots of LONG columns UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
7
The Plan
• Eliminate Assential (as far as possible) – Some complex transitions remain – Implement incremental refresh for all MVs • Incremental refresh every midnight 8 UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
Problem 1: Long Columns
• Long Columns – Assential works in blocks of 2000 characters • We discovered truncated data in long columns – Replicate up to 32Kb with MVs • workaround to go across DB links.
– Oracle 10g Streams would provide a total solution.
9 UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
Problem 2:Primary Keys
• PeopleSoft doesn’t use database enforced Referential Integrity – No primary keys, only unique constraints • Can usually add primary key constraints using existing unique indexes – Can get Nullable date columns in unique key • Can’t add a primary key constraint 10 UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
MVs
Source Table MVL MV Refresh Target MV
UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
11
MV Replication Choice
• No Primary Key – ROWID based replication – No inherited indexes or keys – You may need to create unique indexes on MV – What happens if you reorganise the table?
• Primary Key – Replication by primary key – MVs and MV logs inherit primary keys – Effect of Truncate command?
UKOUG DBMS SIG 17.7.07
www.go-faster.co.uk
12
Effect of TRUNCATE
• Primary Key replication – Rows not removed from MV by fast refresh – – No error raised Need to do complete refresh • Demo mv1.sql
• ROWID replication – ORA-12034 during fast refresh – materialized view log on