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.
Similar Messages
-
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.
-
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 AMSorry, 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.
RaghunathWhat 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). -
Rule usage in Document template creation
Dear all,
In our scenerio,I am using document template(TS) creation step in WS.
In this task I have created different word document templates.In my requirement based on the user, any one of the document template should come for creation.(not all the document templates).How can I do the config for that?Does it work,suppose the task is assigned with a Rule(The template is in creation mode)?Hi Srini,
Use of background step indicates that it is additional step prior to your Document template. Do the processing what you were supposed to do in rule , get the required results from this step , store them in workfow container elements and Use them in your Document for template step.
Regds,
Akshay -
Business Rule:Usage of @ISMBR with User Prompts/ Variables+Loop Function
Hi,
currently facing a business rule user prompt - if-selection issue - not sure, if it's simply a bug or other ways how to solve it:
depending on runtimeprompt [RTP_VERSIONS], either the 1st or 2nd part of the rule should get executed using a loop command.
The special thing is, that you can choose several versions simultaniously in runtimeprompt : as soon, as Data Input is part of the selection, the 1st part of the if-section should apply and the 2nd loop executed (and other way round)
this works if I select 1 Member in the user prompt, but does not work, if I select several members.
according to the manual, @ismbr function is "true", if already 1 member is matching !
I experiemented in addition to @ismbr with @list and @range and also with additional == "Data Input"
any idea, which other command should apply ? any experience, if using user-variables with several member selections in if-sections is a problem ?
of course I could simply create separate businessrules or restrict runtimeprompt to 1 value/ version - but inconvenient.
we are on system 9.3
Businessrule:
VAR breakvar1=1; /*Controls Deletion of Budgetdata on Version Data Input */
VAR breakvar2=1; /*Controls Deletion of ALL Data on selected Versions */
FIX( "BegBalance",
[RTP_SCENARIO],
*[RTP_VERSIONS]*,
"Local",
+..... other dimensions+ )
"HSP_InputValue"
IF( *@ISMBR("Data Input")* AND not @ISMBR(&Scenario_1_curr))
breakvar1=1;
breakvar2=0;
ELSEIF( not @ISMBR(&Scenario_1_curr))
breakvar1=0;
breakvar2=1;
ENDIF;
ENDFIX;
SET UPDATECALC OFF;
SET MSG SUMMARY;
Loop(1,breakvar1) /* delete all accounts = all data */
FIX( [RTP_SCENARIO],
[RTP_VERSIONS],
@IDESCENDANTS([RTP_PROJECT])
CLEARBLOCK ALL;
ENDFIX;
ENDLOOP
Loop(1,breakvar2) /* delete only budget accounts, not setupdata */
FIX( [RTP_SCENARIO],
[RTP_VERSIONS],
@IDESCENDANTS([RTP_PROJECT]),
*@IDESCENDANTS("Costs")*
CLEARBLOCK ALL;
ENDFIX;
ENDLOOP
Edited by: Rodian Abel on May 4, 2010 10:38 PM
Edited by: Rodian Abel on May 4, 2010 10:43 PMI think he is saying he does want to allow the user to select more than one member.
You mention you are using @ismbr and @list. I would say that should be the one that would work.
For example if you wanted Version1 and Version2 and you hardcoded it. It would look like this
If (@ismbr(@list(Version1,Version2))
So using your Variable I expect you wrote it like this
if (@ismbr(@list(variable)) and that it didn't work.
@range is useful as it is cross dimensional and that isn't the case here. So if @list doesn't work than this is a bug/problem for your specific situation and will have to approach it differently. -
Hi experts, i just want to have a quick check on who have implemented Org Rules in any of their implementation.
In a big Organization where staff are in charge of cross department or region, we need to eliminate false positive. One way is to determine whether there are many of such staff who contribute to such false positive.
a. If there are only a few, does it make more sense to mitigate these users or create Org rules to eliminate such cases?
b. Also , i'm not very comfortable to know that when i go to Informer and run Risk analysis with org rules, i need to run the report under 'Org. Level' and not 'User level'. It seems like an extra burden on top of running the normal User or Role level.Hi,
Generally, if there are only a few users that show up and they are definitely false positives, it's better to create mitigating controls to remove them from the report. However, if there are a large number of users, then you have to examine your rule definitions to determine whether customization of the rules is required.
Thanks,
Santosh -
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 -
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
ramchowHi 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 -
View Usage Reports on search site
Hi,
In Sharepoint 2013, I have a Staff Directory based on a Entreprise Search. I found Popularity and Search Reports but I would like to know the requests with : who do to request and what kind of request is done.
Thank you in advanceYou can get
Search Clicks
The Search Clicks analysis uses information about which items users click in search results to boost or demote items in the search index. The analysis calculates a new ranking of items compared to the base relevance.
http://technet.microsoft.com/en-us/library/jj219554%28v=office.15%29.aspx
Number of queries
Top queries
Abandoned queries
No result queries
Query rule usage
http://technet.microsoft.com/en-us/library/jj219554%28v=office.15%29.aspx -
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 -
How to use AME_RULE_API.CREATE_AME_RULE
Dear all,
I want to use the API to load the AME rule, rule usage, condition to rule and action to rule. However, when I try to create the rule, it prompts the error:
ORA-20001: AME_400732_INV_APPLICATION_ID:
ORA-06512: at "APPS.AME_RULE_API", line 871
ORA-06512: at line 18
Below is my code. Is there any thing wrong with the code? Also how to assign which transaction type to be created when calling the API?
declare
l_rule_key number;
l_rul_start_date date:=sysdate;
l_rul_end_date date;
l_rule_id number;
l_rul_object_version_number number;
l_rlu_object_version_number number;
l_rlu_start_date date;
l_rlu_end_date date;
l_cnu_object_version_number number;
l_cnu_start_date date;
l_cnu_end_date date;
l_acu_object_version_number number;
l_acu_start_date date;
l_acu_end_date date;
be
ame_rule_api.create_ame_rule
(p_validate => false
,p_language_code => hr_api.userenv_lang
,p_rule_key => ame_rule_pkg.getNextRuleKey
,p_description => 'TEST'
,p_rule_type => '1'
,p_item_class_id =>1
,p_condition_id => NULL
,p_action_id => NULL
,p_application_id => NULL
,p_priority => NULL
,p_approver_category => NULL
,p_rul_start_date => l_rul_start_date
,p_rul_end_date => l_rul_end_date
,p_rule_id => l_rule_id
,p_rul_object_version_number => l_rul_object_version_number
,p_rlu_object_version_number => l_rlu_object_version_number
,p_rlu_start_date => l_rlu_start_date
,p_rlu_end_date => l_rlu_end_date
,p_cnu_object_version_number=> l_cnu_object_version_number
,p_cnu_start_date => l_cnu_start_date
,p_cnu_end_date => l_cnu_end_date
,p_acu_object_version_number => l_acu_object_version_number
,p_acu_start_date => l_acu_start_date
,p_acu_end_date => l_acu_end_date
end;Raised a SR and the problem is solved now.
declare
l_rul_start_date date:=sysdate;
l_rul_end_date date;
l_rule_id number;
l_rul_object_version_number number;
l_rlu_object_version_number number;
l_rlu_start_date date;
l_rlu_end_date date;
l_cnu_object_version_number number;
l_cnu_start_date date;
l_cnu_end_date date;
l_acu_object_version_number number;
l_acu_start_date date;
l_acu_end_date date;
lv_application_id ame_calling_apps.application_id%TYPE;
BEGIN
--Get the Application Id based on the AME Transaction Type for which you are going to create the AME Rule.
SELECT application_id
INTO lv_application_id
FROM ame_calling_apps
WHERE SYSDATE BETWEEN start_date AND NVL(end_date - (1/86400), SYSDATE)
AND application_name ='Purchase Requisition Approval';
-- Call the API to create the Rules.
-- Pass the correct
-- A) Rule Type (Example: 'Combination: List Creation' = 0 )
-- B) Action Id (You can find this in ame_actions table).
-- C) Application Id ( You can get it from ame_calling_apps table)
-- Suggestions:
-- Do not pass the NULL parameters. If you want to use the values you can use it.
-- Description is Unique so if you calling in a loop make sure you use the unique values.
ame_rule_api.create_ame_rule
(p_validate => false
,p_language_code => hr_api.userenv_lang
,p_rule_key => ame_rule_pkg.getNextRuleKey
,p_description => 'TEST2'||to_char(SYSDATE,'YYYYMMDDHH24MISS')
,p_rule_type => '1'
,p_item_class_id => 1
,p_condition_id => 12000
,p_action_id => 16292
,p_application_id => lv_application_id
,p_priority => NULL
,p_approver_category => 'A'
,p_rul_start_date => l_rul_start_date
,p_rul_end_date => l_rul_end_date
,p_rule_id => l_rule_id
,p_rul_object_version_number => l_rul_object_version_number
,p_rlu_object_version_number => l_rlu_object_version_number
,p_rlu_start_date => l_rlu_start_date
,p_rlu_end_date => l_rlu_end_date
,p_cnu_object_version_number=> l_cnu_object_version_number
,p_cnu_start_date => l_cnu_start_date
,p_cnu_end_date =>l_cnu_end_date
,p_acu_object_version_number => l_acu_object_version_number
,p_acu_start_date => l_acu_start_date
,p_acu_end_date => l_acu_end_date
dbms_output.put_line ('Success');
EXCEPTION
when others then
dbms_output.put_line('Error:'||SQLERRM);
end; -
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. -
Hi,
I wrote a batch program to transfer GL data from text file to SAP. It uses FB01.
Everything works fine except for some GL accounts that do not need cost center input. When such account inserted my program has an error
saying that there is no field 'COBL-KOSTL' in the form.
To fix the problem my program has to access substitution rule and either insert or not incert line: PERFORM bdc_field USING 'COBL-KOSTL' itab-kostl. "Cost center
Question: how to access substitution rules from ABAP program? Or may be I have to access basic set generated by substitution? Or may be any other way?
Thank you,
VitalyHi,
These tables might help you.
GB03 Validation/Substitution User
GB03T Validation/Substitution Application Area T
GB31 Validation/Substitution Callup Points
GB31T Validation/Substitution Callup Point Text
GB907 Rule: Usage of Rules in Substitutions
GB92 Substitutions
GB921 Substitution Conditions
GB921T Substitution: Text Table for Substitution
GB922 Substitution Constants
GB925 Usage of Substitutions
GB92T Texts for Substitutions
I have not checked the details of which table to use exactly but I am sure it would help you in some sense.
Regards
Nishant -
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.
RaghunathA) 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
Maybe you are looking for
-
Power Interruption During Library Import
While importing one library into another I experienced a electrical power interruption. The importing process hadn't completed and those projects being imported are either not there or only partially present. Unfortunately I did not have a vault for
-
Not being able to use my recovery disks...
Hello! I need to format my laptop (HP G42). So I decided to use my Recovery DVD's for it (the ones that I generated the first time that I used it, right when I bought it). Before that I backed up all my working files in a disc (DVD disc). Everything
-
please consider this code sample service = Executors.newScheduledThreadPool(1); final ScheduledFuture<?> timeHandle = service.scheduleWithFixedDelay(new DownloadService(), 0, 10, TimeUnit.SECONDS); service.sche
-
When I try to play back a video (any video I've tried), it plays for a few frames (less than a second) and then returns to start. It does this in both the source viewer and the in the program viewer. I can single-step through the video and change the
-
Why can't Apple develop a stylus that functional for precision drawing.
APple is spending millions to fix a broke maps project, how about using some of those funds to develop a stylus that can be useful for precision drawing? Now that would be great asset to the user community.