1 © 2006 Julian Dyke Streams Julian Dyke Independent Consultant juliandyke.com Web Version.

Slides:



Advertisements
Similar presentations
Data Definition Language (DDL)
Advertisements

4 Copyright © 2005, Oracle. All rights reserved. Extraction, Transformation, and Loading (ETL) Extraction and Transportation.
1 © 2006 Julian Dyke Supplemental Logging Julian Dyke Independent Consultant juliandyke.com Web Version.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 8 Application Data Auditing.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 8 Application Data Auditing.
A First look at Database Vault David Bergmeier.  Overview  Installation  Limitations  Securing Data  Backups  A trigger problem Agenda.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Overview of Database Administrator (DBA) Tools
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 2 Overview of Database Administrator (DBA) Tools.
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
15 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Memory.
System Administration Accounts privileges, users and roles
Backup The flip side of recovery. Types of Failures Transaction failure –Transaction must be aborted System failure –Hardware or software problem resulting.
Harvard University Oracle Database Administration Session 2 System Level.
Oracle Database Architecture An Oracle server: –Is a database management system that provides an open, comprehensive, integrated approach to information.
Oracle Database Architecture An Oracle server: –Is a database management system that provides an open, comprehensive, integrated approach to information.
Advanced Databases Basic Database Administration Guide to Oracle 10g 1.
INTRODUCTION TO ORACLE
1 © 2006 Julian Dyke Logical Standby Julian Dyke Independent Consultant juliandyke.com Web Version.
1 © 2010 Julian Dyke Real Application Testing Julian Dyke Independent Consultant juliandyke.com Web Version.
Adapted from Afyouni, Database Security and Auditing Database Application Auditing – Ch. 8.
1 © 2005 Julian Dyke Oracle 10.2 RAC New Features Julian Dyke Independent Consultant Web Version juliandyke.com.
1 Data Guard Basics Julian Dyke Independent Consultant Web Version - February 2008 juliandyke.com © 2008 Julian Dyke.
Getting Started with Oracle11g Abeer bin humaid. Create database user You should create at least one database user that you will use to create database.
Oracle Database Administration
CHAPTER 2 Implementing a Database. Introduction to Creating Databases After you’ve installed the Oracle software, the next logical step is to create a.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Oracle Streams--Simplifying Information Sharing in Oracle10 g Patricia McElroy Product Manager Oracle Corporation Session id:
CHAPTER 6 Users and Basic Security. Progression of Steps for Creating a Database Environment 1. Install Oracle database binaries (Chapter 1) 2. Create.
Backup and Recovery Protects From Data Loss. Backup and Recovery Protects From Data Loss Provides for Media Recovery.
9 Copyright © 2005, Oracle. All rights reserved. Administering User Security.
5 Copyright © 2009, Oracle. All rights reserved. Right-Time Data Warehousing with OWB.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC End User Management – Lecture 3 Copyright System Managers LLC 2007 all rights reserved.
1 RAC Internals Julian Dyke Independent Consultant Web Version juliandyke.com © 2007 Julian Dyke.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
16 Copyright © Oracle Corporation, All rights reserved. Managing Privileges.
A Guide to Oracle9i1 Database Instance startup and shutdown.
NoCOUG Summer Conference, Aug. 19, Walnut Street, Suite 106 James F. Koopmann Boulder, Colorado 80301Director of Technical Consulting
Controlling User Access. Objectives After completing this lesson, you should be able to do the following: Create users Create roles to ease setup and.
Anton TopurovIT-DB 23 April 2013 Introduction to Oracle2.
17 Copyright © Oracle Corporation, All rights reserved. Recovery Catalog Creation and Maintenance.
1 Configuring Advanced Replication Julian Dyke Independent Consultant Web Version - July 2009 juliandyke.com © 2009 Julian Dyke.
Oracle FULL EXP/IMP 11i Database SURENDER SARA NCOAUG
Roles & privileges privilege A user privilege is a right to execute a particular type of SQL statement, or a right to access another user's object. The.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
Page 1. Data Integration Using Oracle Streams A Case Study Session #:
Nitin Singh/AAO RTI ALLAHABAD1 DATABASE SECURITY DATABASE SECURITY.
Oracle® Streams for Near Real Time Asynchronous Replication Nimar S. Arora Oracle USA.
1 © 2010 Julian Dyke Edition-Based Redefinition Julian Dyke Independent Consultant juliandyke.com Web Version.
3 Copyright © 2004, Oracle. All rights reserved. Controlling Access to the Oracle Listener.
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
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.
CERN IT Department CH-1211 Genève 23 Switzerland t Streams Service Review and Outlook Distributed Database Workshop PIC, 20th April 2009.
3 Copyright © 2007, Oracle. All rights reserved. Using the RMAN Recovery Catalog.
1 Chapters 21, 22, 23, 37  Ch. 21: SQL*Loader  Ch. 22: Database Links, Oracle Net  Ch. 23: Materialized Views (aka Snapshots)  Ch. 37: Data Dictionary.
Intro To Oracle :part 1 1.Save your Memory Usage & Performance. 2.Oracle Login ways. 3.Adding Database to DB Trees. 4.How to Create your own user(schema).
19 Managing Privileges Objectives Identifying system and object privileges Granting and revoking privileges Controlling operating system or password.
C Copyright © 2007, Oracle. All rights reserved. Security New Features.
C Copyright © 2006, Oracle. All rights reserved. Integrating with Oracle Streams.
20 Copyright © 2006, Oracle. All rights reserved. Best Practices and Operational Considerations.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
WLCG Collaboration Workshop CMS online/offline replication
Controlling User Access
Recovery Catalog Creation and Maintenance
STREAMS failover and resynchronization
Create New User in Database. First Connect the System.
CS347 Spring 2017 – Quiz 5 Preparation - Solutions UTEID _________
Presentation transcript:

