Need Help to Transfer Specific Data with dml_condition
i have two databases on two different server with name db1 and db2. i want to transfer specific data with dml condition. bellow is my code
for Server have db1.
--------------Sys----------------------
create user strmadmin identified by strmadmin;
grant connect, resource, dba to strmadmin;
begin dbms_streams_auth.grant_admin_privilege
(grantee => 'strmadmin',
grant_privileges => true);
end;
grant select_catalog_role, select any dictionary to strmadmin;
alter system set global_names=true;
alter system set streams_pool_size = 100 m;
----------------------end--------------------
-----------------------StrmAdmin--------------------------
create database link db2
connect to strmadmin
identified by strmadmin
using 'DB2';
EXEC DBMS_STREAMS_ADM.SET_UP_QUEUE();
EXEC DBMS_CAPTURE_ADM.PREPARE_TABLE_INSTANTIATION(table_name => scott.emp');
-- Configure capture process at the source database
begin dbms_streams_adm.add_table_rules
( table_name => 'scott.emp',
streams_type => 'capture',
streams_name => 'capture_stream',
queue_name=> 'strmadmin.streams_queue',
include_dml => true,
include_ddl => true,
inclusion_rule => true);
end;
-- -- Configure Sub Set Rules capture process at the source database
begin dbms_streams_adm.add_subset_rules
( table_name => 'scott.emp',
dml_condition=>'deptno=50',
streams_type => 'capture',
streams_name => 'capture_stream',
queue_name=> 'strmadmin.streams_queue',
include_tagged_lcr => true);
end;
-- Configure the propagation process at Sources Database
begin dbms_streams_adm.add_table_propagation_rules
( table_name => 'scott.emp',
streams_name => 'DB1_TO_DB2',
source_queue_name => 'strmadmin.streams_queue',
destination_queue_name => 'strmadmin.streams_queue@DB2',
include_dml => true,
include_ddl => true,
source_database => 'DB1',
inclusion_rule => true);
end;
-- Configure the Subset propagation Rule process at Sources Database
begin SYS.dbms_streams_adm.add_subset_propagation_rules
( table_name => 'scott.emp',
dml_condition=>'deptno=50',
streams_name => 'DB1_TO_DB2',
source_queue_name => 'strmadmin.streams_queue',
destination_queue_name => 'strmadmin.streams_queue@DB2',
include_tagged_lcr => true);
end;
-- Set the instantiation system change number (SCN)
declare
source_scn number;
begin
source_scn := dbms_flashback.get_system_change_number();
dbms_apply_adm.set_table_instantiation_scn@DB2
( source_object_name => 'scott.emp',
source_database_name => 'DB1',
instantiation_scn => source_scn);
end;
-- Start the capture processes
begin dbms_capture_adm.start_capture
( capture_name => 'capture_stream');
end;
---------------------------End----------------------------------------------------------
for server 2 have db2.
--------------------------Sys---------------------------------------------------------------
CREATE USER strmadmin IDENTIFIED BY strmadmin;
GRANT CONNECT, RESOURCE, DBA TO strmadmin;
BEGIN
DBMS_STREAMS_AUTH.grant_admin_privilege (grantee => 'strmadmin',
grant_privileges => TRUE);
END;
GRANT SELECT_CATALOG_ROLE, SELECT ANY DICTIONARY TO strmadmin;
ALTER SYSTEM SET global_names=TRUE;
ALTER SYSTEM SET streams_pool_size = 100 M;
-----------------------------------------------------------End-----------------------------
---------------------------------Stream user--------------------------------------------------------------
CREATE DATABASE LINK db1
CONNECT TO strmadmin
IDENTIFIED BY strmadmin
USING 'DB1';
EXEC DBMS_STREAMS_ADM.SET_UP_QUEUE();
EXEC DBMS_CAPTURE_ADM.PREPARE_TABLE_INSTANTIATION(table_name => scott.emp');
-- add table Level rule on target Database.
BEGIN
DBMS_STREAMS_ADM.add_table_rules (
table_name => 'scott.emp',
streams_type => 'apply',
streams_name => 'apply_stream',
queue_name => 'strmadmin.streams_queue',
include_dml => TRUE,
include_ddl => TRUE,
source_database => 'DB1',
inclusion_rule => TRUE);
END;
-- add table Level Sub Set rule on target Database.
BEGIN
DBMS_STREAMS_ADM.add_subset_rules (
table_name => 'scott.emp',
dml_condition => 'deptno=50',
streams_type => 'apply',
streams_name => 'apply_stream',
queue_name => 'strmadmin.streams_queue',
include_tagged_lcr => TRUE);
END;
-- Start the apply processes
BEGIN
DBMS_APPLY_ADM.set_parameter (apply_name => 'apply_stream',
parameter => 'disable_on_error',
VALUE => 'n');
END;
BEGIN
DBMS_APPLY_ADM.start_apply (apply_name => 'apply_stream');
END;
---------------------------------End---------------------------------------------------------------------------------
plz help me.
below is the Result.
RULE_NAME RULE_TYPE RULE_SET_TYPE RULE_SET_NAME STREAMS_TYPE STREAMS_NAME
RULE$_7 POSITIVE RULESET$_8 DEQUEUE SCHEDULER_PICKUP
RULE$_11 POSITIVE RULESET$_8 DEQUEUE SCHEDULER_PICKUP
RULE$_3 POSITIVE RULESET$_4 DEQUEUE SCHEDULER_COORDINATOR
EMP122 DDL POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP121 DML POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP124 DML POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP125 DML POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP126 DML POSITIVE RULESET$_123 PROPAGATION DB1_TO_DB2
EMP115 DML POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
EMP116 DDL POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
EMP118 DML POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
EMP119 DML POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
EMP120 DML POSITIVE RULESET$_117 CAPTURE CAPTURE_STREAM
Edited by: Naeem Ullah Khattak on Apr 19, 2013 2:57 AM
Similar Messages
-
Need help to pivot the data with hierarchy
Dear Team,
I have hierarchical data in the table as shown below
SQL> Create Table t As
2 (
3 Select 97250528 col1, 'TSD' col2, 97250528 col3, 'WAV' col4 From dual Union All
4 Select 75020160 , 'ASD' , 97250528 , 'TSD' From dual Union All
5 Select 69150832 , 'PA' , 75020160 , 'ASD' From dual Union All
6 Select 49150538 , 'DB' , 69150832 , 'PA' From dual Union All
7 Select 49150538 , 'WAV' , 49150538 , 'DB' From dual Union All
8 ------------
9 Select 97251520 col1, 'TSD' col2, 97251520 col3, 'WAV' col4 From dual Union All
10 Select 75020689 , 'ASD' , 97251520 , 'TSD' From dual Union All
11 Select 69151039 , 'PA' , 75020689 , 'ASD' From dual Union All
12 Select 49150672 , 'DB' , 69151039 , 'PA' From dual Union All
13 Select 49150672 , 'WAV' , 49150672 , 'DB' From dual
14 );
Table created
SQL> select *
2 from t;
COL1 COL2 COL3 COL4
97250528 TSD 97250528 WAV
75020160 ASD 97250528 TSD
69150832 PA 75020160 ASD
49150538 DB 69150832 PA
49150538 WAV 49150538 DB
97251520 TSD 97251520 WAV
75020689 ASD 97251520 TSD
69151039 PA 75020689 ASD
49150672 DB 69151039 PA
49150672 WAV 49150672 DB
10 rows selected
I am using connect by prior clause to get the data in correct order.
below is the SQL i am using..
SQL> Select Level lvl,
2 col3,
3 col4
4 From t
5 Start With col3 In ('97250528','97251520')
6 And col4 In ('WAV')
7 connect by Nocycle Prior col1 = col3
8 And Prior col2 = col4;
LVL COL3 COL4
1 97250528 WAV
2 97250528 TSD
3 75020160 ASD
4 69150832 PA
5 49150538 DB
1 97251520 WAV
2 97251520 TSD
3 75020689 ASD
4 69151039 PA
5 49150672 DB
10 rows selected
The data i am getting is correct one. However i want output in the following format..
WAV TSD ASD PA DB
1 97250528 97250528 75020160 69150832 49150538
2 97251520 97251520 75020689 69151039 49150672
When i use max + case statement i am getting in-correct results as there is no group by key
Kindly give me some hints or tips to pivot the data or should i go to PL/SQL to pivot the data.
Regards
nicHi Dbb,
Connect_by_root did the trick i guess
Select max(Case When col4 = 'WAV' Then col3 End) wav,
max(Case When col4 = 'TSD' Then col3 End) tsd,
max(Case When col4 = 'ASD' Then col3 End) ASD
From
Select CONNECT_BY_ROOT col1 col,
col3,
col4
From t
Start With col3 In ('97250528','97251520')
And col4 In ('WAV')
connect by Nocycle Prior col1 = col3
And Prior col2 = col4
Group By col;
WAV TSD ASD
97250528 97250528 75020160
97251520 97251520 75020689
Let me execute this over bulk-sets of data...
thanks for this pointer and hint.. -
Need help in loading master data.
Hi everyone,
I am just a beginner in BI 7.0 . I know Bw 3.5 . I need help in loading master data(flat file) in a step by step manner.
Before posting this forum i searched and checked out other related forums too, as i am a beginner i am unable to follow them. Lots of the forums gave the help.sap.com link which i used and got a little help but not fully, so please don't send that link. I need a step by step guideline from somebody, which says everything from the beginning till monitoring say like
e.g.. 1) create a InfoObject by right clicking on InfoObject catalog.
something like that.
please help me get a clear and detail step by step procedure to load a master data (Flat File should be good) which may help me get a start will other things without much help.
Please help me learn.
Thanks.
Ranjani.HI,
Thanks for your reply. This is what i did.
1) Created a Info Area.
2) Created Info object catalog & activated
3) created info object with nothing except some 4 attributes.
4) Created Application compound in Infosource tab.
5) Right clicked on Application compound and chose create Infosource in which chose a option with 3.x and chose the flexible update and gave the info object name.
6) In info provider tab , in the Info Area right clicked and chose the Insert char as data target option.
Now, i am stuck. I have no idea what to do next.
I know i have to create a transformation - There are two tabs in Transformation box, what should i do there.
Please help me from point 6 to cont., to load the data.
Thanks. -
Need help in formatting the Date - Date does not
Need help in formatting the Date - Date does not formats and give Not a valid month error in the below scenario.
select oc.ST_PGM_MGR, r.ag_dnum, get_major_work_type(r.perf_eval_rtng_id) "v_work_code", r.ag_dnum_supp "supp", r.intfinal, to_char(r.formdate,'MM/DD/YYYY') "formdate", to_char(r.servfrom,'MM/DD/YYYY') "srv_from", to_char(r.servto,'MM/DD/YYYY') "srv_to", descript, add_months(to_char
--- Bellow line of Code on trying to format it to mm/dd/yyyy gives the error
(r.formdate, 'DD-MON-YYYY'),12) "formdate2"
from table REdited by: Lucy Discover on Jul 7, 2011 11:34 AM
Edited by: Lucy Discover on Jul 7, 2011 1:05 PMYour syntax is wrong - look at the post above where this syntax is given:
to_char (add_months(r.formdate,12), 'MM/DD/YYYY') "formdate2"Look at the formula from a logical perspective - "inside out" to read what is happening -
take formdate, add 12 months
add_months(r.formdate, 12)then apply the to_char format mask - basic syntax
to_char(date, 'MM/DD/YYYY')Compare to your syntax:
to_char(add_months(r.formdate, 'MM/DD/YYYY'),12) "formdate2"You will see your format string inside the call to add_months, and your 12 inside the call to to_char.
Good luck! -
Need help in logging JTDS data packets
Hi All,
I m having web application which uses SQL Server database.
I have to find out some problems in database connection for that there is need to log the jtds data packets.
I have tried to use class net.sourceforge.jtds.jdbc.TdsCore but in constructor of TdsCore class there are two parameters needed one is ConnectionJDBC2 and another is SQLDiagnostic.
I have tried a lot but it did not allow me to import class *SQLDiagnostic*.
I need help in logging JTDS data packets. If there are any other ways or any body having any idea about logging JTDS data packets/SQLDiagnostic.
Please reply it is urgent...!!
Thanks in advance......!!if you want to use log4j then,
in your project create a file called log4j.properties and add this
# Set root logger level to INFO and its only appender to ConsoleOut.
log4j.rootLogger=INFO,ConsoleOut
# ConsoleOut is set to be a ConsoleAppender.
log4j.appender.ConsoleOut=org.apache.log4j.ConsoleAppender
# ConsoleOut uses PatternLayout.
log4j.appender.ConsoleOut.layout=org.apache.log4j.PatternLayout
log4j.appender.ConsoleOut.layout.ConversionPattern=%-5p: [%d] %c{1} - %m%n
log4j.logger.org.apache.jsp=DEBUG
#Addon for
com.sun.faces.level=FINEGo to your class and add this line
private static final Logger logger = Logger.getLogger("classname");and then you can use
logger.info();
logger.error();
methods -
need help for Transfer PO.
i need help for to transfer PO from one season to onther season. pleas ehelp me how to proceed and how 2 approach the process.
if any code is there please provide mefollow the link
it may help you
MM SCENARIO
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=abapcodetotransferpurchaseorder&adv=true&sdn_author_name=&sdn_allusernamesofthread=&sdn_category=&sdn_forum=&sdn_updated_on_comparator=GE&sdn_updated_on=&sortby=cm_rnd_rankvalue
reward if helpful
Edited by: sharad narayan on Apr 8, 2008 3:16 PM -
I need help to transfer CS4 from a dead G5 to a new Macbook Pro. Can't find my program discs but purchased CS4 in 2008 and have record of it.
Sounds like you got it installed and activated. Don't forget your updates.
Adobe - Photoshop : For Macintosh
Gene -
Need help in fetching requested data from JSP
Hello,
I really need help in fecthing requested data from JSP to servlet. Can anyone assist me as soon
as possible because I must finish my program by today.....( 20/02/2002).
Thanks in advance.It is very likely that somebody can help you, if you say what your problem is. In fact somebody might already have helped you. What is your problem?
-
I need help to transfer my movies from I tunes to an external hard drive please
I need help to transfer my movies from I tunes to an external hard drive please
Teach a man to fish, feed them for life.
https://discussions.apple.com/message/16276201#16276201 -
Need help for storing time along with the date
Hi,
I have one procedure as follows, In last_update_column of the table job_data having date and time.But after execution of this procedure only date is inserting into the job_master.
If I queires the table job_master with to_char(Last_Update_Date, 'DD-MM-YYYY HH24:MI:SS') , then it is showing time as 12:00:00.
I tried to insert date with to_char,to_date format but it is not working.
Please provide me the solution.
Thanks in advance.
create or replace
PROCEDURE SP_LOAD_JOB
IS
CURSOR CUR_DATA IS
SELECT PARENT_ITEM,
` CHILD_ITEM_ID,
LAST_UPDATE_DATE
FROM job_data,
BEGIN
For Cursor_job In CUR_DATA
Loop
Exit When CUR_DATA%Notfound;
Insert Into job_master(parent_Code,
child_code,
last_update_date)
values(
Cursor_job.PARENT_ITEM,
Cursor_job.CHILD_ITEM_ID, ,
Cursor_job.Assembly_Item_Id,
Cursor_Bom.LAST_UPDATE_DATE)
commit;
end loop;
END;Hi,
I don't believe you
First to input time to job_master from job_data table first you have to store time in job_data.
execute
select LAST_UPDATE_DATE from job_data
and show result.
Second remark : your procedure will not compile success Because
Insert Into job_master(parent_Code,
child_code,
last_update_date) ---3columns
values(
Cursor_job.PARENT_ITEM,
Cursor_job.CHILD_ITEM_ID, ,
Cursor_job.Assembly_Item_Id,
Cursor_Bom.LAST_UPDATE_DATE) ----4columns
Third remark : why to insert into table from other you wrote procedure???! you need only type insert stmt like this
Insert Into job_master(parent_Code,
child_code,
last_update_date)
select .... from job_data
Ramin Hashimzade -
I need help highlighting cells on my Numbers '09 spreadsheet. I want the cell text/fill to change color when the date is 180 days or less from the current date. I already have a cell with the current date in it. I also know how to change the fill/text colors. All the cells have been formatted to show date only. I am having trouble with the formula. I can get to the Conditional Formatting menu and select "With Dates" but after that I am lost. Can anyone help?
Thank you for any assistance.
BSet a Conditional Format rule as shown in the illustration below. The rule has been applied to all dates in column B of the table.
Regards,
Barry -
Need help in Creating DB manually with OFA
Hi,
I want to create database in 10g manually and for this purpose
I need help.
since we can use OFA for storing Control files, and redolog file
and datafile by describing them in Create database command but
how to store any instance related file like spfile, pfile or network
related file.
once the oracle 10g database software is installed then if we want
to create database then how can we separate the database file and
all other instance files from software binaries because I've noted
that creating database with DBCA create all instance files along with
binary files of the software although DBCA give you option of creating
database related file in some other location/directory.
kindly help me in this I want to achieve above task in compliance with
OFA
Thanks and Regards,
D.AbbasiAbbasi wrote:
Hi,
I want to create database in 10g manually and for this purpose
I need help.
since we can use OFA for storing Control files, and redolog file
and datafile by describing them in Create database command but
how to store any instance related file like spfile, pfile or network
related file.
once the oracle 10g database software is installed then if we want
to create database then how can we separate the database file and
all other instance files from software binaries because I've noted
that creating database with DBCA create all instance files along with
binary files of the software although DBCA give you option of creating
database related file in some other location/directory.
kindly help me in this I want to achieve above task in compliance with
OFA
Thanks and Regards,
D.AbbasiTHe OFA spec (as best I recall) states that one of the levels of directory for all of your data files will be the db name. So if you name your database 'orcl', every file system in which you keep any files related to 'orcl' will be in a directory name 'orcl'.
As for what happend when you created your db. Oracle will default to putting things in the Oracle home structure because that's the only thing he can guarantee will be there. But you had the option (indeed, the obligation) to override these defaults.
BTW, when using dbca, if you chose any of the pre-canned database types, the database will be created by doing a restore from a pre-canned backup. If you chose 'custom' database, the database will be created by way of a CREATE DATABASE script. It would be instructive time well spent for you to go through dbca and select 'custom database', pay attention to all of the options as you work through, then at then end, deselect "create database" and select "generate scripts". Do the same for one of the pre-defined database types. Then study the scripts generated by each method.
Edited by: EdStevens on Aug 16, 2009 8:46 PM -
Script to delete files created on a specific date with sepecific name
Hi,
Is it possible to help me with a powershell script that delete files under a folder and subfolders that have the following attributes
1. have the name (default.*) and (index.*)
2. created on a specific date say 1-9-2014
3. created between specific time say between 10:00 - 16:00
Thanks in advance!break out the components of the script.
IE does this match
Get-ChildItem -Recurse c:\temp\*.*or Get-ChildItem -Recurse c:\temp\*.* | Where-Object {$_.CreationTime -gt (get-date "01-09-2014 10:00AM") -and $_.
CreationTime -lt (get-date "01-09-2014 14:00PM")}Get-ChildItem -Recurse c:\temp\*.* | Where-Object {$_.CreationTime -gt (get-date "01-09-2014 10:00AM") -and $_.
CreationTime -lt (get-date "01-09-2014 14:00PM")} | Where-Object {$_.name -match "default"}Might not be working as it might not be matching.Once you get it matching the remove-item will work.
Cheers,
Martin
Blog:
http://sustaslog.wordpress.com
LinkedIn:
Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. -
Need to know a specific date under history
I am looking for a specific date that I was on a website. It is listed under "show all history" for the month of January, so I know I visited the site this month, but I need to confirm the actual date. How do I do that, as you don't list the date, as Safari does.
You can make extra columns visible in the Bookmarks Manager (Library) via the Views menu (second button on toolbar) or via the right-click context menu of the header in the right pane.
See also http://kb.mozillazine.org/Viewing_the_browsing_history_-_Firefox -
Need help. importing pictures to timeline with various length.
Need help cant find old toturial
I am trying to make a template for a picture movie where i have everything ready so i just need to add 250 pictures and then it will automaticly shift the pictures to the beat of the music. I once saw a toturial how to do this but cant find it. it was something with manually setting markers at the music beat and then just add all the pictures. but i must have missed something pls help..
BoIts called automate to sequence with unnumbered markers.
http://tv.adobe.com/watch/learn-premiere-pro-cs5/gs04-making-a-rough-cut-in-adobe-premiere -pro/
http://help.adobe.com/en_US/premierepro/cs/using/WS1c9bc5c2e465a58a91cf0b1038518aef7-7d1ba .html
Maybe you are looking for
-
how to get 4g on my iPhone 4s
-
Relinking MobileMe Galleries to Aperture
I recently rebuilt my Aperture DB and noticed that once back all my MobileMe galleries weren't showing up on the left sidebar. I went into the MobileMe preferences in Aperture and they are all listed there. Does anyone have a solution for re-referenc
-
Trying to update iTunes on a laptop with Vista.
A friend is trying to update iTunes on a laptop with Vista. She gets this: Error writing to file: C:\Config.Msi.\78efb0.rbf. Verify that you have access to that directory. I thought maybe it was an issue with Administrator privileges, but she's the o
-
Not able to get content in textarea properly using getText() method.
I am doing one mail sending application. I have one Jtext area in my swing. The content copied in the text area will be sent as a mail body to the mail id mentioned in the another jtext box. The content copied in the JTextArea is collected usign jt.g
-
I have two square wave forms from an encoder wheel. I can not seem to generate or calculate the phase of the waveforms. I have tried to extract the data but it is not accurate? I can not use a true false statement with the extracted data either. I h