Best way to do batch update of an online database

We have a periodic process which will do batch update of the online database. I would like to have some advice on what is the best way to avoid this operation affecting cache.
We have multiple environments using shared cache, so the total cache size is pretty big. Each environment on average refresh once a day. Some are pretty big in the DB size but not necessary have high traffic, and thus doesn't have high count in the cache. I am wondering if I do a refresh (basically lots of puts) to the db, will the affect the cache? if so, is there a way to not affect the cache?
If there is a way to disable caching of the LN at environment level, that should also work for us as we a 1st tier object cache.
Also, I would like to cleanup the log at the end of the batch update. Will the cleanup process block the reader threads which are set at read_uncommitted?
Thanks!
Edited by: JoshWo on Mar 9, 2010 5:20 PM

Josh,
It is possible to use a base API Cursor (with the CacheMode configured) to write entities in a destination EntityStore after reading them from a source EntityStore. The idea is to read the entities using a DPL cursor from the source store, and then use the binding of the destination store to convert the entities to DatabaseEntry objects, and finally store the DatabaseEntry objects using a base API cursor from the destination store.
import com.sleepycat.je.CacheMode;
import com.sleepycat.je.Cursor;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.OperationStatus;
import com.sleepycat.persist.PrimaryIndex;
import com.sleepycat.persist.EntityCursor;
    PrimaryIndex srcIndex = ... // index of source store
    PrimaryIndex destIndex = ... // index of destination store
    EntityCursor<MyEntity> srcCursor = srcIndex.entities();
    Cursor destCursor = destIndex.getDatabase().openCursor(null, null);
    destCursor.setCacheMode(CacheMode.UNCHANGED);
    EntityBinding<MyEntity> destBinding = destIndex.getEntityBinding();
    DatabaseEntry key = new DatabaseEntry();
    DatabaseEntry data = new DatabaseEntry();
    for (MyEntity e : srcCursor) {
        destBinding.objectToKey(e, key);
        destBinding.objectToData(e, data);
        OperationStatus status = destCursor.put(key, data);
        assert status == OperationStatus.SUCCESS;
    destCursor.close();
    srcCursor.close();Please let me know if you have questions.
Obviously, this would be a lot easier if there were an EntityCursor.put method, so that the CacheMode could be set on the EntityCursor. I'll file an enhancement request to add such a method.
--mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • HTML Article Management: Is there an easier way to perform batch updates?

    I have a folio with many html articles.
    After a batch of edits I need to update the folio via FolioBuilding panel.
    I've tried 2 ways both however both are time consuming;
    1) via Updates: updating is time consuming because i have to select each artcle, go to menu select update, wait till complete, repeat for each article.
    2) via reimport: select each article, go to menu & select delete, wait till complete, repeat for each article then re-import all articles
    Is there an easier way to accomplish batch updates?
    Thanks,
    John

    Just use "import" & the sw insts' will load and assign accordingly, automatically.
    But oddly, there are times when importing a SMF w/imbedded prgm changes, that LP8 loads a completely wrong instrument to a specific track(s).
    One reason that I've kept only one of my trustworthy external midi modules (Roland XV5080), specifically for just importing SMFs'. When the XV is in GM mode, any standard midi files I import to LP8... always load pgm changes correctly 100% of the time.

  • What is the best way to get an update/status on my MBP repair?

    Apple store in Nashville had to send one of my machines to their repair depot in Tennessee due to the lid failing to open/close/latch properly. Any suggestions on the best way to get an update on the status of the repair (besides parking on hold with the store)? I was told it would take 4-5 business days and we are past that by two days now...
    TIA --
    Trent

    http://www.apple.com/support/repairstatus doesn't show QuickDrops (reference numbers start with the letter 'Q') - the store had to use this because Apple's back office systems were "down' when I dropped the machine off. Thanks for the input....

  • Can you suggest a best way to store and read arabic from oracle database?

    Hi ,
    can you suggest a best way to store and read arabic from oracle database?
    My oracle database is Oracle Database 10g Release 10.1.0.5.0 - 64bit Production on unix HP-UX ia64.
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CHARACTERSET WE8ISO8859P1
    I have presently stored the data in nvarchar2 field. But i am not able to display it correctly.

    Using the national characterset should work but there are other factors that you have to consider when working with NCHAR/NVARCHAR2/NCLOB.
    If possible, changing the characterset is usually the best solution if it's a possiblity for you.
    For more info:
    Dear Gurus: Can u pls explain the difference between VARCHAR2 & NVARCHAR2??

  • Best way to insert in a table througth a database link

    Hi all,
    i have two databases (oracle 10g, windows 2003 server)
    Database A and Database B
    i need to insert data in a table (Table_A) that lives in database A
    The data i have to insert is in a table that lives a database B
    I have a database link from database B to database A
    so, connected to database B, i'm trying the following :
    insert into table_a@database_link_to_A
    select col1
    from table_b
    where col1 is not null
    This query is taking forever, and i have to cancel it.
    I'd like to hear from your experience. Wich is the best way to accomplish this task ?
    Best Regards
    Rui Madaleno
    NOTE: I forgot to mencion that Table_A does not have any trigger or indexes.
    Edited by: ruival on Jan 20, 2010 3:51 PM

    Try this:
    insert /*+ append */ into table_a@database_link_to_A select col1 from table_b where col1 is not nullOr
    Sqlplus COPY another option.
    [http://www.praetoriate.com/oracle_tips_dm_sqlplus_copy.htm]
    HTH
    -Anantha

  • [10g] Best way to populate and update multiple workday calendars?

    I would like to create multiple workday calendars, and be able to update them as needed. Each workday calendar would be for at most 5 years (right now), although it is possible that at some point in the future, I might want to extend that.
    A workday calendar can apply to a single resource or a group of resources. Each individual is part of a resource group. What I'm thinking is that if an individual resource has an associated workday calendar, that calendar gets used, but if it doesn't, it uses the calendar of it's resource group, and if the group doesn't have one, the default calendar gets used. Theoretically, each resource could have its own workday calendar, and there would be probably 500 resources at most. In practice, many resources will have the same or similar workday calendars.
    Each calendar will be based on one of 3 standards: all calendars days are work days, all days but weekends are workdays, or all days except weekends and holidays are workdays. (Weeks start on Sunday, and Saturday and Sunday are weekends.) The standard calendar would then be modified to create each unique calendar as needed. For example, if a resource was an employee, their calendar might be the standard of not working weekends or holidays, but could also include a one week vacation in February and a one week vacation July. I'm not sure what the best approach is for defining a calendar in the first place and then being able to update it as an employee decides on vacations (or whatever other situation might affect workdays).
    Furthermore, I'd really like to be able to incorporate work hours, which could vary by day, though would likely be fairly standard. I don't know if this information belongs in the workday table, or as something separate to be combined with the workday table.
    My ultimate purpose in doing all of this is to try to schedule a very large project amongst many resources.
    Here is some sample data illustrating where I'm at so far:
    CREATE TABLE     work_groups
    (     group_id     VARCHAR2(5)     NOT NULL
    ,     group_name     VARCHAR2(25)     
    ,     group_desc     VARCHAR2(200)
    ,     CONSTRAINT     work_groups_pk     PRIMARY KEY (group_id)
    INSERT INTO     work_groups
    VALUES     ('A','Group A','Group A description');
    INSERT INTO     work_groups
    VALUES     ('B','Group B','Group B description');
    INSERT INTO     work_groups
    VALUES     ('C','Group C','Group C description');
    INSERT INTO     work_groups
    VALUES     ('D','Group D','Group D description');
    CREATE TABLE     resources
    (     resource_id     VARCHAR2(20)     NOT NULL
    ,     type          VARCHAR2(1)
    ,     description     VARCHAR2(200)
    ,     group_id     VARCHAR2(5)     
    ,     CONSTRAINT     resources_pk     PRIMARY KEY (resource_id)
    ,     CONSTRAINT     group_id_fk     FOREIGN KEY (group_id)
                             REFERENCES  work_groups (group_id)
    INSERT INTO     resources
    VALUES     ('A001','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A002','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A003','M','text here','A');
    INSERT INTO     resources
    VALUES     ('B001','M','text here','B');
    INSERT INTO     resources
    VALUES     ('B002','M','text here','B');
    INSERT INTO     resources
    VALUES     ('C001','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C002','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C003','M','text here','C');
    INSERT INTO     resources
    VALUES     ('D001','M','text here','D');
    INSERT INTO     resources
    VALUES     ('12345','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12346','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12347','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12348','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12349','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12350','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12351','L','text here','D');I'm not sure if I should have a separate table to define a relationship between a resource or resource group and a calendar id (each resource or group would only be able to be assigned 1 unique calendar id, though multiple resources/groups could share the same calendar id), or if I should add an extra column to each of the above tables to assign the calendar id.
    CREATE TABLE     calendars
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_title     VARCHAR2(25)
    ,     cal_desc     VARCHAR2(200)
    ,     CONSTRAINT     calendars_pk     PRIMARY KEY (cal_id)
    INSERT INTO     calendars
    VALUES     (1,'Default','This is the default calendar to use for workdays');
    INSERT INTO     calendars
    VALUES     (2,'All Days','This calendar treats all days as workdays');
    INSERT INTO     calendars
    VALUES     (3,'Weekends Off','This calendar gives weekends off, but no holidays');
    INSERT INTO     calendars
    VALUES     (4,'Holidays Off','This calendar gives weekends and holidays off');
    CREATE TABLE     workdays
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_date     DATE          NOT NULL
    ,     cal_year     NUMBER(4)
    ,     work_day     NUMBER(3)
    ,     work_date     DATE
    ,     work_week     NUMBER(2)
    ,     work_year     NUMBER(4)
    ,     work_days     NUMBER(5)
    ,     cal_days     NUMBER(6)
    ,     CONSTRAINT     workdays_pk     PRIMARY KEY (cal_id, cal_date)
    ,     CONSTRAINT     cal_id_fk     FOREIGN KEY (cal_id)
                             REFERENCES  calendars (cal_id)
    );cal_id     - refers to calendars table
    cal_date - the actual calendar date
    cal_year - the actual calendar year for the given calendar date
    work_day - workday in that work year (resets each year, starting at 1, is 0 if that calendar date is not a work day)
    work_date - if a work day, the calendar date, if not, the calendar date of the last work day (or in the first week of the calendar, the next work day)
    work_week - work week of the work date (numbered starting at 1 , reset each year at the first Sunday of the year, before first Sunday will have last week of previous year, and the first year of the calendar will have all days prior to Sunday included in the first week, so the first week of a calendar could be more than 7 days)
    work_year - year of the work date
    work_days - shop day of the work date (except in first week of the calendar, before first shop day is 0), starts at 1 (at the beginning of the calendar), cummulative (does not reset each year)
    cal_days - calendar day of the work date, starts at 1 (at the beginning of the calendar), cummulative (does not reset each year)
    Assuming the calendar starts on 1/1/2010 (these values are approximately correct--I just made my best guess to provide sample data):
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,1);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,2);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,3);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/04/2010','mm/dd/yyyy'),2010,1,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,1,4);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/05/2010','mm/dd/yyyy'),2010,2,TO_DATE('01/05/2010','mm/dd/yyyy'),1,2010,2,5);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/23/2010','mm/dd/yyyy'),2010,250,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,357);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/24/2010','mm/dd/yyyy'),2010,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,358);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,366);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),1,2011,250,367);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2011','mm/dd/yyyy'),2011,1,TO_DATE('01/03/2010','mm/dd/yyyy'),1,2011,251,368);I've tried googling workday calendars and similar things, but I can't seem to find anything that fits my situation. If anyone could even point me in the right direction, I'd appreciate it.
    I'm working in 10g (XE).
    Edited by: user11033437 on Jul 19, 2011 3:05 PM
    Also, I don't know if it would make more sense to just somehow store the days each resource/group doesn't work, and generate a workday calendar on the fly as needed, rather than trying to store possibly thousands of dates in the database??

    Hi,
    Interesting problem!
    I'm not sure exactly what you want, however. Are you looking for a way to answer questions such as "For resource A001, what are the first 6 work days on or after January 4, 2010?" or "How many work days does resource A001 have between January 4 and January 12, 2010?" Post a few examples of the questions you might ask, and the results you would want, given the sample data you posted.
    user11033437 wrote:
    I would like to create multiple workday calendars, and be able to update them as needed. Each workday calendar would be for at most 5 years (right now), although it is possible that at some point in the future, I might want to extend that.
    A workday calendar can apply to a single resource or a group of resources. Each individual is part of a resource group. Is a "resouce group" the same as a "work group"?
    if a resource moves from one resource group to another, do you need to keep track of the historical information? For example, if resource A001 does not havfe its own calendar, and is part of work_group A on Juanuary 1, 2010, but then moves to work_group B on July 1, 2010, will you need to answer questions like "How many work days did A001 have in 2010", where you have to remember that the work_group A calendar apllied during the first half of the year, but the work_group B calendar was in use for the second half?
    What I'm thinking is that if an individual resource has an associated workday calendar, that calendar gets used, but if it doesn't, it uses the calendar of it's resource group, and if the group doesn't have one, the default calendar gets used. Theoretically, each resource could have its own workday calendar, and there would be probably 500 resources at most. In practice, many resources will have the same or similar workday calendars.
    Each calendar will be based on one of 3 standards: all calendars days are work days, all days but weekends are workdays, or all days except weekends and holidays are workdays. (Weeks start on Sunday, and Saturday and Sunday are weekends.) The standard calendar would then be modified to create each unique calendar as needed. For example, if a resource was an employee, their calendar might be the standard of not working weekends or holidays, but could also include a one week vacation in February and a one week vacation July. I'm not sure what the best approach is for defining a calendar in the first place and then being able to update it as an employee decides on vacations (or whatever other situation might affect workdays).It seems like the simplest thing would be to record only the exceptions to the base calendar. That is, given that the employee normally abides by the "no weekends or holidays" schedule, just enter 5 rows for that particular employee to mark the 5 work days he'll miss in February. If the emplyoee is going to work Saturdays in June (in addition to his regular schedule), then enter one row for each Saturday in June.
    >
    Furthermore, I'd really like to be able to incorporate work hours, which could vary by day, though would likely be fairly standard. I don't know if this information belongs in the workday table, or as something separate to be combined with the workday table. That depends on exactly what you want. Post a couple opf examples of questions you would want to answer, and the actual answers, given the sample data you post.
    My ultimate purpose in doing all of this is to try to schedule a very large project amongst many resources.
    Here is some sample data illustrating where I'm at so far:
    CREATE TABLE     work_groups
    (     group_id     VARCHAR2(5)     NOT NULL
    ,     group_name     VARCHAR2(25)     
    ,     group_desc     VARCHAR2(200)
    ,     CONSTRAINT     work_groups_pk     PRIMARY KEY (group_id)
    INSERT INTO     work_groups
    VALUES     ('A','Group A','Group A description');
    INSERT INTO     work_groups
    VALUES     ('B','Group B','Group B description');
    INSERT INTO     work_groups
    VALUES     ('C','Group C','Group C description');
    INSERT INTO     work_groups
    VALUES     ('D','Group D','Group D description');
    CREATE TABLE     resources
    (     resource_id     VARCHAR2(20)     NOT NULL
    ,     type          VARCHAR2(1)
    ,     description     VARCHAR2(200)
    ,     group_id     VARCHAR2(5)     
    ,     CONSTRAINT     resources_pk     PRIMARY KEY (resource_id)
    ,     CONSTRAINT     group_id_fk     FOREIGN KEY (group_id)
                             REFERENCES  work_groups (group_id)
    INSERT INTO     resources
    VALUES     ('A001','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A002','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A003','M','text here','A');
    INSERT INTO     resources
    VALUES     ('B001','M','text here','B');
    INSERT INTO     resources
    VALUES     ('B002','M','text here','B');
    INSERT INTO     resources
    VALUES     ('C001','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C002','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C003','M','text here','C');
    INSERT INTO     resources
    VALUES     ('D001','M','text here','D');
    INSERT INTO     resources
    VALUES     ('12345','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12346','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12347','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12348','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12349','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12350','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12351','L','text here','D');
    It looks like all the rows have the same description. if description matters in this problem, wouldn't it be better to illustrate how it matters, by having different descrioptions that appeared in different outputs? On the other hand, if description doesn't play any role in this problem, then why include in the sample data at all?
    I'm not sure if I should have a separate table to define a relationship between a resource or resource group and a calendar id (each resource or group would only be able to be assigned 1 unique calendar id, though multiple resources/groups could share the same calendar id), or if I should add an extra column to each of the above tables to assign the calendar id.
    CREATE TABLE     calendars
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_title     VARCHAR2(25)
    ,     cal_desc     VARCHAR2(200)
    ,     CONSTRAINT     calendars_pk     PRIMARY KEY (cal_id)
    INSERT INTO     calendars
    VALUES     (1,'Default','This is the default calendar to use for workdays');
    INSERT INTO     calendars
    VALUES     (2,'All Days','This calendar treats all days as workdays');
    INSERT INTO     calendars
    VALUES     (3,'Weekends Off','This calendar gives weekends off, but no holidays');
    INSERT INTO     calendars
    VALUES     (4,'Holidays Off','This calendar gives weekends and holidays off');
    What is is cal_id=1? How will it differ from the other three?
    CREATE TABLE     workdays
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_date     DATE          NOT NULL
    ,     cal_year     NUMBER(4)
    ,     work_day     NUMBER(3)
    ,     work_date     DATE
    ,     work_week     NUMBER(2)
    ,     work_year     NUMBER(4)
    ,     work_days     NUMBER(5)
    ,     cal_days     NUMBER(6)
    ,     CONSTRAINT     workdays_pk     PRIMARY KEY (cal_id, cal_date)
    ,     CONSTRAINT     cal_id_fk     FOREIGN KEY (cal_id)
                             REFERENCES  calendars (cal_id)
    );I suspect there's a simpler way, especially if there's a regular order to day types (e.g., people who get holidays off normally get weekeneds, too).
    Perhaps you could have a table like this, that had one row per day:
    CREATE TABLE  days
    (       a_date      DATE     PRIMARY KEY
    ,     day_type    NUMBER (1)              -- 1=Weekend, 2=Holiday, 3=Other
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-01', 2) /* New Years Day */;
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-02', 1) /* Saturday */;
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-03', 1) /* Sunday */;
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-04', 3) /* Monday - back to work */;
    ...Another table (I'll call it work_sched) shows what resources work when:
    CREATE TABLE  work_sched
    (       p_key          NUMEBR     PRIMARY KEY     -- Arbitrary Unique ID
    ,     group_id         VARCHAR2 (5)          -- Exactly one of the columns group_id or ...
    ,     resource_id      VARCHAR2 (20)          --     ... resource_id will always be NULL
    ,     a_date              DATE
    ,     works_on     NUMBER (1)          -- works when days.day_type >= this value
    ,     remarks          VARCHAR2 (40)
    );To indicate that work_group 'L' normally works on type 3 days only (that is, weekends or holidays):
    INSERT INTO work_sched (group_id, a_date, works_on) VALUES ('L', NULL, 3);(Let's assume that p_key is populated by a trigger.)
    The NULL in the a_date column indicates that this applies to all days, unless overridden by another row in the work_sched table. Instead of NULL, mabe some impossible date (such as Jan. 1, 1900) would be more convenient to indicate defaults.
    Exceptions to this schedule would be indicated by other rows in work_sched. For example, if '12345' is the employee who's on vacation for a week in February:
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-08', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-09', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-10', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-11', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-12', 4, 'Vacation');And if that same employee works Satudays in June:
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-05', 1, 'Fiscal year-end crunch');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-12', 1, 'Fiscal year-end crunch');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-19', 1, 'Fiscal year-end crunch');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-26', 1, 'Fiscal year-end crunch');When finding the number of work days, we would join work_sched to days using both conditions:
    ON   work_sched.date           = days.a_date
    AND  work_sched.works_on  <= days.day_type
    cal_id     - refers to calendars table
    cal_date - the actual calendar date
    cal_year - the actual calendar year for the given calendar date
    work_day - workday in that work year (resets each year, starting at 1, is 0 if that calendar date is not a work day)
    work_date - if a work day, the calendar date, if not, the calendar date of the last work day (or in the first week of the calendar, the next work day)
    work_week - work week of the work date (numbered starting at 1 , reset each year at the first Sunday of the year, before first Sunday will have last week of previous year, and the first year of the calendar will have all days prior to Sunday included in the first week, so the first week of a calendar could be more than 7 days)
    work_year - year of the work date
    work_days - shop day of the work date (except in first week of the calendar, before first shop day is 0), starts at 1 (at the beginning of the calendar), cummulative (does not reset each year)
    cal_days - calendar day of the work date, starts at 1 (at the beginning of the calendar), cummulative (does not reset each year)This is a lot of denormalized data. that is, you should be able to easily deduce cal_year from cal_date, but sometimes it is convenient to store denormalized data.
    Assuming the calendar starts on 1/1/2010 (these values are approximately correct--I just made my best guess to provide sample data):
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,1);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,2);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,3);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/04/2010','mm/dd/yyyy'),2010,1,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,1,4);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/05/2010','mm/dd/yyyy'),2010,2,TO_DATE('01/05/2010','mm/dd/yyyy'),1,2010,2,5);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/23/2010','mm/dd/yyyy'),2010,250,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,357);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/24/2010','mm/dd/yyyy'),2010,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,358);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,366);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),1,2011,250,367);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2011','mm/dd/yyyy'),2011,1,TO_DATE('01/03/2010','mm/dd/yyyy'),1,2011,251,368);I've tried googling workday calendars and similar things, but I can't seem to find anything that fits my situation. If anyone could even point me in the right direction, I'd appreciate it.
    I'm working in 10g (XE).
    Edited by: user11033437 on Jul 19, 2011 3:05 PM
    Also, I don't know if it would make more sense to just somehow store the days each resource/group doesn't work, and generate a workday calendar on the fly as needed, rather than trying to store possibly thousands of dates in the database??That's what I was thinking, too.
    Post some sample data (if it's not what you've already posted), a couple of sample questions, and the exact answers you want from each question given that sample data.

  • Whats the best way to apply office updates during OSD task sequence with Software Update Agent disabled?

    I am trying to update office via the SCCM 2012 R2 OSD task sequence. I know offline updating only updates the core components in the WIM and I'm trying to figure out how to add office updates as well. I am aware of using powershell to try and kick off
    a WU scan as seen here:
    http://myitforum.com/myitforumwp/2012/01/24/use-powershell-commands-to-assist-with-patching-during-sccm-image-build/
    But the kicker is we don't use SCCM to update the workstations (Solo WSUS install). Is there a way to do this (maybe set the client in the TS to switch on SUP, then off again when it goes off into production) rather than have to build a new image every month?

    You could use the ZTI_WindowsUpdates.wsf script from MDT.
    http://scriptimus.wordpress.com/2012/03/22/mdt-2012-automating-updates-in-lite-touch-deployments/
    How does it work?
    The task sequence steps run a script called ZTIWindowsUpdate.wsf. The script uses the
    Windows Update Agent API to manage the downloading and installation of updates. All audit information is written to the
    ZTIWindowsUpdate.log file. If you find any unusual error codes in your log returned from the API (although I never have)  you can compare the codes
    here. The script will also check and update the
    Windows Update Agent(WUA) as needed at the start.
    In its default state, the ZTIWindowsUpdate.wsf script will connect to Microsoft Update then search for and download all available updates including Security Patches, Drivers, Browser Updates and Service Packs. This is essentially the same
    as opening the GUI and selecting check for updates.
    Daniel Ratliff | http://www.PotentEngineer.com

  • What is the best way to do OS updates?

    I read on a handful of threads that there's a special way to do updates when it is an OS update. For example, repair permissions, verify, etc.
    Does anyone know?
    Thanks.

    Get a bootable, external HD (preferably FireWire, since it's 40-50% faster than USB 2 and designed for data transfers), make a bootable backup/clone before updating/upgrading, and ensure that it's bootable and works like the original. That allows you to revert to the previous good state without having to reinstall or reset anything. See these for details:
    http://docs.info.apple.com/article.html?artnum=106941
    http://www.macmaps.com/upgradefaq.html
    http://www.macmaps.com/backup.html
    http://www.thexlab.com/faqs/installswupdates.html
    http://www.thexlab.com/faqs/backuprecovery.html

  • Best way to move from RAC to single node database.

    Hi,
    One of my customer is having RAC setup with EBS R12. Due to some other issues, customer is looking to switch back to Standalone database. What could be the best approach for this?
    I am thinking to perform the following approach. Could any body comment on the same?
    1) create a new oracle_home on the same server.
    2) Modify the cluster_database to false.
    3) start the database from new oracle_home.
    4) Create a new listener with same port#(off course i will stop all RAC services including listener).
    Version details are :- 11gR2 on Solaris.
    EBS is :- R12.
    Is this approach sounds good or any better method.
    Thanks in-advance.
    Regards
    DBA.

    Hello DBA,
    You can follow these steps...
    a) Stop database using srvctl
    srvctl stop database -d mydb
    b) Remove the database entry from crs
    $ srvctl remove instance -d mydb -i mydb1
    $ srvctl remove instance -d mydb -i mydb2
    $ srvctl remove database -d mydb
    c) Start the database on first instance
    SQL> startup
    SQL> alter system set cluster_database=false scope=spfile;
    System altered.
    SQL> alter system set cluster_database_instances=1 scope=spfile;
    System altered.
    SQL> alter database disable thread 2;
    Database altered.
    d) Delete the unwanted thread and redo logfiles
    e) Drop the unwanted undo tablespace
    f) Create pfile from spfile
    g) Remove second instance references from the pfile and start the instance
    h) create spfile from pfile.
    Regards,
    Alex Alvarenga
    SP - Brasil

  • Whats the best way to check weather a file exists online, or not?

    Hi!
    I need to show an Image File in my app which may have different sizes. _1.jpg, _2.jpg and so on.. If, for example, _2.jpg does not exist, I have to take _1.jpg.
    So my question is: is there a better way instead of making/allocating a pic and asking pic != nil ?
    thx!
    alex

    Hi Alex -
    The subject line says "file exists online, or not?". Are you trying to check existence at a network site, or the local file system? I'll cover the local fs first, since that's the easiest. If you need to search a remote site, I think we'll need some more details.
    Assuming an iPhone project (not specified, but your usual topic), NSFileManager will probably be all you need unless the files are localized and/or in the application bundle, in which case you'll want NSBundle. For example, say you're storing all the jpg's in the user's cache directory:
    #define MAXFN 5
    // return nil or the path to the file with the highest numeric suffix
    - (NSString)getPathForBestFile:(NSString)baseName extension:(NSString*)ext {
    NSString *bestFilePath = nil;
    NSFileManager *fileManager = [NSFileManager defaultManager];
    // locate the user's cache directory
    NSArray *paths = NSSearchPathForDirectoriesInDomains(
    NSCachesDirectory, NSUserDomainMask, YES);
    NSString *cacheDirectory = [paths objectAtIndex:0];
    NSLog(@"cacheDirectory=%@", cacheDirectory);
    // loop through file names with numeric suffixes
    for (int i = 1; i <= MAXFN; i++) { />/
    NSString *fileName =
    [NSString stringWithFormat:@"%@_%d.%@", baseName, i, ext];
    NSString *filePath =
    [cacheDirectory stringByAppendingPathComponent: fileName];
    NSLog(@" filePath=%@", filePath);
    if ([fileManager fileExistsAtPath:filePath])
    bestFilePath = filePath;
    return bestFilePath;
    If you need to use NSBundle, see pathForResource:ofType:. If you need to determine the existence of a file at a network site, please give us some details about the kind of server and how much you'll know about the possible file locations.
    Hope that helps!
    - Ray

  • What is best way to sync 2 Macs to 1 iPhoto database?

    I have a main home iMac that serves as our digital life hub. Occasionally, especially when on the road, I'd like to have the same iPhoto database on MacBook Pro, but, be able to make changes, edits, etc., and then be able to get those back into the iMac. Is there a way short of copying the whole iPhoto database back and forth?
    I suppose one idea would be to use a portable, external drive, so curious if performance suffers in that case. Thanks

    David
    You will need to copy the Library to the MBP at least once, thereafter you can use iPhoto Library Manager to move pics and their associated metadata from library to library.
    I suppose one idea would be to use a portable, external drive, so curious if performance suffers in that case.
    Well, performance won't suffer and you can copy the Library to an external as easily as to the laptop.
    1. Quit iPhoto
    2. Copy the iPhoto Library Folder as an entity from your Pictures Folder to the External Disk.
    3. Connect the Disk to the laptop. Hold down the option (or alt) key while launching iPhoto. From the resulting menu select 'Choose Library' and navigate to the new location. From that point on this will be the default location of your library.
    Regards
    TD

  • Best way to check the HEALTH of SQL server database

    We are having SQL server in CLUSTER environments and well configuration i.e. more than 200 GB RAM.Stil we are getting no good response.
    Please advise on this so that we will dig before happens.
    Cheers,
    DB5

    Hello,
    If I understand correctly, you want to improve SQL Server performance.
    In SQL Server we have many situation to improve the performance. For example:
    • Design efficient schemas.
    • Optimize queries.
    • Fine-tune indexes.
    • Perform efficient transactions.
    • Build efficient stored procedures.
    We can obtain the best performance and scalability gains in application development. Indexing is considered part of the application development effort. Poor indexes that lead to increased CPU utilization, and memory or disk I/O utilization. You can refer
    to the following article about Improving SQL Server Performance.
    Reference: http://msdn.microsoft.com/en-us/library/ff647793.aspx
    There are many similar issue for your reference.
    http://social.technet.microsoft.com/Forums/en-US/home?category=sqlserver&filter=alltypes&sort=relevancedesc&brandIgnore=True&filter=alltypes&searchTerm=sql+server+performance
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • What is the best way to create fields at runtime in the database using JPA?

    We use Oracle ADF platform to build web applications and extend to webcenter portal application.
    The current expectation from Java developers team is to change our development approach/method, so that adding some fields in the application should not required any development effort. In other words, when you want to add a data field (at least no relation to any field) in some form, it should be enough to save some metadata of the field to the database along with execution of related job/commands in the application. Additionally, we need to render the view dynamically according to added fields.
    Essentially, I think that such an expectation is not suited for the Java world, but if it could be possible or if someone has prior experience to do this, I would want to use it. We don't want to be interact directly with the database using native SQL through JDBC, as that would mean going out of the ADF framework.
    Suppose that, we define the metadatas of custom field(s), for example its type(string, number, combobox etc)length, isunique, mandatory... And then we run the execute command of this field definition to create on database and map to related entity object from now on. I assume that might be possible to add entity class as property belonged to class. Anymore when rendering the page, new custom field must be shown in form view if even there is no deployment process...
    There is Extensible Entity in EclipseLink. Has anybody got sample project about used eclipselink extensible entities? I could not find enough detailed docs unfortunatelly
    http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Extensible_Entities#EclipseLink.2FUserGuide.2FJPA.2FAdvanced_JPA_Development.2FExternal_Mappings
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/Dynamic#Usage_Examples
    http://flex.winfxpro.info/download/?noderef=workspace://SpacesStore/af69ebfb-6d9f-4a03-8244-c56100d16deb

    In the persistence.xml specify the property
    <property name="eclipselink.ddl-generation" value="create-tables"/>
    But, a JPA implementation is not required to create tables according to the EJB 3 JPA specification. The Hibernate persistence provider does, the EclipseLink doesn't.
    <provider>org.hibernate.ejb.HibernatePeristence</provider>

  • Best way to learn Java. Free resources online?

    Hello. I would like to start to learn Java but have no programming background except for Visual Basic and the basics of PHP. I started to learn about a week ago and now have a good understanding of some of the basic concepts, such as the IF, SWITCH, LOOPS, PRINTLN, ect. I am very interested in developing applications for the Blackberry and was wondering where I should start and what I should learn. Must I learn the entire Java programming language to start to develop mobile applications? Are there any free resources on the Sun Java website that would be able to help me learn?
    Thank you
    Edited by: n3xtgen on May 20, 2010 12:27 PM

    n3xtgen wrote:
    Must I learn the entire Java programming language to start to develop mobile applications?Depends on what you mean by "entire Java programming language". You should probably have a solid understanding of the language and concepts before attempting mobile development.
    The Java language itself is the same when developing for mobile devices (except you may be forced to rely on an older version of the language). But debugging/deployment/running your code becomes more complicated as soon as you target mobile devices.
    Therefore I suggest you take some time to learn "normal" Java development. It will definitely pay of in the long run.
    Are there any free resources on the Sun Java website that would be able to help me learn?There are [the tutorials|http://java.sun.com/docs/books/tutorial/]. They are pretty useful.

  • Best way to update Genre

    I have a library (15GB) of music that I have accumulated over the years outside of itunes. I got most of it from the Zune market place and really don't like the way they have labeled the genre tag of most of the music. When I try to use the "Get CD Track Names" option of iTunes, I get the error that the function is not available since I did not buy it from itunes.
    What would be the best way for me to update the genre information on my tracks, without losing my library database of ratings and play counts? I am looking for some automated way that could go against itunes or CDDB to get the genre information.
    Thanks!

    I get the error that the function is not available since I did not buy it from itunes.
    Actually, you get the message;
    "iTunes cannot get CD track names fro dongs thay were not imported using iTunes.
    To allow iTunes to look for CD track names for this song, import the song again using iTunes."
    Get CD track names nly applies to CDs you have RIP'd using iTunes.
    What would be the best way for me to update the genre information on my tracks, without losing my library database of ratings and play counts?
    There are plenty of apps for Windows to update (all or some) tags.
    Here's a couple
    -> http://musicbrainz.org/
    -> http://massid3lib.sourceforge.net/

Maybe you are looking for