1 © 2006 Julian Dyke Streams Julian Dyke Independent Consultant juliandyke.com Web Version

© 2006 Julian Dyke juliandyke.com 2 Streams

© 2006 Julian Dyke juliandyke.com 3 Streams Multi-Database Configuration Capture Changes Source Database Enqueue LCRs Record Changes Log Changes LGWR Streams Queue Online Redo Log Capture Process Database Objects Apply Process Streams Queue Target Database Apply Changes Dequeue LCRs Propagate LCRs

© 2006 Julian Dyke juliandyke.com 4 Streams Archived Log Downstream Capture Capture Changes Source Database Downstream Database Enqueue LCRs Record Changes Log Changes Write Redo Data LGWRARCn Read Redo Data Streams Queue Online Redo Log Archived Redo Log Capture Process Copy Redo Log Files Database Objects Archived Redo Log

© 2006 Julian Dyke juliandyke.com 5 Streams Real-Time Downstream Capture Online Redo Log Log Changes Source Database Downstream Database Enqueue LCRs Record Changes Send Redo Data Log Changes Write Redo Data RFSLGWR Streams Queue Read Redo Data LGWR Database Objects Capture Process Standby Redo Log Archived Redo Log

© 2006 Julian Dyke juliandyke.com 6 Streams Preparation  Used two separate servers  server1 and server2  Used DBCA to create one database on each server  SOURCE and TARGET  Archiving must be enabled  Used default value for GLOBAL_NAMES (FALSE)  Oracle recommends setting this parameter to TRUE  Installed SCOTT/TIGER schema  $ORACLE_HOME/rdbms/admin/utlsampl.sql

© 2006 Julian Dyke juliandyke.com 7 Streams Preparation  Modified TNSNAMES.ORA on both nodes SOURCE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = SOURCE) ) ) TARGET = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = server2)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = TARGET) ) )

