Prligence Empowering Intelligence Summary Management By Advanced Queues Paper # 419 Arup Nanda Proligence, Inc www.proligence.com.

Slides:



Advertisements
Similar presentations
Refreshing Materialized Views
Advertisements

Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
new database engine component fully integrated into SQL Server 2014 optimized for OLTP workloads accessing memory resident data achive improvements.
Oracle Materialized Views for Replication COUG Presentation, Feb 20, 2014 Jane Lamont,
SQL2-ch2 管理綱要物件.
8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Using Explicit Cursors.
PL/SQL.
4 Oracle Data Integrator First Project – Simple Transformations: One source, one target 3-1.
Password Management for Oracle8 Ari Kaplan Independent Consultant.
View (virtual table). View A VIEW is a virtual table A view contains rows and columns, just like a real table. The fields in a view are fields from one.
Wilfried Mausz Oracle Advanced Queueing. Wilfried Mausz Agenda Queues Models Requirements Creating and using a queue Live demos –Point-to-point queue.
13 Copyright © Oracle Corporation, All rights reserved. Controlling User Access.
BACS 485—Database Management Advanced SQL Overview Advanced DDL, DML, and DCL Commands.
TURKISH STATISTICAL INSTITUTE 1 /34 SQL FUNDEMANTALS (Muscat, Oman)
Prligence Empowering Intelligence A Multi-Source Time-Variant Datawarehouse Case Study Session# by Arup Nanda Proligence, Inc. Norwalk, CT.
1 Constraints, Triggers and Active Databases Chapter 9.
Enqueue Waits : Locks. #.2 Copyright 2006 Kyle Hailey Wait Tree - Locks Waits Disk I/O Library Cache Enqueue Undo TX 6 Row Lock TX 4 ITL Lock HW Lock.
AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
Prligence Empowering Intelligence All About Fine Grained Access Control by Arup Nanda.
Prligence Empowering Intelligence 1 Painless Master Table Alter In Replication Paper # 524 Arup Nanda prligence Empowering Intelligence.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Triggers The different types of integrity constraints discussed so far provide a declarative mechanism to associate “simple” conditions with a table such.
A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
System Administration Accounts privileges, users and roles
Oracle8 - The Complete Reference. Koch a& Loney1 By What Authority? Presented by Victor Matos.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Cs3431 Transactions, Logging and Security. cs3431 Transactions: What and Why? A set of operations on a database must appear as one “unit”. Example: Consider.
About physical design After you have provided your scripts Understand the problems Present a template that can be used to report on the physical design.
9 Copyright © 2009, Oracle. All rights reserved. Managing Data Concurrency.
Introduction to DBMS and SQL Introduction to DBMS and SQL GUIDED BY : MR. YOGESH SAROJ (PGT-CS) MR. YOGESH SAROJ (PGT-CS) Presented By : JAYA XII –COM.
Triggers and Transactions Making Decisions behind the scene.
Cursor and Exception Handling By Nidhi Bhatnagar.
Data Warehousing Seminar Chapter 5. Data Warehouse Design Methodology Data Warehousing Lab. HyeYoung Cho.
1 © 2006 Julian Dyke Streams Julian Dyke Independent Consultant juliandyke.com Web Version.
RDB/1 An introduction to RDBMS Objectives –To learn about the history and future direction of the SQL standard –To get an overall appreciation of a modern.
5 Copyright © 2009, Oracle. All rights reserved. Right-Time Data Warehousing with OWB.
Introduction to SEQUEL. What is SEQUEL? Acronym for Structural English Query Language Acronym for Structural English Query Language Standard language.
SQL Server 7.0 Maintaining Referential Integrity.
1099 Why Use InterBase? Bill Todd The Database Group, Inc.
Autonomous Transactions: Extending the Possibilities Michael Rosenblum Dulcian, Inc. April 14, 2008 Presentation #419.
Procedure Function Trigger. create table employee ( id number, name varchar2(100), deptno number, salary float, primary key(id) ) create table deptincrease.
Copyright  Oracle Corporation, All rights reserved. 4 Accessing a Database Using JBCL.
In Oracle.  A PL/SQL block stored in the database and fired in response to a specified event ◦ DML statements : insert, update, delete ◦ DDL statements.
9 Copyright © 2007, Oracle. All rights reserved. Managing Data and Concurrency.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Commercial RDBMSs Access and Oracle. Access DBMS Architchecture  Can be used as a standalone system on a single PC: -JET Engine -Microsoft Data Engine.
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
Oracle® Streams for Near Real Time Asynchronous Replication Nimar S. Arora Oracle USA.
Fall 2001Database Systems1 Triggers Assertions –Assertions describe rules that should hold for a given database. –An assertion is checked anytime a table.
Advanced SQL: Triggers & Assertions
What is a Package? A package is an Oracle object, which holds other objects within it. Objects commonly held within a package are procedures, functions,
Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
Introduction to Distributed Databases Yiwei Wu. Introduction A distributed database is a database in which portions of the database are stored on multiple.
Chapter 18: Exception Handling1 Chapter Eighteen Exception Handling Objective: – Define exceptions – List types of exception handlers – Trap errors – Exception.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
Indexes- What?  Optional structures associated with tables  Provides a quick access path to table data  You can create indexes on one or more columns.
PRACTICE OVERVIEW PL/SQL Part Your stored procedure, GET_BUDGET, has a logic problem and must be modified. The script that contains the procedure.
IT420: Database Management and Organization Triggers and Stored Procedures 24 February 2006 Adina Crăiniceanu
A Guide to SQL, Sixth Edition 1 Chapter 5 Updating Data.
CSCI N311: Oracle Database Programming 5-1 Chapter 15: Changing Data: insert, update, delete Insert Rollback Commit Update Delete Insert Statement –Allows.
Constraints and Views Chap. 3-5 continued (7 th ed. 5-7)
1 11g NEW FEATURES ByVIJAY. 2 AGENDA  RESULT CACHE  INVISIBLE INDEXES  READ ONLY TABLES  DDL WAIT OPTION  ADDING COLUMN TO A TABLE WITH DEFAULT VALUE.
20 Copyright © 2006, Oracle. All rights reserved. Best Practices and Operational Considerations.
Oracle SQL.
SQL Stored Triggers Presented by: Dr. Samir Tartir
Advanced SQL: Views & Triggers
Contents Preface I Introduction Lesson Objectives I-2
PRACTICE OVERVIEW PL/SQL Part - 1.
Presentation transcript:

