Re: Streams configuration within schemas in a database
Date: Mon, 9 Mar 2009 08:51:57 -0500
Since you have streams running already, I assume, you know how to do basic setup for streams. With that, to setup streams between two schemas in the same database, you would setup streams just like schemas between two different database (i.e. loop back database link, capture, propagate and apply) etc. Then add a DML handler to the table at apply process.
Please see example code below. Of course, I haven't tested this, but should work just fine.
Example: EMP table from SCOTT schema to MARY schema.
REM We create a generic dml handler so that we can reuse it. REM Following example manipulates LCRs and updates schema. REM conn as strmadmin for this procedure CREATE OR REPLACE PROCEDURE generic_dml_handler(in_any IN SYS.ANYDATA) IS lcr SYS.LCR$_ROW_RECORD;
-- Access the LCR
rc := in_any.GETOBJECT(lcr);
-- Get the object command type
command := lcr.GET_COMMAND_TYPE();
-- Get current object name
l_object_name := lcr.GET_OBJECT_NAME();
-- Set the object_owner in the row LCR if object name and owner matches. if (l_object_name='EMP') then
l_owner := lcr.GET_OBJECT_OWNER();
IF (l_owner = 'SCOTT') then
- Schema owner modified from scott to mary for emp table. lcr.SET_OBJECT_OWNER ( 'MARY'); end if; end if; -- Apply the row LCR as an INSERT into the new table lcr.EXECUTE(true); END; / REM Add above DML Handler to the table
object_name => 'scott.emp',
object_type => 'TABLE',
operation_name => 'INSERT',-- modify accordingly error_handler => false,
user_procedure => 'strmadmin.generic_dml_handler', apply_database_link => NULL);
-- Cheers Riyaj Shamsudeen Principal DBA, Ora!nternals - http://www.orainternals.com Specialists in Performance, Recovery and EBS11i Blog: http://orainternals.wordpress.com On Mon, Mar 9, 2009 at 7:58 AM, gidhin joy <gidhin_at_gmail.com> wrote:Received on Mon Mar 09 2009 - 08:51:57 CDT
> Hi Lists,
> I need to configure streams for tables within database (From schema A to
> B) which i feels difficult since my configuration just fails.
> Can someone help me with the steps on configuring streams in same database
> or provide some links on this topic
> I am already using a streams environment between tables in databases
> located in Windows and Linux db server wich work fine.
> OS: AIX 5.3
> Oracle: 10.2.0.2.0