© 2006 Julian Dyke juliandyke.com 8 Streams Configuration  On both source and target as SYSDBA  Create STREAMS tablespace CREATE TABLESPACE streams DATAFILE '/u01/oradata/SOURCE/streams01.dbf' SIZE 100M;  Create STRMADMIN user CREATE USER strmadmin IDENTIFIED BY strmadmin DEFAULT TABLESPACE STREAMS QUOTA UNLIMITED ON STREAMS;

© 2006 Julian Dyke juliandyke.com 9 Streams Configuration  On both servers as SYSDBA grant privileges to STRMADMIN GRANT CONNECT, RESOURCE, DBA TO STRMADMIN; EXECUTE DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE( - privilege => 'ENQUEUE_ANY', - grantee => 'STRMADMIN', - admin_option => FALSE); - EXECUTE DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE( - privilege => 'DEQUEUE_ANY', - grantee => 'STRMADMIN', - admin_option => FALSE); EXECUTE DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE( - privilege => 'MANAGE_ANY', - grantee => 'STRMADMIN', - admin_option => TRUE); EXECUTE DBMS_AQADM.GRANT_TYPE_ACCESS( - user_name => 'STRMADMIN');

© 2006 Julian Dyke juliandyke.com 10 Streams Configuration  Grant more privileges... EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.CREATE_EVALUATION_CONTEXT_OBJ, - grantee => 'STRMADMIN', - grant_option => TRUE); EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.CREATE_RULE_SET_OBJ, - grantee => 'STRMADMIN', - grant_option => TRUE); EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.CREATE_RULE_OBJ, - grantee => 'STRMADMIN', - grant_option => TRUE); EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.CREATE_ANY_RULE_SET, - grantee => 'STRMADMIN', - grant_option => TRUE);

© 2006 Julian Dyke juliandyke.com 11 Streams Configuration  Grant even more privileges... EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.ALTER_ANY_RULE_SET, - grantee => 'STRMADMIN', - grant_option => TRUE); EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE_SET, - grantee => 'STRMADMIN', - grant_option => TRUE); EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.CREATE_ANY_RULE, - grantee => 'STRMADMIN', - grant_option => TRUE); EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.ALTER_ANY_RULE, - grantee => 'STRMADMIN', - grant_option => TRUE);

© 2006 Julian Dyke juliandyke.com 12 Streams Configuration  And finally... EXECUTE DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE('STRMADMIN'); EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE, - grantee => 'STRMADMIN', - grant_option => TRUE); EXECUTE DBMS_RULE_ADM.GRANT_OBJECT_PRIVILEGE( - privilege => DBMS_RULE_ADM.EXECUTE_ON_EVALUATION_CONTEXT, - object_name => 'SYS.STREAMS$_EVALUATION_CONTEXT', - grantee => 'STRMADMIN', - grant_option => FALSE ); EXECUTE DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( - privilege => DBMS_RULE_ADM.EXECUTE_ANY_EVALUATION_CONTEXT, - grantee => 'STRMADMIN', - grant_option => TRUE);

© 2006 Julian Dyke juliandyke.com 13 Streams Configuration  On both servers as STRMADMIN create AQ queue table and queue EXECUTE DBMS_STREAMS_ADM.SET_UP_QUEUE( - queue_table => 'STREAMS_QUEUE', - queue_name => 'STREAMS_QUEUE', - queue_user => 'STRMADMIN');  On source as STRMADMIN create database link to target CREATE DATABASE LINK TARGET CONNECT TO strmadmin IDENTIFIED BY strmadmin USING 'TARGET';  On target as STRMADMIN create database link to source CREATE DATABASE LINK SOURCE CONNECT TO strmadmin IDENTIFIED BY strmadmin USING 'SOURCE';

© 2006 Julian Dyke juliandyke.com 14 Streams Configuration  On source as STRMADMIN build Logminer dictionary DECLARE l_scn number; BEGIN -- Build Logminer dictionary for the capture process DBMS_CAPTURE_ADM.BUILD (l_scn); -- Creates the capture based on the previous build DBMS_CAPTURE_ADM.CREATE_CAPTURE ( queue_name=>'STRMADMIN.STREAMS_QUEUE', capture_name=>'CAPTURE1', checkpoint_retention_time=>7, first_scn=>l_scn ); END; /