prligence Empowering Intelligence Summary Management By Advanced Queues Paper # 419 Arup Nanda Proligence, Inc

prligence Empowering Intelligence Real Time Datawarehouses Source DW Source Summary Pull Log Push

prligence Empowering Intelligence Complex Query Query to find out the eligibility of a transaction based on data in other tables – complex joins Takes up too much time in the Query

prligence Empowering Intelligence Actual Example SELECT DISTINCT NVL(C.COL1, R.COL1) AS COL1, RQ.COL2, COUNT(C.COL3) AS COUNTER FROM TAB1 R, TAB2 C, TAB3 CP, TAB4 RQ WHERE R.COL4 = C.COL4 AND C.COL1 = RQ.COL1 AND ( CP.COL5 = :b0 OR (CP.COL5 = :b1 AND CP.COL6 = :b2)) AND CP.COL3 = C.COL3 AND NOT EXISTS (SELECT 1 FROM TAB5 CCL,TAB6 CL, TAB7 CHO WHERE CCL.COL7 = CL.COL7 AND CL.COL8 = CHO.COL8 AND CCL.COL3 = C.COL3 AND CHO.COL1 = 'Y') GROUP BY NVL(C.COL1, R.COL1), RQ.COL2 ORDER BY RQ.COL2

prligence Empowering Intelligence Options Materialized View –Fast Refresh Needed –Complex – Fast Refresh Not Allowed Materialized View of MVs –Too Many Levels – Difficult to Administer –Refresh Lags –Failure Prompts Calls to DBMS_MVIEW()

prligence Empowering Intelligence Options A Summary Table to Hold the Data Triggers Set Up on Source Tables T1 T2 T3 T4 SUMMARY TABLE Trigger

prligence Empowering Intelligence Example Tables –DEPT –EMP Query SELECT DEPTNO, COUNT(*) EMP_COUNTS FROM EMP WHERE STATUS = 'ACTIVE' GROUP BY DEPTNO

prligence Empowering Intelligence Example Summary Table Table DEPT_COUNTS –DEPTNO –EMP_COUNTS DEPTNOEMP_COUNTS

prligence Empowering Intelligence Logic A Row Is Inserted STATUS = ACTIVE? Check the Existence of the DEPTNO in DEPT_COUNTS Exists? Upadate DEPT_COUNTS Set EMP_COUNTS= EMP_COUNTS+1 Insert into DEPT_COUNTS EMP_COUNTS=1 DEPTNO=.. Y N Y SELECT DEPTNO, COUNT(*) EMP_COUNTS FROM EMP WHERE STATUS = 'ACTIVE' GROUP BY DEPTNO

prligence Empowering Intelligence Flaw Time 0 DEPTNOEMP_COUNTS

prligence Empowering Intelligence Flaw contd… Time 1 Session1 INSERTS into EMP (DEPTNO=3, EMPNO=5679) DEPTNOEMP_COUNTS

prligence Empowering Intelligence Flaw contd… Time 2 Trigger Finds No Record for DEPTNO=3 INSERTS into DEPT_COUNTS DEPTNOEMP_COUNTS New

prligence Empowering Intelligence Flaw contd… Time 3 Session2 Inserts into EMP (DEPTNO=3, EMPNO=4567) DEPTNOEMP_COUNTS Not Visible

prligence Empowering Intelligence Flaw contd… Time 4 Trigger tries to INSERT into DEPT_COUNTS (DEPTNO=3, EMP_COUNTS=1) DEPTNOEMP_COUNTS Primary Key Violated WAITS!

prligence Empowering Intelligence Flaw contd… Time 5 Session1 Commits! DEPTNOEMP_COUNTS Row Is Present

