LOB in subset rules?

Is there any way to add subset of a table with LOB column to streams with add_subset_propagation_rules ? I saw in oracle docs that you cannot use tables with LOB columns in add_subset_propagation_rules AND add_subset_rules procedures.Why? There should be some alternative (and easy) way to do it, any ideas? It makes many problems for me now!!! :(
Edited by: p2 on Jun 1, 2009 4:14 AM

Sorry, the was another rule not associated with the subset that evaluated to TRUE. I deleted this rule and it corrected the problem.

Similar Messages

  • Subset rule usage..

    Hi Experts,
    Please help me out in this situation. I would like to implement subset rules on a CAPTURE process where i can ignore the transactions on a specific column value.
    Example: On table EMP i would like to ignore the transaction, when ever any insert/update/delete done on that table where JOB='MGR'.
    Can i use DML_CONDITION as ' JOB != 'MGR''' . I tried this this wouldn't help me. Please help me out.

    you can use sub set rules provinding your table has no long or lob/clob. If it is the case, then you have to create an context, attach it the capture and perform a switch to a condition that will be discarted by the propagtion process.
    There are example on this forum.

  • Subset rules & CLOB

    I need to know is this true or not??
    "Creating subset rules for tables that have one or more LOB columns is not supported."
    So If I need to replicate a table for only pro_id = xxx, and unfortunely this
    table contains one LOB column. It is NO WAY to do it??? If it is no way to use subset rules, is there any other way I can do it?? My database just upgraded to 9.2.0.4, is this help?

    Sorry, the was another rule not associated with the subset that evaluated to TRUE. I deleted this rule and it corrected the problem.

  • Applying subset rules in Oracle streams

    Hi All,
    I am working to configure Streams.I am abe to do repliacation on table table unidirectional & bidirectional. I am facing problem in add_subset rules as capture,propagation & apply process is not showing error. The fillowing is the script i am using to configure add_subset_rules. Please guide me what is the wrong & how to go about it.
    he Global Database Name of the Source Database is POCSRC. The Global Database Name of the Destination Database is POCDESTN. In the example setup, DEPT table belonging to SCOTT schema has been used for demonstration purpose.
    Section 1 - Initialization Parameters Relevant to Streams
    •     COMPATIBLE: 9.2.0.
    •     GLOBAL_NAMES: TRUE
    •     JOB_QUEUE_PROCESSES : 2
    •     AQ_TM_PROCESSES : 4
    •     LOGMNR_MAX_PERSISTENT_SESSIONS : 4
    •     LOG_PARALLELISM: 1
    •     PARALLEL_MAX_SERVERS:4
    •     SHARED_POOL_SIZE: 350 MB
    •     OPEN_LINKS : 4
    •     Database running in ARCHIVELOG mode.
    Steps to be carried out at the Destination Database (POCDESTN.)
    1. Create Streams Administrator :
    connect SYS/pocdestn@pocdestn as SYSDBA
    create user STRMADMIN identified by STRMADMIN default tablespace users;
    2. Grant the necessary privileges to the Streams Administrator :
    GRANT CONNECT, RESOURCE, AQ_ADMINISTRATOR_ROLE to STRMADMIN;
    GRANT SELECT ANY DICTIONARY TO STRMADMIN;
    GRANT EXECUTE ON DBMS_AQ TO STRMADMIN;
    GRANT EXECUTE ON DBMS_AQADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_FLASHBACK TO STRMADMIN;
    GRANT EXECUTE ON DBMS_STREAMS_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_CAPTURE_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_APPLY_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_RULE_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_PROPAGATION_ADM TO STRMADMIN;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'ENQUEUE_ANY',
    grantee => 'STRMADMIN',
    admin_option => FALSE);
    END;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'DEQUEUE_ANY',
    grantee => 'STRMADMIN',
    admin_option => FALSE);
    END;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'MANAGE_ANY',
    grantee => 'STRMADMIN',
    admin_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_EVALUATION_CONTEXT_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_RULE_SET_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_RULE_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.ALTER_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.ALTER_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_EVALUATION_CONTEXT,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    3. Create streams queue :
    connect STRMADMIN/STRMADMIN@POCDESTN
    BEGIN
    DBMS_STREAMS_ADM.SET_UP_QUEUE(
    queue_table => 'STREAMS_QUEUE_TABLE',
    queue_name => 'STREAMS_QUEUE',
    queue_user => 'STRMADMIN');
    END;
    4. Add apply rules for the table at the destination database :
    BEGIN
    DBMS_STREAMS_ADM.ADD_SUBSET_RULES(
    TABLE_NAME=>'SCOTT.EMP',
    STREAMS_TYPE=>'APPLY',
    STREAMS_NAME=>'STRMADMIN_APPLY',
    QUEUE_NAME=>'STRMADMIN.STREAMS_QUEUE',
    DML_CONDITION=>'empno =7521',
    INCLUDE_TAGGED_LCR=>FALSE,
    SOURCE_DATABASE=>'POCSRC');
    END;
    5. Specify an 'APPLY USER' at the destination database:
    BEGIN
    DBMS_APPLY_ADM.ALTER_APPLY(
    apply_name => 'STRMADMIN_APPLY',
    apply_user => 'SCOTT');
    END;
    6. BEGIN
    DBMS_APPLY_ADM.SET_PARAMETER(
    apply_name => 'STRMADMIN_APPLY',
    parameter => 'DISABLE_ON_ERROR',
    value => 'N' );
    END;
    7. Start the Apply process :
    BEGIN
    DBMS_APPLY_ADM.START_APPLY(apply_name => 'STRMADMIN_APPLY');
    END;
    Section 3 - Steps to be carried out at the Source Database (POCSRC.)
    1. Move LogMiner tables from SYSTEM tablespace:
    By default, all LogMiner tables are created in the SYSTEM tablespace. It is a good practice to create an alternate tablespace for the LogMiner tables.
    CREATE TABLESPACE LOGMNRTS DATAFILE 'd:\oracle\oradata\POCSRC\logmnrts.dbf' SIZE 25M AUTOEXTEND ON MAXSIZE UNLIMITED;
    BEGIN
    DBMS_LOGMNR_D.SET_TABLESPACE('LOGMNRTS');
    END;
    2. Turn on supplemental logging for DEPT table :
    connect SYS/password as SYSDBA
    ALTER TABLE scott.emp ADD SUPPLEMENTAL LOG GROUP emp_pk
    (empno) ALWAYS;
    3. Create Streams Administrator and Grant the necessary privileges :
    3.1 Create Streams Administrator :
    connect SYS/password as SYSDBA
    create user STRMADMIN identified by STRMADMIN default tablespace users;
    3.2 Grant the necessary privileges to the Streams Administrator :
    GRANT CONNECT, RESOURCE, AQ_ADMINISTRATOR_ROLE to STRMADMIN;
    GRANT SELECT ANY DICTIONARY TO STRMADMIN;
    GRANT EXECUTE ON DBMS_AQ TO STRMADMIN;
    GRANT EXECUTE ON DBMS_AQADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_FLASHBACK TO STRMADMIN;
    GRANT EXECUTE ON DBMS_STREAMS_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_CAPTURE_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_APPLY_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_RULE_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_PROPAGATION_ADM TO STRMADMIN;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'ENQUEUE_ANY',
    grantee => 'STRMADMIN',
    admin_option => FALSE);
    END;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'DEQUEUE_ANY',
    grantee => 'STRMADMIN',
    admin_option => FALSE);
    END;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'MANAGE_ANY',
    grantee => 'STRMADMIN',
    admin_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_EVALUATION_CONTEXT_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_RULE_SET_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_RULE_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.ALTER_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.ALTER_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_EVALUATION_CONTEXT,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    4. Create a database link to the destination database :
    connect STRMADMIN/STRMADMIN@pocsrc
    CREATE DATABASE LINK POCDESTN connect to
    STRMADMIN identified by STRMADMIN using 'POCDESTN';
    Test the database link to be working properly by querying against the destination database.
    Eg : select * from global_name@POCDESTN;
    5. Create streams queue:
    BEGIN
    DBMS_STREAMS_ADM.SET_UP_QUEUE(
    queue_name => 'STREAMS_QUEUE',
    queue_table =>'STREAMS_QUEUE_TABLE',
    queue_user => 'STRMADMIN');
    END;
    6. Add capture rules for the table at the source database:
    BEGIN
    DBMS_STREAMS_ADM.ADD_TABLE_RULES(
    table_name => 'SCOTT.EMP',
    streams_type => 'CAPTURE',
    streams_name => 'STRMADMIN_CAPTURE',
    queue_name => 'STRMADMIN.STREAMS_QUEUE',
    include_dml => true,
    include_ddl => true,
    source_database => 'POCSRC');
    END;
    7. Add propagation rules for the table at the source database.
    This step will also create a propagation job to the destination database.
    BEGIN
    DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES(
    table_name => 'SCOTT.emp’,
    streams_name => 'STRMADMIN_PROPAGATE',
    source_queue_name => 'STRMADMIN.STREAMS_QUEUE',
    destination_queue_name => 'STRMADMIN.STREAMS_QUEUE@POCDESTN',
    include_dml => true,
    include_ddl => true,
    source_database => 'POCSRC');
    END;
    Section 4 - Export, import and instantiation of tables from Source to Destination Database
    1. If the objects are not present in the destination database, perform an export of the objects from the source database and import them into the destination database
    Export from the Source Database:
    Specify the OBJECT_CONSISTENT=Y clause on the export command.
    By doing this, an export is performed that is consistent for each individual object at a particular system change number (SCN).
    exp USERID=SYSTEM/POCSRC@POCSRC TABLES=SCOTT.TEST FILE=DEPT.dmp GRANTS=Y ROWS=Y LOG=exportDEPT.log OBJECT_CONSISTENT=Y INDEXES=Y STATISTICS = NONE
    Import into the Destination Database:
    Specify STREAMS_INSTANTIATION=Y clause in the import command.
    By doing this, the streams metadata is updated with the appropriate information in the destination database corresponding to the SCN that is recorded in the export file.
    imp USERID=SYSTEM/POCDESTN@POCDESTN FULL=Y CONSTRAINTS=Y FILE=DEPT.dmp IGNORE=Y GRANTS=Y ROWS=Y COMMIT=Y LOG=importDEPT.log STREAMS_INSTANTIATION=Y
    2. If the objects are already present in the desination database, check that they are also consistent at data level, otherwise the apply process may fail with error ORA-1403 when apply a DML on a not consistent row. There are 2 ways of instanitating the objects at the destination site.
    1. By means of Metadata-only export/import :
    Export from the Source Database by specifying ROWS=N
    exp USERID=SYSTEM/POCSRC@POCSRC TABLES=SCOTT.DEPT FILE=tables.dmp
    ROWS=N LOG=exportTables.log OBJECT_CONSISTENT=Y
    exp USERID=SYSTEM/POCSRC@POCSRC TABLES=SCOTT.EMP FILE=tables.dmp
    ROWS=N LOG=exportTables.log OBJECT_CONSISTENT=Y
    For Test table -
    exp USERID=SYSTEM/POCSRC@POCSRC TABLES=SCOTT.TEST FILE=tables.dmp
    ROWS=N LOG=exportTables.log OBJECT_CONSISTENT=Y
    Import into the destination database using IGNORE=Y
    imp USERID=SYSTEM/POCDESTN@POCDESTN FULL=Y FILE=tables.dmp IGNORE=Y
    LOG=importTables.log STREAMS_INSTANTIATION=Y
    2. By Manaually instantiating the objects
    Get the Instantiation SCN at the source database:
    connect STRMADMIN/STRMADMIN@POCSRC
    set serveroutput on
    DECLARE
    iscn NUMBER; -- Variable to hold instantiation SCN value
    BEGIN
    iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER();
    DBMS_OUTPUT.PUT_LINE ('Instantiation SCN is: ' || iscn);
    END;
    Instantiate the objects at the destination database with this SCN value.
    The SET_TABLE_INSTANTIATION_SCN procedure controls which LCRs for a table are to be applied by the apply process. If the commit SCN of an LCR from the source database is less than or equal to this instantiation SCN , then the apply process discards the LCR. Else, the apply process applies the LCR.
    connect STRMADMIN/STRMADMIN@POCDESTN
    BEGIN
    DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN(
    source_object_name => 'SCOTT.DEPT',
    source_database_name => 'POCSRC',
    instantiation_scn => &iscn);
    END;
    connect STRMADMIN/STRMADMIN@POCDESTN
    BEGIN
    DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN(
    source_object_name => 'SCOTT.EMP',
    source_database_name => 'POCSRC',
    instantiation_scn => &iscn);
    END;
    Enter value for iscn:
    <Provide the value of SCN that you got from the source database>
    Finally start the Capture Process:
    connect STRMADMIN/STRMADMIN@POCSRC
    BEGIN
    DBMS_CAPTURE_ADM.START_CAPTURE(capture_name => ‘STRMADMIN_CAPTURE');
    END;
    Please mail me [email protected]
    Thanks.
    Raghunath

    What you are trying to do that you can not do is unclear. You wrote:
    "I am facing problem in add_subset rules as capture,propagation & apply process is not showing error."
    Personally I don't consider it a problem when my code doesn't raise an error. So what is not working the way you think it should? Also what version are you in (to 4 decimal places).

  • Filtering assoc rules using subset method.

    Hello,
    Am trying to filter the association rules using subset method of arules package.
    I have a vector of items that are to be filtered from LHS/RHS.
    Here is the sample code that i have used.
    metalAssoc.mod <-ore.odmAssocRules(~.,NBAssocreqOF,case.id.column="TRANSACTION_VALUE",item.id.column = "PARAM_NAME",
      item.value.column = "PARAM_VALUE_BIN",min.support = 0.05 ,min.confidence = 0.5,max.rule.length = 5)
    rules <- rules(metalAssoc.mod)
    arules <- ore.pull(rules)
    1. Able to filter the rules using below condition.
    arules.subset <- subset(arules, subset= rhs %pin% "Temperature" |  rhs %pin% "Pressure" )
    2. We get a string like  "Temperature";"Pressure" to the function as input.
    Tried forming a vector out of the string and
    arules.subset <- subset(arules, subset= rhs %pin% c( "Temperature", "Pressure")
    This command throws the below error.
    Error in rhs %in% c("Pressure", "Temperature") :
      table contains an unknown item label
    3. Tried forming a string str with valuerhs %pin% "Temperature" |  rhs %pin% "Pressure"
    arules.subset <- subset(arules, subset= str )
    Got the below error
    Error in .translate_index(i, rownames(x), nrow(x)) :
      subscript out of bounds
    Our aim is to filter the rules based on the list of items from RHS/LHS that are passed as a function variable.
    Any help is greatly appreciated.
    Thanks,
    Swathi.

    Swathi,
    If I understand correctly, the following example from the ore.odmAssocRules help file accomplishes what you want using the functions itemsets() along with subset():
    set.seed(7654)
    id <- 1:10
    color <- sample(c("B", "Y", "W", "G"), 10, replace=TRUE)
    shape <- sample(c("tri", "rect", "round"), 10, replace=TRUE)
    state <- sample(c("MA", "CA", "NY"), 10, replace=TRUE)
    data3.ore <- ore.frame(ID=id, COLOR=color, SHAPE=shape, STATE=state)
    ar.mod3 <- ore.odmAssocRules(~., data3.ore, case.id.column = "ID",
             min.support = 0.15, min.confidence = 0.05, max.rule.length = 2)
    rules <- subset(rules(ar.mod3), min.confidence=0.5,
             lhs=list(SHAPE="tri", COLOR="B"), orderby="lift")
    itemsets <- subset(itemsets(ar.mod3), min.support=0.35)
    To view the help file for ore.odmAssocRules, type at the R command prompt:
    ?ore.odmAssocRules
    Sherry

  • ADD_SUBSET_RULES for LOB

    Oracle 11g:
    I need to add a subset_rule for eg: (column * (some forumula)) = result. But the problem is that the table has LOB columns. And subset rule documentation says:
    Also, the specified table cannot have any LOB, LONG, or LONG RAW columns currently or in the future.I am currently in the fix as to what I can do to get rid of that row in capture process.

    Just a quick feedback on this "empty Array".
    The documentation is not cristal clear but I am convinced it refers to the array of LCR
    into the ANYDATA and not an array of ANAYDATA. Nevertherless, I have explored the ARRAY of anydata
    using an action context associated with STREAMS$_ARRAY_TRANS_FUNCTION(as opposed
    to STREAMS$_TRANS_FUNCTION) which allow the return of many ANYDATA for a single
    one ANYDATA input and managed to procuded empty ANYDATA.
    I did not found any reference or example to help me in Google or Metalink
    so I published my findings here as it may serve further people in search of info about usage of
    STREAMS$_ARRAY_TRANS_FUNCTION
    Here is a type of function that could allow this.
    The context must be associated with this function _ARRAY
    declare
      v_dml_rule_name VARCHAR2(30);
      v_ddl_rule_name VARCHAR2(30);
      action_ctx   sys.re$nv_list;
      ac_name      varchar2(30) := 'STREAMS$_ARRAY_TRANS_FUNCTION';       <-- note the '_ARRAY'
    BEGIN
        action_ctx := sys.re$nv_list(sys.re$nv_array());
        action_ctx.add_pair( ac_name, sys.anydata.convertvarchar2('strmadmin.DML_TRANSFORM_FUNCT'));
      DBMS_STREAMS_ADM.ADD_TABLE_RULES(
          table_name         => 'STRMADMIN.TEST_DROP_COL',
          streams_type       => 'capture',
          streams_name       => 'TEST_CAPTURE',
          queue_name         => 'STRMADMIN.TEST_CAPTURE_Q',
          include_dml        => true,
          include_ddl        => false,
          include_tagged_lcr => false,
          inclusion_rule     => true,
          dml_rule_name      => v_dml_rule_name ,
          ddl_rule_name      => v_ddl_rule_name );
        dbms_rule_adm.alter_rule( rule_name    => v_dml_rule_name, action_context => action_ctx);
    END;
    /This create a variation of Streams transformation function with is reported
    into as 'ONE to MANY' transformation into DBA_STREAMS_TRANSFORM_FUNCTION
    col TRANSFORM_FUNCTION_NAME for a50
    col VALUE_TYPE for a30
    select RULE_OWNER, RULE_NAME, VALUE_TYPE, TRANSFORM_FUNCTION_NAME, CUSTOM_TYPE
           from DBA_STREAMS_TRANSFORM_FUNCTION;The function becomes more complicated to adapt to this multi-anydata dimension:
    RULE_OWNER     RULE_NAME        VALUE_TYPE                     TRANSFORM_FUNCTION_NAME                            CUSTOM_TYPE
    STRMADMIN      TEST_DROP_COL44  SYS.VARCHAR2                   strmadmin.DML_TRANSFORM_FUNCT                      ONE TO MANY
    CREATE OR REPLACE function DML_TRANSFORM_FUNCT( inAnyData in SYS.AnyData)
    RETURN sys.STREAMS$_ANYDATA_ARRAY IS
        ret          pls_integer;
        typelcr      VARCHAR2(61);
        lcrOut       SYS.LCR$_ROW_RECORD;
        var_any      anydata ;
        v_num        number ;
        v_lcr        SYS.LCR$_ROW_RECORD;
        v_arr        SYS.STREAMS$_ANYDATA_ARRAY;
    BEGIN
       v_arr:=SYS.STREAMS$_ANYDATA_ARRAY();
       typelcr := inAnyData.getTypeName();
       IF typelcr = 'SYS.LCR$_ROW_RECORD' THEN
          -- Typecast AnyData to LCR$_ROW_RECORD
          ret := inAnyData.GetObject(lcrOut);
          IF lcrOut.get_object_owner() = 'STRMADMIN' THEN
             IF lcrOut.get_object_name() = 'TEST_DROP_COL' THEN
                lcrOut.delete_column(column_name=>'DATA_LONG');
                -- check if we don't need to discard this LCR
                var_any := lcrOut.get_Value('NEW','MYKEY') ;
                if var_any is not null then
                   ret:=var_any.getnumber(v_num);
                   if v_num = 4 then
                       -- We do nothing but return a null ANYDATA
                       RETURN v_arr ;
                   end if;
                end if;
                -- this LCR is not to be discared, then let's apply our transformation
                lcrOut.set_value('new','DATA_SHORT',anydata.convertvarchar2('PP CONVERTED') );
                v_arr.extend;
                v_arr(1) :=SYS.AnyData.ConvertObject(lcrOut);
                RETURN v_arr;
             END IF;
          END IF;
        END IF;
        -- if we are here then the LCR is not a row
            -- or the row was not one bound for transformation,
            -- so we alter nothing
        v_arr.extend;
        v_arr(1) :=inAnyData ;
        RETURN v_arr;
    END;
    /Alas, when the value of MYKEY is null the function produces
    a null ANYDATA which is explicitely forbidden :
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_streams_adm.htm#CDEJFBHD
      Logminer                        Captured                   Capture
            ID Capture user           Start scn   CHANGE_TIME    Type       Rule set Name   Neg rule set    Status
            41 STRMADMIN             110500477205 02-07 13:54:48 LOCAL      RULESET$_28                     ABORTED
                                                                                                                Last remote
                                                           Last system    Last scn      Delay      Last scn      confirmed      Delay
    Capture name           QUEUE_NAME                          scn         Scanned     Scanned     enqueued     scn Applied  Enq-Applied
    TEST_CAPTURE           TEST_CAPTURE_Q                                                                       110503647881
    no rows selected
    ORA-26747: The one-to-many transformation function strmadmin.DML_TRANSFORM_FUNCT
    encountered the following error:  return of NULL anydata array element not allowedOf course I could generate the header
        v_lcr        SYS.LCR$_ROW_RECORD;
                   ret:=var_any.getnumber(v_num);
                   if v_num = 4 then
                       -- lcrOut.set_value('new','DATA_SHORT',anydata.convertvarchar2('v_num = '||to_char(v_num)) );
                       v_lcr :=  SYS.LCR$_ROW_RECORD.CONSTRUCT (
                                         source_database_name=>SYS_CONTEXT('USERENV','DB_NAME'),
                                         command_type=>lcrOut.get_command_type(),
                                         object_owner=>lcrOut.GET_OBJECT_OWNER(),
                                         object_name=>lcrOut.GET_OBJECT_NAME() );
                       v_arr.extend;
                       v_arr(1) := SYS.AnyData.ConvertObject(v_lcr);
                       RETURN v_arr ;
                   end if;But the LCR is create with and sent, not discarded as expected despite
    that there are no columns and it fails miserably at apply site.
    That's all, and that's a failure. Maybe somebody else will have a better inspiration.
    Edited by: bpolarsk on Jul 2, 2009 5:57 AM

  • Data Subsetting for users at runtime

    Hi all
    I have a requirement that I define data subsetting rules for the users based on some conditions which would be done at runtime.
    For ex. I want that whenever the user synchronizes the user should get the data for the last 60days which have been assigned to him.
    Can I have such policy defined.
    If anybody have implemented such thing, kindly let me know.
    thanx
    ramchow

    Hi Shaun
    Thanks for your prompt reply.
    I know this functionality and have been using it in my application from the beginning.
    But I have a requirement that instead of setting values through the control center which is more like static values for each user and application I could allow users to when they synchronizes then they should have the privilege to download on their conditions.
    For example user might say I want to download data for the last 60days.
    I appreciate your prompt reply but that did not solve my problem.
    Waiting for prompt reply again.
    Thanx and regards
    ramchow

  • Need help, implementing streams between oracle 10g databases

    Hello all.
    Please help me, and give me instruction if any body implement streams between databases (Oracle 10g)
    I have implemented streams between schema table on (10g) and result was success.
    Firstly I want to know some thing, such as:
    1) Is it possible make streams with conditions, (make only DML or DDL i know) but make DML and not DELETE operation, just INSERT and UPDATE operations on the table?
    2) After changes was applied on target database, can I delete that records which copied (replicated) on source database?
    I have 2 databases and one of them is for archive purpose (I want use it as target database for streams). Other one is PROD database, applications make DML operation.
    I) record insert with null status
    II) processing (status 1)
    III) if success (status 2) unsuccess (status 3)
    For now, I have cron script on (Linux host) and in this script has PLSQL anonymous block and it works couple times during the day. This script works as archive.
    My task is: Make it via Oracle streams.
    Thank you beforehand.

    For conditions on the type of operation (Insert) check in the doc after apply handler and you can associate what ever code and conditions you want. You can also choose to work with a subset rules but there are some restriction as no lobs :
    [http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/strms_rules.htm#insertedID7|http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/strms_rules.htm#insertedID7]
    For a complete list of the restrictions :
    [http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/ap_restrictions.htm#i1012965|http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/ap_restrictions.htm#i1012965]

  • How to replicate a many to many schema

    Hi,
    We are trying to replicate a many to many schema as the following:
    Table: STATE
    Name ¿Null? Type
    ID_STATE NOT NULL NUMBER
    STATE_NAME NOT NULL VARCHAR2(32)
    Table: USER
    Name ¿Null? Type
    ID_USER NOT NULL NUMBER
    USER_NAME NOT NULL VARCHAR2(32)
    Table: USER_STATE
    Name ¿Null? Type
    ID_USER NOT NULL NUMBER
    ID_STATE NOT NULL NUMBER
    We have a configuration with three nodes, one master node and two slave nodes in each state.
    We would like to have a subsetting configuration, where only the Users that belong to the State 1, are replicated to first node, and the Users that belong to the State 2, are replicated to the second node.
    Is possible to make this configuration using subsetting rules? We have tried to do that but as subsetting has to be configured only for each table, is not possible to make it work with the three tables working together. For example, if I insert one record in the table USER, it must not be replicated, as it is no associated with any state... after if I insert a record in the table USER_STATE, for this user, making him belong to the state one, it must replicate this record but ALSO the record in the table USER that now belongs to the state 1...
    Is possible to get this working? And if it is, how?
    Thank you all.

    It may be possible to do this using a 1-many custom rule-based transformationon the capture rules.
    <p>
    With a 1-many transformation on a rule, a single LCR is passed into your PL/SQL function as an array of size 1. On return from the function, your procedure will return an array of anydata with 2 LCRs (the original LCR and a newly created LCR ).
    <p> For example: for a change(LCR) that occurs in the USER_STATE table, you can construct an additional LCR for the USER table and return both LCRs to the capture process. You may need to add an additional column (add_column) to associate this new USER LCR with the state. This would be temporary so that this user record can go along the same path as the user_state record. At the destination, you would eliminate the extra STATE column with a delete_column call with an apply rule declarative transformation..
    <p>
    Another variation: if there are only 2 states, you could have a separate capture for each state and just do the 1-many transformation on each capture. In this case, it would not be necessary to add an temporary state column to the LCR.
    Both of these solutions will have an impact on performance, as a PL/SQL function is called every time the rule that includes the custom transformation evaluates to TRUE.

  • Problem in add_subset_rules

    Applying subset rules in Oracle streams
    Posted: Feb 28, 2008 8:47 PM Reply
    Hi All,
    I am working to configure Streams.I am abe to do repliacation on table table unidirectional & bidirectional. I am facing problem in add_subset rules as capture,propagation & apply process is not showing error. The fillowing is the script i am using to configure add_subset_rules. Please guide me what is the wrong & how to go about it.
    he Global Database Name of the Source Database is POCSRC. The Global Database Name of the Destination Database is POCDESTN. In the example setup, DEPT table belonging to SCOTT schema has been used for demonstration purpose.
    Section 1 - Initialization Parameters Relevant to Streams
    • COMPATIBLE: 9.2.0.
    • GLOBAL_NAMES: TRUE
    • JOB_QUEUE_PROCESSES : 2
    • AQ_TM_PROCESSES : 4
    • LOGMNR_MAX_PERSISTENT_SESSIONS : 4
    • LOG_PARALLELISM: 1
    • PARALLEL_MAX_SERVERS:4
    • SHARED_POOL_SIZE: 350 MB
    • OPEN_LINKS : 4
    • Database running in ARCHIVELOG mode.
    Steps to be carried out at the Destination Database (POCDESTN.)
    1. Create Streams Administrator :
    connect SYS/pocdestn@pocdestn as SYSDBA
    create user STRMADMIN identified by STRMADMIN default tablespace users;
    2. Grant the necessary privileges to the Streams Administrator :
    GRANT CONNECT, RESOURCE, AQ_ADMINISTRATOR_ROLE to STRMADMIN;
    GRANT SELECT ANY DICTIONARY TO STRMADMIN;
    GRANT EXECUTE ON DBMS_AQ TO STRMADMIN;
    GRANT EXECUTE ON DBMS_AQADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_FLASHBACK TO STRMADMIN;
    GRANT EXECUTE ON DBMS_STREAMS_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_CAPTURE_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_APPLY_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_RULE_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_PROPAGATION_ADM TO STRMADMIN;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'ENQUEUE_ANY',
    grantee => 'STRMADMIN',
    admin_option => FALSE);
    END;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'DEQUEUE_ANY',
    grantee => 'STRMADMIN',
    admin_option => FALSE);
    END;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'MANAGE_ANY',
    grantee => 'STRMADMIN',
    admin_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_EVALUATION_CONTEXT_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_RULE_SET_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_RULE_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.ALTER_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.ALTER_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_EVALUATION_CONTEXT,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    3. Create streams queue :
    connect STRMADMIN/STRMADMIN@POCDESTN
    BEGIN
    DBMS_STREAMS_ADM.SET_UP_QUEUE(
    queue_table => 'STREAMS_QUEUE_TABLE',
    queue_name => 'STREAMS_QUEUE',
    queue_user => 'STRMADMIN');
    END;
    4. Add apply rules for the table at the destination database :
    BEGIN
    DBMS_STREAMS_ADM.ADD_SUBSET_RULES(
    TABLE_NAME=>'SCOTT.EMP',
    STREAMS_TYPE=>'APPLY',
    STREAMS_NAME=>'STRMADMIN_APPLY',
    QUEUE_NAME=>'STRMADMIN.STREAMS_QUEUE',
    DML_CONDITION=>'empno =7521',
    INCLUDE_TAGGED_LCR=>FALSE,
    SOURCE_DATABASE=>'POCSRC');
    END;
    5. Specify an 'APPLY USER' at the destination database:
    BEGIN
    DBMS_APPLY_ADM.ALTER_APPLY(
    apply_name => 'STRMADMIN_APPLY',
    apply_user => 'SCOTT');
    END;
    6. BEGIN
    DBMS_APPLY_ADM.SET_PARAMETER(
    apply_name => 'STRMADMIN_APPLY',
    parameter => 'DISABLE_ON_ERROR',
    value => 'N' );
    END;
    7. Start the Apply process :
    BEGIN
    DBMS_APPLY_ADM.START_APPLY(apply_name => 'STRMADMIN_APPLY');
    END;
    Section 3 - Steps to be carried out at the Source Database (POCSRC.)
    1. Move LogMiner tables from SYSTEM tablespace:
    By default, all LogMiner tables are created in the SYSTEM tablespace. It is a good practice to create an alternate tablespace for the LogMiner tables.
    CREATE TABLESPACE LOGMNRTS DATAFILE 'd:\oracle\oradata\POCSRC\logmnrts.dbf' SIZE 25M AUTOEXTEND ON MAXSIZE UNLIMITED;
    BEGIN
    DBMS_LOGMNR_D.SET_TABLESPACE('LOGMNRTS');
    END;
    2. Turn on supplemental logging for DEPT table :
    connect SYS/password as SYSDBA
    ALTER TABLE scott.emp ADD SUPPLEMENTAL LOG GROUP emp_pk
    (empno) ALWAYS;
    3. Create Streams Administrator and Grant the necessary privileges :
    3.1 Create Streams Administrator :
    connect SYS/password as SYSDBA
    create user STRMADMIN identified by STRMADMIN default tablespace users;
    3.2 Grant the necessary privileges to the Streams Administrator :
    GRANT CONNECT, RESOURCE, AQ_ADMINISTRATOR_ROLE to STRMADMIN;
    GRANT SELECT ANY DICTIONARY TO STRMADMIN;
    GRANT EXECUTE ON DBMS_AQ TO STRMADMIN;
    GRANT EXECUTE ON DBMS_AQADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_FLASHBACK TO STRMADMIN;
    GRANT EXECUTE ON DBMS_STREAMS_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_CAPTURE_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_APPLY_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_RULE_ADM TO STRMADMIN;
    GRANT EXECUTE ON DBMS_PROPAGATION_ADM TO STRMADMIN;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'ENQUEUE_ANY',
    grantee => 'STRMADMIN',
    admin_option => FALSE);
    END;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'DEQUEUE_ANY',
    grantee => 'STRMADMIN',
    admin_option => FALSE);
    END;
    BEGIN
    DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => 'MANAGE_ANY',
    grantee => 'STRMADMIN',
    admin_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_EVALUATION_CONTEXT_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_RULE_SET_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_RULE_OBJ,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.ALTER_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE_SET,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.CREATE_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.ALTER_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_RULE,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    BEGIN
    DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(
    privilege => DBMS_RULE_ADM.EXECUTE_ANY_EVALUATION_CONTEXT,
    grantee => 'STRMADMIN',
    grant_option => TRUE);
    END;
    4. Create a database link to the destination database :
    connect STRMADMIN/STRMADMIN@pocsrc
    CREATE DATABASE LINK POCDESTN connect to
    STRMADMIN identified by STRMADMIN using 'POCDESTN';
    Test the database link to be working properly by querying against the destination database.
    Eg : select * from global_name@POCDESTN;
    5. Create streams queue:
    BEGIN
    DBMS_STREAMS_ADM.SET_UP_QUEUE(
    queue_name => 'STREAMS_QUEUE',
    queue_table =>'STREAMS_QUEUE_TABLE',
    queue_user => 'STRMADMIN');
    END;
    6. Add capture rules for the table at the source database:
    BEGIN
    DBMS_STREAMS_ADM.ADD_TABLE_RULES(
    table_name => 'SCOTT.EMP',
    streams_type => 'CAPTURE',
    streams_name => 'STRMADMIN_CAPTURE',
    queue_name => 'STRMADMIN.STREAMS_QUEUE',
    include_dml => true,
    include_ddl => true,
    source_database => 'POCSRC');
    END;
    7. Add propagation rules for the table at the source database.
    This step will also create a propagation job to the destination database.
    BEGIN
    DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES(
    table_name => 'SCOTT.emp’,
    streams_name => 'STRMADMIN_PROPAGATE',
    source_queue_name => 'STRMADMIN.STREAMS_QUEUE',
    destination_queue_name => 'STRMADMIN.STREAMS_QUEUE@POCDESTN',
    include_dml => true,
    include_ddl => true,
    source_database => 'POCSRC');
    END;
    Section 4 - Export, import and instantiation of tables from Source to Destination Database
    1. If the objects are not present in the destination database, perform an export of the objects from the source database and import them into the destination database
    Export from the Source Database:
    Specify the OBJECT_CONSISTENT=Y clause on the export command.
    By doing this, an export is performed that is consistent for each individual object at a particular system change number (SCN).
    exp USERID=SYSTEM/POCSRC@POCSRC TABLES=SCOTT.TEST FILE=DEPT.dmp GRANTS=Y ROWS=Y LOG=exportDEPT.log OBJECT_CONSISTENT=Y INDEXES=Y STATISTICS = NONE
    Import into the Destination Database:
    Specify STREAMS_INSTANTIATION=Y clause in the import command.
    By doing this, the streams metadata is updated with the appropriate information in the destination database corresponding to the SCN that is recorded in the export file.
    imp USERID=SYSTEM/POCDESTN@POCDESTN FULL=Y CONSTRAINTS=Y FILE=DEPT.dmp IGNORE=Y GRANTS=Y ROWS=Y COMMIT=Y LOG=importDEPT.log STREAMS_INSTANTIATION=Y
    2. If the objects are already present in the desination database, check that they are also consistent at data level, otherwise the apply process may fail with error ORA-1403 when apply a DML on a not consistent row. There are 2 ways of instanitating the objects at the destination site.
    1. By means of Metadata-only export/import :
    Export from the Source Database by specifying ROWS=N
    exp USERID=SYSTEM/POCSRC@POCSRC TABLES=SCOTT.DEPT FILE=tables.dmp
    ROWS=N LOG=exportTables.log OBJECT_CONSISTENT=Y
    exp USERID=SYSTEM/POCSRC@POCSRC TABLES=SCOTT.EMP FILE=tables.dmp
    ROWS=N LOG=exportTables.log OBJECT_CONSISTENT=Y
    For Test table -
    exp USERID=SYSTEM/POCSRC@POCSRC TABLES=SCOTT.TEST FILE=tables.dmp
    ROWS=N LOG=exportTables.log OBJECT_CONSISTENT=Y
    Import into the destination database using IGNORE=Y
    imp USERID=SYSTEM/POCDESTN@POCDESTN FULL=Y FILE=tables.dmp IGNORE=Y
    LOG=importTables.log STREAMS_INSTANTIATION=Y
    2. By Manaually instantiating the objects
    Get the Instantiation SCN at the source database:
    connect STRMADMIN/STRMADMIN@POCSRC
    set serveroutput on
    DECLARE
    iscn NUMBER; -- Variable to hold instantiation SCN value
    BEGIN
    iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER();
    DBMS_OUTPUT.PUT_LINE ('Instantiation SCN is: ' || iscn);
    END;
    Instantiate the objects at the destination database with this SCN value.
    The SET_TABLE_INSTANTIATION_SCN procedure controls which LCRs for a table are to be applied by the apply process. If the commit SCN of an LCR from the source database is less than or equal to this instantiation SCN , then the apply process discards the LCR. Else, the apply process applies the LCR.
    connect STRMADMIN/STRMADMIN@POCDESTN
    BEGIN
    DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN(
    source_object_name => 'SCOTT.DEPT',
    source_database_name => 'POCSRC',
    instantiation_scn => &iscn);
    END;
    connect STRMADMIN/STRMADMIN@POCDESTN
    BEGIN
    DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN(
    source_object_name => 'SCOTT.EMP',
    source_database_name => 'POCSRC',
    instantiation_scn => &iscn);
    END;
    Enter value for iscn:
    <Provide the value of SCN that you got from the source database>
    Finally start the Capture Process:
    connect STRMADMIN/STRMADMIN@POCSRC
    BEGIN
    DBMS_CAPTURE_ADM.START_CAPTURE(capture_name => ‘STRMADMIN_CAPTURE');
    END;
    Please mail me [email protected]
    Thanks.
    Raghunath

    A) need to check that the table is effectively correctly instantied on both sites :
    did you checked that the table instantiation is done on both DB for both CAPTURE and Apply ?
    since it is multimaster you should see rows in system.logmnr_gtlo and system.lgomrn_gtcs :
    break on OWNERNAME on table_name on report
    col global_name format a25
    col OWNERNAME format a20
    select OWNERNAME, lvl0name table_name , start_scn,global_name,baseobj#, INTCOLS,PROPERTY
    from system.logmnrc_gtlo o, system.logmnrc_dbname_uid_map m where m.logmnr_uid=o.logmnr_uid order by 1,2;
    on each site you should see at least 2 rows per table with the object_id and init SCN for each site as they exists on each site. You may see also older variation of your objects as these 2 tables are usually never purged.
    B) we need to see what rules are produced from the setup you published and were they apply:
    please post the rules sets and the contents rules :
    SELECT a.RULE_SET_OWNER, a.RULE_SET_NAME, b.rule_owner||'.'|| b.rule_name rnol,b.RULE_SET_rule_COMMENT
    from dba_rule_sets a, dba_rule_set_rules b where
    --rule_set_eval_context_name not like 'AQ$%' and
    a.rule_set_owner = b.rule_set_owner (+)
    and a.rule_set_name = b.rule_set_name (+) order by RULE_SET_OWNER,b.rule_set_name, b.rule_owner,b.rule_name;
    select rule_owner,rule_name,substr(rule_condition,1,200) rc from dba_rules order by rule_owner,rule_name;
    after that we should see the subset rule appearing linked to a rules set

  • Nice explanation of iTunes U authentication

    I was having problems understanding how the above works, and Richard Wolf, who is assisting us in getting our site up and running, e-mailed me the following explanation, he agreed to let me post it.
    I hope it helps others that may be stuck...it's in two parts, here it is:
    iTunes U credentials are in the form of MACE URNs united to a "role". More on roles in a bit ...
    Formally speaking, a URN is a URI and similar to a URL (a URL is also a URI). The main difference between a URN and a URL is that a URN "names" something within the web whereas a "URL" locates it. But the distinction that used to exist between a URL and URN is now a lot fuzzier than it once was. After all, URLs often do "name" things today ... and URNs often do contain the notion of "location" within them. But, for simplicity, think of a URN as a fancy way to "name something" on the web without necessarily locating it anywhere in particular. For example, you could have "color:red" ... or "suit:spades" ... these "names" wouldn't exist at any website ... they'd just be a common way of naming "things" within the web.
    Technically speaking, a URN does not have to start with "urn" just as a URL does not have to start "url" ... a URN could start out like this: "isbn:" or "color:" just as a URL can start out "http:" or "ftp:". However, it's common to start out URNs with "urn:" ... that way, there's no confusion. After the "urn:" part, URNs follow the same rules for construction as any URI would. There's a whole RFC devoted to URI and URN formation.
    MACE is the "middleware for education" initiative and is part of the Internet2 project. MACE has formally claimed a subset of the URN namespace. Again, there is an formal RFC that explains/refines MACE's URN subset rules. Apple, in turn, has claimed a subset of the MACE URN namespace ... specifically for use with iTunes U.
    So you basically have this:
    All possible URNs ---contains---> all MACE URNs ---contains---> all iTunes U URNs
    This "containment" is shown in the form of every iTunes U credential. They all start out this way:
    urn:mace:itunesu.com
    In order to distinguish things you name at Connecticut College from staff I name at UIC, Apple adds a site subset to each URN:
    urn:mace:itunesu.com:sites:conncoll.edu
    urn:mace:itunesu.com:sites:uic.edu
    Basically speaking, the powers that be outside Apple own this part of all iTunes U URNs:
    urn:mace:itunesu.com
    And Apple owns this part:
    sites:conncoll.edu
    sites:uic.edu
    We own everything that goes after.
    This "ownership" prevents any of us from naming things in such a way that we create any namespace conflicts. Anything after our site name is stuff that we ourselves own ... we can name things however we want (so long as we don't introduce any local namespace conflicts). What you do with your part of the URN namespace is only limited by your imagination.
    So you could create URNs that look like this:
    urn:mace:itunesu.com:sites:conncoll.edu:liberal-arts
    urn:mace:itunesu.com:sites:conncoll.edu:liberal-arts:english
    urn:mace:itunesu.com:sites:conncoll.edu:liberal-arts:english:101
    urn:mace:itunesu.com:sites:conncoll.edu:liberal-arts:english:101:section-2
    urn:mace:itunesu.com:sites:conncoll.edu:liberal-arts:english:101:section-2:seat- 24
    "In theory" you do not need the "urn:mace:itunesu.com:sites:conncoll.edu" part of the URN ... but if you omit it, you run the risk of a namespace conflict with some other site.
    Also, as I'm sure you've noticed by now, the parts of the URN are separated by colons.
    Okay, now onto roles ...
    In iTunes U, a "credential" is the sum of a "role" and a "context". The context is given by the URN and the "role" is what a user of iTunes U assumes within that context. So you could have:
    Instructor@urn:mace:itunesu.com:sites:conncoll.edu
    -- an "instructor" within "Connecticut College"
    Student@urn:mace:itunesu.com:sites:conncoll.edu:liberal-arts:english:101
    -- a "student" within "English 101 at Connecticut College"
    Dean@urn:mace:itunesu.com:sites:conncoll.edu:liberal-arts
    -- the "dean" of "Liberal Arts at Connecticut College"
    Again, "roles' are anything you can imagine. Apple does predefine some roles though ... there is the "Administrator" role, the "All" role, the "Authenticated" role, and the "Unauthenticated" role. Other than those roles, you can have whatever other roles you like. Roles are what makes sense to you and how you want Connecticut College's iTunes U access to work.
    A "permission" in iTunes U is the sume of a credential plus an access level. Access levels are only defined by Apple. The three most commonly used access levels are "NO ACCESS", "DOWNLOAD", and "EDIT". When you give an access level to a credential, you are saying that someone holding that credential has that access (usually within the context described within the credential). For example, if you give Instructor@urn:mace:itunesu.com:sites:conncoll.edu "EDIT" access within a specific course, then any person holding the that credential will be able to edit the course.
    So, in summary, we've got this:
    An iTunes U Permission = Credential + Access Level
    Credential = Role + Context
    A "Context" in iTunes U is given in the form of a MACE URN
    A "MACE URN" is basically a name you want to assign some entity (a class, college, etc) at your school.

    Ok, here is Richard's Part Two:
    When Apple deals with users of iTunes U, they have, effectively, no idea who the user making a particular request actually "is". All user interactions with iTunes U, even administrator accesses, are just "sessions" to Apple ... they're just connections ... there is no specific "user" involved. So how does Apple know how to restrict access for the user who initiates one session from another user who initiates a different session?
    Well, every iTunes U session carries with it a set of credentials. A credential is like a high-school hall pass ... it doesn't say who the person bearing it actually "is" ... but it does say what "role" the person bearing it "has" ("AV tech" or "student aide" or "sick person") and in which context the bearer's hall pass is valid ("the projection room in the auditorium" or "the librarian's office" or "the nurse's office"). A high school student might carry multiple passes at the very same time ... each would be valid within a specific context ... which pass is used depends upon the context. So the "library" pass would be used when the student wants to assume the role of "student aide" in "the librarian's office".
    This system of high school hall passes ... well ... it utterly depends upon a trusted party to issue the passes in the first place. For example, only a trusted teacher who actually "knows" a student can issue him/her the "student aide" pass the visit the "library". The librarian might not know a particular student ... but if the librarian knows that a trusted teacher issued that student a properly-formatted hall pass, he/she should let the student in with all the privileges that such a pass allows the student to have within the context of the library.
    This is EXACTLY how iTunes U crednetialling works. You are like a trusted teacher that "knows" your students and that issues them iTunes U credentials. In fact, that is precisely the role o the iTunes U portal website ... it takes users and maps them onto a set of credentials. Apple then uses those credentials to create an iTunes U session for the user, granting him/her any rights associated with those credentials. The credentials that you use are entirely up to you ... Apple simply honors them. Since every site is different -- has different rules/roles -- the credentialling one site might setup could be utterly different from another's. That is why the Admin Guide is so very vague about the iTunes U portal website ... it describes "in general" what you need to do, but leaves the specifics up to you. Apple simply cannot know the way in which you might like to map users to credentials.
    When chatted about the kind of setup you wanted for Connecticut College, you said that you wanted to create four basic roles ... "student", "faculty", "manager", and "sysop". Those seemed like reasonable roles, so they were mapped this way:
    student --maps-to--> Student@urn:mace:itunesu.com:sites:conncoll.edu
    faculty --maps-to--> Faculty@urn:mace:itunesu.com:sites:conncoll.edu
    manager --maps-to--> Manager@urn:mace:itunesu.com:sites:conncoll.edu
    sysop --maps-to--> Administrator@urn:mace:itunesu.com:sites:conncoll.edu
    The only guy I really altered here is "sysop" ... since Apple predefines the "Administrator" role, I assumed you probably wanted to map "sysop" to it.
    But notice that the context in each of the defined credentials for Connecticut College (the MACE URN part) is no more specific than your entire site ... there is no way I could make it more specific because I do know what students will be in what classes. Based upon the groups you defined on your portal, I can determine if a user is "in" a group ... and once I know that a user is a part of a group, I can assign a corresponding credential. Since an iTunes U session is not limited to just one credential, the portal checks whether a user is in any of the four groups and adds a corresponding credential if he/she is. For example, I put myself in each of your four groups ... so if I login to your iTunes U site, I'll have a session with all four credentials ... I'll assume all four roles. Take me out of a group, and the next time I login to your portal, I won't have the corresponding credential.

  • Best practice excel addin retrievals of attributes of large flat sparse dim

    Is anyone aware of a way to quickly lookup attributes of members of large flat sparse dimensions? One would imagine that since there exists a one-to-one relationship between a member and its attribute in the outline, Essbase shouldn't have to parse through the data to populate attributes when drilling down an attribute dimension. However, in practice, Essbase takes forever to return member attributes (depending on the base dimension and other factors, of course). Something similar to the subset rule within member selection would be ideal, but I don't seem to find anything. Any ideas? Thanks in advance!

    Using Attribute Associations to generate a list of base dimension members should not have an overly adverse affect upon the retrieval time.
    Introducing an Attribute dimension to a spreadsheet retrieval will slow things down because it introduces dynamic calculation to the query. If there are other dynamically calculated items in the outline, the intersecting dynamic calculations will slow retrieval times even further.

  • DBMS_STREAMS_ADM.ADD_SUBSET_RULES ORA-00936 ORA-06512

    I need help, why i got this error???
    SQL> BEGIN
    2 DBMS_STREAMS_ADM.ADD_SUBSET_RULES(
    3 table_name => 'piramide.lancamento',
    4 dml_condition => 'where empresa=100 and filial=101 or empresa=102 and filial=102 or empresa=102 and filial=103',
    5 streams_type => 'apply',
    streams_name => 'lancamento_apply',
    6 7 queue_name => 'STRMADMIN.LANCAMENTO_Q',
    8 include_tagged_lcr => false);
    9 END;
    10 /
    BEGIN
    ERROR at line 1:
    ORA-00936: missing expression
    ORA-06512: at "SYS.DBMS_STREAMS_ADM", line 1032
    ORA-06512: at "SYS.DBMS_STREAMS_ADM", line 1181
    ORA-06512: at "SYS.DBMS_STREAMS_ADM", line 1073
    ORA-06512: at line 2
    SQL>
    Tks,
    Elber

    HI, tks for you help, but i executed this procedure using CAPTURE and it works fine, so, i dont think that the problem is that.
    ##################THIS WORK AT SOURCE#################
    BEGIN
    DBMS_STREAMS_ADM.ADD_SUBSET_RULES(
    table_name => '"PIRAMIDE"."LANCAMENTO"',
    dml_condition => 'where empresa=100 and filial=101 or empresa=102 and filial=102 or empresa=102 and filial=103',
    streams_type => 'capture',
    streams_name => '"LANCAMENTO_CAPTURE"',
    queue_name => '"STRMADMIN"."LANCAMENTO_CAPTURE_Q"',
    include_tagged_lcr => false);
    END;
    I find one BUG on metalink that i think this is my problem. BUG n 6331369 ORA-936 WHEN CREATING STREAMS SUBSET RULE
    If you can, please help me.
    Tks,
    Elber Portugal

  • Create multiple capture processes for same table depending on column value

    Hi,
    is it possible to create multiple realtime downstream capture processes to capture changes for the same table depending on column value?
    Prakash

    i found it - by using subset rules
    prakash

  • How to stream one table twice (with different names) in another schema ?

    hello guys,
    i have to replicate one table (TAB_1) from one schema (SCH_1) on source database (DB_1) twice to schema (SCH_2) on target database (DB_2) with two different names (TAB_1 and TAB_1_SHORT). TAB_1_SHORT on target db should be a subset (eg. WHERE STATUS = 1) of TAB_1 !
    how to do ? can anyone help me ?
    i tried to realize that this way:
    1) creating 1 capture process with 1 table rule on source db (without any subset rules to capture all changes) for table TAB_1
    2) creating a propagation process without any rules
    3) creating 1 apply process with a table rule for table TAB_1 without any subset_rule but with schema transformation from SCH_1 to SCH_2 (DBMS_STREAMS_ADM.RENAME_SCHEMA) => this works correct !
    4) creating a subset_rule (WHERE STATUS = 1), a schema transformation from SCH_1 to SCH_2 (DBMS_STREAMS_ADM.RENAME_SCHEMA) and a tablename transformation from TAB_1 to TAB_1_SHORT (DBMS_STREAMS_ADM.RENAME_SCHEMA) for table TAB_1_SHORT => doesn`t work, no errors posted in dba_apply_error !
    in another try, i tried to transform the table- and the schemaname in the capture process, with the effect, that my first table TAB_1 wouldn`t be streamed again.
    i`m not sure, what is wrong. i think it must be possible to stream a table to two different targettables in the same schema on another db, isn`t it ?
    hopefully greetings
    Flo

    Hello
    Adding a normal table rule and also a subset rule would not work since the rule would be evaluated only once in the positive rule set. If the normal rule is evaluated first then the subset rule and rest of the rules would not be evaluated at all hence this would not work.
    This can be done using either of the following methods:
    Method 1:
         1. Use the declarative transformation on the capture/apply and rename the schema from SCH_1 to SCH_2.
         2. Now, on the apply site, set a DML Handler for SCH_2.TAB_1
         3. In DML Handler perform the following:
              a. get the column value for STATUS
              b. check if the value for STATUS=1, if yes then modify the object name to TAB_1_SHORT and execute the LCR.
              c. else do not modify the object name (leave it as it is, TAB_1) and execute the LCR.
    Method 2:
         1. Add a DML Handler for SCH_1.TAB_1
         2. In the DML Handler perform:
              a. use set_object_owner method of LCR$_ROW_RECORD to rename the owner to SCH_2
              b. get the column value for STATUS
              c. check if the value for STATUS=1, if yes then modify the object name to TAB_1_SHORT and execute the LCR.
              d. else do not modify the object name (leave it as it is, TAB_1) and execute the LCR.
    Please let me know if you need sample code.          
    Thanks,
    Rijesh

Maybe you are looking for