© 2006 Julian Dyke juliandyke.com 15 Streams Configuration  On source as STRMADMIN create capture rules for SCOTT.EMP DECLARE l_global_name varchar2(255); BEGIN -- Get the global name of the database SELECT global_name INTO l_global_name FROM global_name; -- Adds the SCOTT.EMP to the streams capture rules DBMS_STREAMS_ADM.ADD_TABLE_RULES ( table_name => 'SCOTT.EMP', streams_type => 'CAPTURE', streams_name => 'CAPTURE1', queue_name => 'STRMADMIN.STREAMS_QUEUE', include_dml => TRUE, include_ddl => TRUE, source_database => l_global_name ); END; /

© 2006 Julian Dyke juliandyke.com 16 Streams Configuration  On source as STRMADMIN prepare table for instantiation -- Prepare tables for instantiation -- Supplemental logging must be enabled on the tables BEGIN DBMS_CAPTURE_ADM.PREPARE_TABLE_INSTANTIATION ( table_name => 'SCOTT.EMP', supplemental_logging=>'keys' ); END; / ALTER SYSTEM ARCHIVE LOG CURRENT;  On source as STRMADMIN archive the current online redo log

© 2006 Julian Dyke juliandyke.com 17 Streams Configuration  On target as STRMADMIN use Data Pump to copy table SET SERVEROUTPUT ON DECLARE l_job_handle NUMBER; -- Data Pump job handle l_job_state VARCHAR2(30); -- Keeps track of job state l_scn NUMBER;-- SCN BEGIN -- Get scn from source l_scn := --Create a user-named Data Pump job to do a "table-level" import --using a network link l_job_handle := DBMS_DATAPUMP.OPEN ( operation => 'IMPORT', job_mode => 'TABLE', remote_link => 'SOURCE', job_name => 'IMPORT_SCOTT_'||TO_CHAR (SYSDATE,'SSSSS') );