prligence Empowering Intelligence Flaw contd… Time 6 Session2 Errors Out! DEPTNOEMP_COUNTS Row Is Present Error!

prligence Empowering Intelligence Problem Locking Primary Key Violation Solution Session1 Session2 Trans1 Trans2 Summary Table Applying Session

prligence Empowering Intelligence Advanced Queues User Producer User Message Payload Consumer enqueuedequeue

prligence Empowering Intelligence Complex Producer1 Tags Producer2 Producer3 Consumer1 Consumer2

prligence Empowering Intelligence Types of AQs Persistent Non Persistent Single Producer/Consumer Multiple Producers/Consumers Publisher-Subscriber Model

prligence Empowering Intelligence Queue Table (QT) Payload defined here Queue Exception Queue DBMS_AQADM DBMS_AQ AQ Components

prligence Empowering Intelligence Solution Table Trigger Queue Table EnQueueDeQueue Summary Table Payload

prligence Empowering Intelligence Table Trigger Queue Table EnQueue DeQueue Summary Table Payload

prligence Empowering Intelligence Database Prep Turn on the queue timer processes –aq_tm_processes = 2 –ALTER SYSTEM possible too –Process Identified as QMNn Grant privileges –GRANT EXECUTE ON DBMS_AQADM TO SCOTT; –GRANT EXECUTE ON DBMS_AQ TO SCOTT;

prligence Empowering Intelligence Payload Oracle Object Type create or replace type dept_counts_type as object ( action_type char(1), old_deptno number(2), new_deptno number(2) ) Table Trigger Queue Table EnQueue DeQueue Summary Table Payload

prligence Empowering Intelligence Processing Procedure PROCESS_DEPT_COUNTS() Input Parameters –Action – I, D, U, T –Old DeptNo –New DeptNo Table Trigger Queue Table EnQueue DeQueue Summary Table Payload

prligence Empowering Intelligence Queue Table begin DBMS_AQADM.CREATE_QUEUE_TABLE ( queue_table => 'DEPT_COUNTS_QT', queue_payload_type=> 'DEPT_COUNTS_TYPE', multiple_consumers=> FALSE, storage_clause => 'TABLESPACE USR INITRANS 10 STORAGE (FREELISTS 10 FREELIST GROUPS 2)', compatible => '8.1'); end; Table Trigger Queue Table EnQueue DeQueue Summary Table Payload

prligence Empowering Intelligence Queue begin DBMS_AQADM.CREATE_QUEUE ( queue_name =>'DEPT_COUNTS_Q', queue_table=>'DEPT_COUNTS_QT', max_retries=>'5', retry_delay=>'0'); dbms_aqadm.start_queue( 'DEPT_COUNTS_Q',TRUE,TRUE); end; Table Trigger Queue Table EnQueue DeQueue Summary Table Payload

prligence Empowering Intelligence Enqueue Procedure create or replace procedure enq_dept_counts_q (p_msg in dept_counts_type) as enq_opt dbms_aq.enqueue_options_t; msg_prop dbms_aq.message_properties_t; msg_id raw(16); begin sys.dbms_aq.enqueue ( 'DEPT_COUNTS_Q',enq_opt, msg_prop, p_msg, msg_id); end; Table Trigger Queue Table EnQueue DeQueue Summary Table Payload

prligence Empowering Intelligence Dequeue Procedure create or replace procedure deq_dept_counts_q as deq_opt dbms_aq.dequeue_options_t; msg_prop dbms_aq.message_properties_t; payload dept_counts_type; msgid raw(16); begin loop deq_opt.wait := dbms_aq.forever; deq_opt.navigation := dbms_aq.next_message; dbms_aq.dequeue( 'DEPT_COUNTS_Q', deq_opt, msg_prop, payload, msgid); process_dept_counts(payload.action_type, payload.old_deptno, payload.new_deptno); commit; end loop; end; Table Trigger Queue Table EnQueue DeQueue Summary Table Payload

prligence Empowering Intelligence Trigger create or replace trigger tr_ar_iud_emp after insert or delete or update on emp for each row declare l_action char(1); l_old_deptno number(2); l_new_deptno number(2); begin enq_dept_counts_q( dept_counts_type( l_action, l_old_deptno, l_new_deptno)); end; Table Trigger Queue Table EnQueue DeQueue Summary Table Payload

prligence Empowering Intelligence Solution Revisited Table Trigger Queue Table EnQueueDeQueue Summary Table Payload

prligence Empowering Intelligence Important Considerations Asynchronous Decoupled Table Trigger Queue Table EnQueueDeQueue Summary Table Payload Transaction 1Transaction 2

prligence Empowering Intelligence Administration Number of Messages in Queue select count(*) from AQ$DEPT_COUNTS_QT where queue = 'DEPT_COUNTS_Q'

prligence Empowering Intelligence Usage Datawarehouse OLTP Complex Queries Data from Heterogeneous Sources –MQ Series Maintaining Flattened Tables in OLTP

prligence Empowering Intelligence Thank you! Summary Management By Advanced Queues Paper # 419