How to increment update B table from A table on a daily basis

hi ,
i have two table in two database,
Table A:
username
status
created
table B:
username
status
created
object_count
I want to insert everything from A to B. for example, on day 1, table A has 100 rows, then 100 rows will be inserted into B. on day 2, table A has 110 rows, then only the 10 new rows will be inserted.
i want to create a PL sql procedure, and create a shell script in cron job to call this procedure to update table B every day.
thanks for the help.
thanks.

thanks for the reply. i didn't state clear about my task. here is the detail of what exactly I am trying to do.
table USERACC_FOR_DOM_REP is acting a central repository table which will have all user information from all databases. I have 40+ database. of course , everyday new user will be added.
SQL> desc audadm.USERACC_FOR_DOM_REP
Name Null? Type
USERNAME NOT NULL VARCHAR2(30)
ACCOUNT_STATUS NOT NULL VARCHAR2(32)
LOCK_DATE DATE
EXPIRY_DATE DATE
CREATED NOT NULL DATE
PROFILE NOT NULL VARCHAR2(30)
TARGET_DB VARCHAR2(9)
TARGET_NODE VARCHAR2(64)
INSERT_DATE DATE
OBJECT_COUNT NUMBER
i can create shell script, loop through each database, and use below SQL to update the USERACC_FOR_DOM_REP table on the daily basis. but the problem is that duplicated entry will be created every day. I only need to insert any new users which added in dba_users table.
i guess i need a PL SQL procedure to check if a username already exist in table USERACC_FOR_DOM_REP, and that user come from the same database.
insert into USERACC_FOR_DOM_REP
select username, account_status, lock_date, expiry_date, a.created, profile,
name as target_db, host_name as target_node, sysdate as insert_date,
(select count(*) from dba_objects where OWNER=a.username) as object_count
from dba_users a, v$database, v$instance;