© 2006 Julian Dyke juliandyke.com 18 Streams Configuration  Data Pump continued Schema filter DBMS_DATAPUMP.METADATA_FILTER ( handle => l_job_handle, name => 'SCHEMA_LIST', value => '''SCOTT'' ); -- Table filter DBMS_DATAPUMP.METADATA_FILTER ( handle => l_job_handle, name => 'NAME_LIST', value => '''EMP''' );

© 2006 Julian Dyke juliandyke.com 19 Streams Configuration  Data Pump continued Set parameters DBMS_DATAPUMP.SET_PARAMETER ( handle => l_job_handle, name => 'FLASHBACK_SCN', value => l_scn ); DBMS_DATAPUMP.SET_PARAMETER ( handle => l_job_handle, name => 'TABLE_EXISTS_ACTION', value => 'REPLACE' );

© 2006 Julian Dyke juliandyke.com 20 Streams Configuration  Data Pump continued Start the Datapump job DBMS_DATAPUMP.START_JOB ( handle => l_job_handle, skip_current => 0 ); DBMS_DATAPUMP.WAIT_FOR_JOB ( handle => l_job_handle, job_state => l_job_state ); DBMS_OUTPUT.PUT_LINE ('Job completed - job state = '||l_job_state); DBMS_DATAPUMP.DETACH (handle => l_job_handle); END; /

© 2006 Julian Dyke juliandyke.com 21 Streams Configuration  On target as STRMADMIN add table rules for SCOTT.EMP DECLARE l_scn number; BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES ( table_name => 'SCOTT.EMP', streams_type => 'APPLY', streams_name => 'APPLY1', queue_name => 'STRMADMIN.STREAMS_QUEUE', include_dml => TRUE, include_ddl => TRUE, source_database => 'SOURCE' ); END; /

© 2006 Julian Dyke juliandyke.com 22 Streams Configuration  On target as STRMADMIN set table instantiation SCN DECLARE l_scn number; BEGIN l_scn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER (); -- Set the table instantiation SCN DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN ( source_object_name => 'SCOTT.EMP', source_database_name => 'SOURCE', instantiation_scn => l_scn ); END; /

© 2006 Julian Dyke juliandyke.com 23 Streams Configuration  On source as STRMADMIN add the SCOTT schema to the propagation rules BEGIN -- add the schema to the propagation rules DBMS_STREAMS_ADM.ADD_SCHEMA_PROPAGATION_RULES ( schema_name => 'SCOTT', streams_name => 'PROPAGATE1', source_queue_name => 'STRMADMIN.STREAMS_QUEUE', destination_queue_name => include_dml => TRUE, include_ddl => TRUE, queue_to_queue => TRUE, source_database => 'SOURCE' ); END; /

© 2006 Julian Dyke juliandyke.com 24 Streams Configuration  On target as STRMADMIN start apply process EXECUTE DBMS_APPLY_ADM.START_APPLY ('APPLY1');  On source as STRMADMIN start capture process EXECUTE DBMS_CAPTURE_ADM.START_CAPTURE ('CAPTURE1');  Note - propagation is started automatically by the ADD_SCHEMA_PROPAGATION_RULES procedure

© 2006 Julian Dyke juliandyke.com 25 Logical Change Records

© 2006 Julian Dyke juliandyke.com 26 Logical Change Records Introduction  Two types of LCR  row LCR  SYS.LCR$_ROW_RECORD  DDL LCR  SYS.LCR$_DDL_RECORD  Enqueued into an ANYDATA queue  Can be  Captured by capture process  Constructed and enqueued by user or application  Can be modified by  Rule-based transformation  Apply process

© 2006 Julian Dyke juliandyke.com 27 Logical Change Records Example  This is an example of manual creation of an LCR  Example 1 - Create LCR on target server  As SYSDBA grant privileges to STRMADMIN user GRANT EXECUTE ON DBMS_STREAMS_MESSAGING TO strmadmin;  As STRMADMIN create a queue table and a queue BEGIN DBMS_STREAMS_ADM.SET_UP_QUEUE ( queue_table => 'QUEUE_TABLE2', storage_clause => NULL, queue_name => 'QUEUE2' ); END; /

© 2006 Julian Dyke juliandyke.com 28 Logical Change Records Example  Create apply process BEGIN DBMS_APPLY_ADM.CREATE_APPLY ( queue_name => 'QUEUE2', apply_name=> 'APPLY2', apply_captured=> FALSE, apply_user => 'SCOTT' ); END; /

© 2006 Julian Dyke juliandyke.com 29 Logical Change Records Example  Create add table rules for SCOTT.EMP BEGIN DBMS_STREAMS_ADM.ADD_TABLE_RULES ( table_name => 'SCOTT.DEPT', streams_type => 'APPLY', streams_name => 'APPLY2', queue_name => 'QUEUE2', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'SOURCE', inclusion_rule => TRUE ); END; /

© 2006 Julian Dyke juliandyke.com 30 Logical Change Records Example  Do not disable apply process when an error is encountered BEGIN DBMS_APPLY_ADM.SET_PARAMETER ( apply_name => 'APPLY2', parameter => 'DISABLE_ON_ERROR', value => 'N' ); END; /  Start apply process EXECUTE DBMS_APPLY_ADM.START_APPLY ('APPLY2');

© 2006 Julian Dyke juliandyke.com 31 Logical Change Records Example  In source database create propagation process BEGIN -- add the schema to the propagation rules DBMS_STREAMS_ADM.ADD_SCHEMA_PROPAGATION_RULES( schema_name => 'SCOTT', streams_name => 'PROPAGATE2', source_queue_name => 'STRMADMIN.QUEUE2', destination_queue_name => include_dml => TRUE, include_ddl => FALSE, queue_to_queue => TRUE, source_database => 'SOURCE' ); END; /

© 2006 Julian Dyke juliandyke.com 32 Logical Change Records Insert Example  Inserting a row (1 of 3) DECLARE l_deptno SYS.LCR$_ROW_UNIT; l_dname SYS.LCR$_ROW_UNIT; l_loc SYS.LCR$_ROW_UNIT; l_newvals SYS.LCR$_ROW_LIST; l_row SYS.LCR$_ROW_RECORD; BEGIN l_deptno := SYS.LCR$_ROW_UNIT ( 'DEPTNO', ANYDATA.ConvertNumber (50), DBMS_LCR.NOT_A_LOB, NULL, NULL ); INSERT INTO dept (deptno,dname,loc) VALUES (50,'IT','LONDON');

© 2006 Julian Dyke juliandyke.com 33 Logical Change Records Insert Example  Inserting a row (2 of 3) l_dname := SYS.LCR$_ROW_UNIT ( 'DNAME', ANYDATA.ConvertVarchar2 ('IT'), DBMS_LCR.NOT_A_LOB, NULL, NULL ); l_loc := SYS.LCR$_ROW_UNIT ( 'LOC', ANYDATA.ConvertVarchar2 ('LONDON'), DBMS_LCR.NOT_A_LOB, NULL, NULL ); l_newvals := SYS.LCR$_ROW_LIST (l_deptno,l_dname,l_loc);

© 2006 Julian Dyke juliandyke.com 34 Logical Change Records Insert Example  Inserting a row (3 of 3) -- Construct the LCR l_row := SYS.LCR$_ROW_RECORD.CONSTRUCT ( source_database_name => 'SOURCE', command_type => 'INSERT', object_owner => 'SCOTT', object_name => 'DEPT', old_values => NULL, new_values => l_new_vals ); DBMS_STREAMS_MESSAGING.ENQUEUE ( queue_name => 'QUEUE2', payload => ANYDATA.ConvertObject (l_row) );

© 2006 Julian Dyke juliandyke.com 35 Logical Change Records Update Example  Updating a row (1 of 3) DECLARE l_deptno SYS.LCR$_ROW_UNIT; l_old_loc SYS.LCR$_ROW_UNIT; l_new_loc SYS.LCR$_ROW_UNIT; l_oldvals SYS.LCR$_ROW_LIST; l_newvals SYS.LCR$_ROW_LIST; l_row SYS.LCR$_ROW_RECORD; BEGIN l_deptno := SYS.LCR$_ROW_UNIT ( 'DEPTNO', ANYDATA.ConvertNumber (50), DBMS_LCR.NOT_A_LOB, NULL, NULL ); UPDATE dept SET loc = 'READING' WHERE deptno = 50;

© 2006 Julian Dyke juliandyke.com 36 Logical Change Records Update Example  Updating a row (2 of 3) l_old_loc := SYS.LCR$_ROW_UNIT ( 'LOC', ANYDATA.ConvertVarchar2 ('LONDON'), DBMS_LCR.NOT_A_LOB, NULL, NULL ); l_oldvals := SYS.LCR$_ROW_LIST (l_deptno,l_old_loc); l_new_loc := SYS.LCR$_ROW_UNIT ( 'LOC', ANYDATA.ConvertVarchar2 ('READING'), DBMS_LCR.NOT_A_LOB, NULL, NULL ); l_newvals := SYS.LCR$_ROW_LIST (l_new_loc);

© 2006 Julian Dyke juliandyke.com 37 Logical Change Records Update Example  Updating a row (3 of 3) -- Construct the LCR l_row := SYS.LCR$_ROW_RECORD.CONSTRUCT ( source_database_name => 'SOURCE', command_type => 'UPDATE', object_owner => 'SCOTT', object_name => 'DEPT', old_values => l_old_vals, new_values => l_new_vals ); DBMS_STREAMS_MESSAGING.ENQUEUE ( queue_name => 'QUEUE2', payload => ANYDATA.ConvertObject (l_row) );

© 2006 Julian Dyke juliandyke.com 38 Thank you for your interest