Similar Messages

  • My  ipod touch is 3rd gen how can i update my ios from 4.2.1 to 5.1.1 when i shift   restore and load the ipod3_5.1.1.ios its always say your firmware is not compatible

    my  ipod touch is 3rd gen how can i update my ios from 4.2.1 to 5.1.1 when i shift + restore and load the ipod3_5.1.1.ios its always say your firmware is not compatible

    I suspect you have a 2G iPod. Those can only go to iOS 4.2.1.
    Identifying iPod models
    iPod touch (3rd generation)
    iPod touch (3rd generation) features a 3.5-inch (diagonal) widescreen multi-touch display and 32 GB or 64 GB flash drive. You can browse the web with Safari and watch YouTube videos with Wi-Fi. You can also search, preview, and buy songs from the iTunes Wi-Fi Music Store on iPod touch.
    The iPod touch (3rd generation) can be distinguished from iPod touch (2nd generation) by looking at the back of the device. In the text below the engraving, look for the model number. iPod touch (2nd generation) is model A1288, and iPod touch (3rd generation) is model A1318.

  • How does one update Std Table EDIPHONE(there is no Table Maintainance)?

    How does one update Std Table EDIPHONE(there is no Table Maintainance)?
    Regards,
    Shashank.

    You should not update the standard database table directly.
    through the partner profile tcode: WE20 you can update the table EDIPHONE.
    u can choose required partner profile in the WE20, select the tab 'Telephony', and update the data, the table EDIPHONE will get updated.
    if you want to maintain this edi phone data for a particular message type/s then select inbound/output parameters and double clikc on it, go to last tab in teh screen 'Telephony',  and updated the required data.

  • How does SAP updates MKPF Table Through TCODE MB0A

    Hello There,
       how does SAP updates MKPF Table Through TCODE MB0A ( POST GOODS RECEIPT )? I tried to debug the same by posting GR, but could not figure out.
    Awaiting Reply
    Santosh

    Hi ,
    These are the table that are updated through the MB0A ,,
    DGESV DMAEX DMAKT DMAPE
    DMARM DMEAN DMKAL DMLAN
    DPROW DQMAT DUNGV MARA
    MARC MARD MBEW MFHM
    MLGN MLGT MPGD MPOP MVKE,
    MCHA, MCHB, MCHD.
    Regards,
    Bharani

  • New computer/old ipod - how do I update my libray from my ipod?

    new computer/old ipod - how do I update my libray from my ipod? the music wasn't transfered from cd's, shared music files...no purchased from the ipod store.

    The ipod is not a storage/backup device. The sync is one way - computer to ipod.  The only exception is itunes purchases:  File>Devices>Transfer Purchases
    It has always been very basic to always maintain a backup copy of your computer.  Use your backup copy to put everything on your new computer.

  • Table Partition on daily basis in oracle 10g

    I Want to create partition based on sysdate on daily basis.
    There will be 8 partitions. Every day data's will be get loaded into this table and everyday 8th day old data ill be get truncated.
    CREATE TABLE CUST_WALLET_BALANCE_7DAYS
    ( ID  VARCHAR2(250),
       A_DATE  VARCHAR2(11),
       LAST_PROCESS_DATE DATE,
      DD_OF_PROCESS_DATE  NUMBER(2),
      CONSTRAINT CUST_WALLET_BALANCE_7DAYS_PK PRIMARY KEY (ID,A_DATE))
      PARTITION BY RANGE (DD_OF_PROCESS_DATE)
      ( PARTITION DAY1 VALUES LESS THAN (TO_NUBER(TO_CHAR(TRUNC(SYSDATE)),'DD')),
        PARTITION DAY2 VALUES LESS THAN (TO_NUBER(TO_CHAR(TRUNC(SYSDATE-1)),'DD')),
        PARTITION DAY3 VALUES LESS THAN (TO_NUBER(TO_CHAR(TRUNC(SYSDATE-2)),'DD')),
        PARTITION DAY4 VALUES LESS THAN (TO_NUBER(TO_CHAR(TRUNC(SYSDATE-3)),'DD')),
        PARTITION DAY5 VALUES LESS THAN (TO_NUBER(TO_CHAR(TRUNC(SYSDATE-4)),'DD')),
        PARTITION DAY6 VALUES LESS THAN (TO_NUBER(TO_CHAR(TRUNC(SYSDATE-5)),'DD')),
        PARTITION DAY7 VALUES LESS THAN (TO_NUBER(TO_CHAR(TRUNC(SYSDATE-6)),'DD')),
        PARTITION DAY8 VALUES LESS THAN (TO_NUBER(TO_CHAR(TRUNC(SYSDATE-7)),'DD'))
    THIS WONT WORKS OUT. SO PLEASE SUGGEST ME WITH BETTER SOLUTION.

    Original thread here: Table Partition on daily basis in oracle 10g
    Please do not start duplicate questions for the same topic.
    Locking this thread

  • How can I Update the table so that....

    I have a table XYZ with values like
    x y
    1 null
    1 null
    1 null
    1 null
    2 null
    2 null
    3 null
    4 null
    4 null
    4 null
    I want to update my table so that the values for column y appears the serial no for the given x. The output would be like
    x y
    1 1
    1 2
    1 3
    1 4
    2 1
    2 2
    3 3
    4 1
    4 2
    4 3
    How can I write the Update statement?

    SQL> CREATE TABLE t (x INTEGER, y INTEGER)
    Table created.
    SQL> INSERT INTO t
         VALUES (1, NULL)
    1 row created.
    SQL> INSERT INTO t
         VALUES (1, NULL)
    1 row created.
    SQL> INSERT INTO t
         VALUES (1, NULL)
    1 row created.
    SQL> INSERT INTO t
         VALUES (1, NULL)
    1 row created.
    SQL> INSERT INTO t
         VALUES (2, NULL)
    1 row created.
    SQL> INSERT INTO t
         VALUES (2, NULL)
    1 row created.
    SQL> INSERT INTO t
         VALUES (3, NULL)
    1 row created.
    SQL> INSERT INTO t
         VALUES (4, NULL)
    1 row created.
    SQL> INSERT INTO t
         VALUES (4, NULL)
    1 row created.
    SQL> INSERT INTO t
         VALUES (4, NULL)
    1 row created.
    SQL> UPDATE t t1
       SET y =
              (SELECT l
                 FROM (SELECT ROWID rid,
                              ROW_NUMBER () OVER (PARTITION BY x ORDER BY NULL) l
                         FROM t t2)
                WHERE t1.ROWID = rid)
    10 rows updated.
    SQL> SELECT *
      FROM t
             X          Y
             1          1
             1          2
             1          3
             1          4
             2          1
             2          2
             3          1
             4          1
             4          2
             4          3
    10 rows selected.

  • How do i update my itunes from the website

    how do i update itunes from the itunes website

    iTunes on your iPad is only updated when an iOS update is installed.
    If you are getting a msg to update iTunes, it's the version of iTunes on your computer that needs to be updated.
     Cheers, Tom

  • How does one update Subtemple value from Yes to No?

    Greetings! In the instructions of a published problem statement (Note ID: 808571.11) there is a line that says:
    "c) Check if the subtemplate is set to NO. Update it to NO if it is set to Yes."
    How does one update the Subtemplate value from Yes to No? In edit configuration, I do not see a Subtemplate value column.
    Many thanks in advance fr your suggestions.
    Tom

    With all due respect ... I do not see how one can change the Subtemplate value from Yes to No. When I query the offending Template, the Subtemplate column is not displayed in bold, indicating to me that it can not be updated. Clicking on Edit Configuration, doe not provide an ability to change the value either.
    As best I can determine, one needs to 1) query up the template
    2) download the rtf file(s)
    3) end date the template
    4) create a new template and then set the Subtemplate value to No.
    And the same steps appear to be required in order to add or update a template Description.
    Which raises the question, Why can this not be done by editing the configuration?

  • How can I update the table with a single query for...

    I have a table with columns C1 and C2.
    C1 C2
    A1 null
    A1 null
    A1 null
    A1 null
    A2 null
    A2 null
    A2 null
    A3 null
    A4 null
    A4 null
    I want to update my table with a single query so that I would have data like
    C1 C2
    A1 1
    A1 2
    A1 3
    A1 4
    A2 1
    A2 2
    A2 3
    A3 1
    A4 1
    A4 2
    The updated column C2 has the values like serial no grouped on the column C1.

    SQL> create table mytable
      2  ( c1 varchar2(2)
      3  , c2 number(2)
      4  )
      5  /
    Tabel is aangemaakt.
    SQL> insert into mytable (c1)
      2  select 'A1' from dual union all
      3  select 'A1' from dual union all
      4  select 'A1' from dual union all
      5  select 'A1' from dual union all
      6  select 'A2' from dual union all
      7  select 'A2' from dual union all
      8  select 'A2' from dual union all
      9  select 'A3' from dual union all
    10  select 'A4' from dual union all
    11  select 'A4' from dual
    12  /
    10 rijen zijn aangemaakt.
    SQL> select * from mytable
      2  /
    C1                                     C2
    A1
    A1
    A1
    A1
    A2
    A2
    A2
    A3
    A4
    A4
    10 rijen zijn geselecteerd.
    SQL> merge into mytable t1
      2  using (select c1
      3              , row_number() over (partition by c1 order by null) rn
      4              , rowid rid
      5           from mytable
      6        ) t2
      7     on (t1.rowid = t2.rid)
      8   when matched then
      9        update set c2 = rn
    10   when not matched then
    11        insert values (null,null)
    12  /
    10 rijen zijn samengevoegd.
    SQL> select * from mytable
      2  /
    C1                                     C2
    A1                                      1
    A1                                      2
    A1                                      3
    A1                                      4
    A2                                      1
    A2                                      2
    A2                                      3
    A3                                      1
    A4                                      1
    A4                                      2
    10 rijen zijn geselecteerd.Regards,
    Rob.

  • HT1338 how do i update my mac from version 10.5.8

    I have a mac book - version 10.5.8 - and i. trying to install the latest version of itunes 10.7......but my versin 10.5.8 isnt compatable for the latest itunes.
    I have the iphone 4s so am trying to sync my mac with my phone but need the latest version of itunes to do so.
    can anyone tell me how i can update my version to a newer one.  i have tred to download snow leopard but this says that i need to have version 10.6 in order to do it.
    how can i get this version???
    please help
    thanks

    First check if your Mac can run Snow Leopard:
    Requirements for OS X 10.6 'Snow Leopard'
    http://support.apple.com/kb/SP575
    Whilst Apple have withdrawn Snow Leopard from download, you can still get it from Apple by calling 1-800-MY-APPLE (if you are in the USA) and they will supply the SL DVD for $30.  You can also purchase the code to use to download Lion from the same number.
    If you are outside the US call your national Apple Helpline:
    http://support.apple.com/kb/HE57
    If you're in the UK, use this number: 0871 508 4400
    When you have installed it, run Software Update to download and install the latest updates for Snow Leopard.

  • HT4623 how do you update my iphone from itunes?

    how do i update my iphone using itunes?

    Did the Link you posted from not help you...?
    What seems to be the issue...?

  • How do I update my iPhoto from 8.1.2 to the most recent iphoto

    I currently have mavericks OS and iPhoto from 09 its version 8.1.2.  How do i update it to the most current iPhoto.????

    How do i update it to the most current iPhoto.????
    Make sure, you have a current backup of your Mac, i.e. your iPhoto Library. On no account risk the upgrade without a current backup. After upgrading to a newer iPhoto version, iPhoto will need to upgrade the iPhoto Library as well. Due to a current bug, the upgrade may go wrong and leave your iPhoto library damaged, if the system should crash during the upgrade, because of running out of storage or similar.
    As Larry pointed out, the current iPhoto version 9.6 requires Yosemite, and the App Store will not offer the last compatible version for Mavericks. To upgrade to 9.6 you need to upgrade to Yosemite as well.
    You should finish any book projects before upgrading, because the upgrade will change the themes of the books. So your books may change a bit after upgrading.

  • How do we update the script from Adobe Indesign CS2 to CS3?

    hi,
    What is the main difference between the adobe indsign cs2 and indesign cs3?
    How do we update the script acccording to the version?
    Regards,
    Subha

    Which script? Did you look at this topic:
    http://adobeforums.com/webx/.3bc3cc98/60?14@@
    Dave

  • Reg: How to automate updation of tables between two oracle DB Instances

    Hi All,
    I have a requirement to auto update the tables between two oracle database instances. What are the possible solutions to handle this kind of situations.
    Please help me out in identifying the correct solution.
    Thanks in advance :)

    The possible solutions are outlined in the distributed database documentation
    They are
    a) trigger (6.0 and higher)
    b) advanced replication. Creates triggers on every table. Requires every table to have a primary key (8.0 and higher)
    c) Streams (Uses logminer, has no impact on table. Requires every table to have a primary key, or supplemental logging will be used. (9.0 and higher)
    d) Change Data Capture: superset of Streams (9i and higher).
    If you don't require realtime updates you don't need c or d. b is difficult to manage. Using a) the source db can potentially have to wait for the target db to complete it's transaction.
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for