
Usage: data_sync -u=<user_id> -p=<password> -g=<group> 
             {-class=<class_name> -filename=<filename> -item_id=<template> -OnlyVIS} 
             -site=<site_name> {-sync | -republish | -verify} [-pull] [-update]
             [-force] [-report[=<filename>]] [-exclude_files] [-modified_only]
             [ -exclude=<relation type1> -exclude=<relation type2> ...]
             [ -include=<relation type1> -include=<relation type2> ...]
             [-include_bom] [-classoffile=<class_name>] [-<revision_selector>]
             [-latest_ds_version] [-assert_extinct_ods] [-assert_extinct_site]
             [-replacement_site=<name of site that replaces extinct site>]
             [-stubs_only>]
             [-exclude_folder_contents] [-since=YYYY-MM-DD:HH:NN] [-bp]
             [-batch_size=<number of objects per batch>] [-verbose] [-log] [-h]

Where: (NOTE: Entries in parentheses are acceptable abbreviations)
   -u=<user_id>                TcEng user ID. In most cases the TcEng user ID will
                               be infodba  or another TcEng user ID with  system
                               administration privileges.
   -p=<password>               TcEng password associated with the -u=<user_id> 
   -g=<group>                  TcEng group associated with the -u=<user_id> 
   -pull                       To start synchronization in pull mode, i.e. from 
                               Replica Site 
   -class=<class_name>         TcEng class  name to  update (sync). This  switch
                               may be  given multiple times to process  multiple
                               classes.                         ** See Note 1 **
   -filename(fn)=<file_name>   Name of input file  with list of IDs  or names of
                               objects to update.               ** See Note 1 **
   -classoffile(cof)=<class_name> The class of the objects whose IDs or
                               names are listed in the file. This option is
                               valid only with the -filename option. Defaults
                               to Item class if not given.
   -item_id(item)=<template>   ID or template of item(s) to update (sync).
                                                                ** See Note 1 **

   -OnlyVIS                    To Synchronize Visulization dataset(s) which are 
                               under replicated Item Revision having status 
                                                                ** See Note 8 **

   -sync                       Request for the update (sync)    ** See Note 2 **
   -republish(repub)           Request for the republication.   ** See Note 2 **
   -verify(veri)                When used with  the -update  option  deletes  the
                               IXRs of objects  whose  replicas do not  exist at
                               the remote sites. When used  without the  -update
                               generates a report               ** See Note 2 **
   -assert_extinct_ods(aeo)    When used with the -verify switch deletes all the
                               PARs to the given ods site(s).Only infodba user
                               can use this switch     ** See Note 5 **
   -assert_extinct_site(aes)   When used with the -verify switch deletes all the
                               IXRs to the  given site(s). Only infodba user
                               can use this switch     ** See Note 5 **
   -replacement_site(rs)=<sitename> Sitename of site that replaces the site to
                               be extinct. Valid with -assert_extinct_site only.
                               All objects owned by the extinct site will be
                               owned by the replacement site and all POM
                               stubs pointing to the extinct site will be
                               redirected to the replacement site.
   -stubs_only                 Process stubs only when replacement_site 
                               is given. Valid with -assert_extinct_site only.
   -update(upd)                Perform database update (sync)   ** See Note 4 **
   -report[=<filename>]        Generates a  report. If no  filename is specified
                               the report is written to stdout.
   -site=<site_name>           TcEng site(s)  to be  updated. This switch may  be
                               given multiple times to sync with  multiple
                               name-identified  sites.
   -exclude_files(exf)         Excludes dataset files when updating
                                                                ** See Note 6 **
   -exclude=<relation_type>    Excludes relation type. May be given multiple
                               times. Must use database name (not display name)
                               of the relation type.
                                                                ** See Note 6 **
   -include=<relation_type>    Includes relation type. May be given multiple
                               times. Must use database name (not display name)
                               of the relation type. Use this to force the
                               inclusion of a relation type that may have
                               been excluded during the last export.
   -exclude_folder_contents(efc) Excludes contents of a folder. Intended
                               for use with UG Part Families where family
                               members are stored in a folder that is
                               attached to the item.

   -include_bom(bom)           Synchronizes the entire BOM to all levels
                                                                ** See Note 6 **
   -disable_modified_only(dmo) Disables  the default  behavior  of synchronizing
                               sub-objects  inside  an  item  only  if they were
                               modified  since   the  last  time  the  item  was
                               exported. Should normally not be used.     
                                                                ** See Note 6 **
   -<revision_selector>        Override the  default  behavior of  synchronising
                               the latest item revision  only. Choose one of the
                               following revision selectors. Valid only if both
                               the -sync and -update options are specified
                               -all_revisions    < Synchronize all revisions >
                               -latest_revision  < Synchronize only the latest
                                                   revision regardless of 
                                                   release status. This is
                                                   the default if no revision
                                                   selector is given AND more
                                                   than 1 site to be synced.
                                                   If synchronizing only 1
                                                   site, the default selector
                                                   is same_as_last_export.>
                               -latest_working   < Synchronize only the latest
                                                   working revision >
                               -latest_released  <  Synchronize only the latest
                                                    released revision with any 
                                                    release status >
                               -latest_working_or_any
                                                 < Synchronize only the latest
                                                   working revision. If there 
                                                   is there is none, then sync
                                                   the latest released. >
                               -release_status=<release status type>
                                                 < Synchronize only the latest
                                                   released revision with the 
                                                   given release status >
                               -all_released_revs < Synchronize all revisions
                                                    with a release status
                               -same_as_last_export  <  Synchronize based on
                                                    the options used when item
                                                    was last exported. This is
                                                    the default if no revision
                                                    selector is given AND only
                                                    1 site is to be synced.
                                                    If synchronizing multiple
                                                    sites, the default selector
                                                    is latest_revision.>
   -latest_ds_version(ldv)     Synchronizes only the latest version of Datasets
                                                                ** See Note 6 **
   -force                      Synchronizes underneath objects regardless of
                               whether the given top level object is modified
                               or not since the last export. It does not function
                               when used in combination with the -verify argument
                                                                ** See Note 3 **
   -since                      Synchronizes only those objects modified since
                               the given date and time which must be given in
                               YYYY-MM-DD:HH:NN format where YYYY is the year;
                               MM is the month number from 1 to 12; DD is the
                               day from 1 to 31; HH is the hour from 0 to 23;
                               NN is the minute from 0 to 59. HH and NN are
                               optional and default to zero which means
                               12 AM of the given date. This is valid only
                               with -class switch.
   -batch_size(bs)=<number>    Number of objects per batch; a new process
                               will be created per batch. All Workspace
                               objects (not just items) that are synchronized
                               are considered part of a batch. Default batch
                               size is 2000.
   -verbose                    Runs in Verbose mode. Displays maximum  amount of
                               information including  starting  and ending times
                               of individual sync operations. Do not  abbreviate
                               this switch to -v.
   -log                        Generates detailed log file
   -bp                         Display best practices information
   -h                          Display this help message

Notes :
    1. One of these must be supplied: -class , -filename or -item_id
    2. One of these must be supplied: -sync , -republish or -verify
    3. The  -force  option can  only  be used along  with  the -filename  or the
       -item_id  options
    4. Unless the -update switch is given, data_sync will only generate reports.
    5. The  -assert_extinct_site and -assert_extinct_ods can  only be used  with
       the -verify switch
    6. The -exclude_files, -exclude=, -include_bom, -disable_modified_only and
       -latest_ds_version can be used if both -sync and -update are given

    7. The -classoffile currently supports the classes Item, ItemRevision,
       Dataset, Form and Folder only.

    8. The -include and -update must be supplied with -OnlyVIS
**----------------------------------------------------------------------------**

This utility will synchronize the copies of an object at remote sites
with the latest version of the object's master copy. It will also
update publication records when republishing objects.  In verify mode,
it will check the existence of exported objects at the remote sites;
if a copy no longer exist at a remote site, the corresponding Iman Export
Record will be deleted from the owning site.

data_sync uses the Iman Export Records (IXR) and Publication Audit
Records (PAR), which are attached to the master copy of an object, to
determine whether or not to synchronize a copy or the publication
record in the ODS. These records contain information on when the object
was last sent to a particular site or last published to an ODS. It then
compares these dates with the object's last-modified-date and decides
whether or not to synchronize the object. Thus, only those objects that
were modified since the last successful run of data_sync will be updated.

When updating multiple sites and some sites are not operational at that
time, data_sync will update the ones that are available but will remember
via the IXR's and the PAR's the ones that are not available so they
can be updated next time.

Once data_sync has determined which objects and sites to synchronize,
it uses the basic Multi-Site mechanisms (export/import, IDSM, ODS, etc.)
to accomplish its task. For this reason, it is highly recommended that
data_sync be run in batch mode during off hours so that it does not
compete with users during work hours for computing and network resources.

Examples: (Note that required login information are intentionally omitted)

1. To generate report of which items need to be synchronized for a given site:

   data_sync -class=Item -site=Site1 -sync

   The report will be output to stdout. No synchronization will be performed.

2. To synchronize all items copied to a site and output report to a file:

   data_sync -class=Item -site=Site1 -sync -update -report=report.lst

   NOTE: The default revision selector -same_as_last_export will be used.

3. To synchronize the latest released revisions of items:

   data_sync -class=Item -site=Site1 -sync -update -latest_released

4. To synchronize all Forms and Datasets:

   data_sync -class=Form -class=Dataset -site=Site1 -sync -update

5. To republish all previously-published items to the ODS named Mfg_ODS:

   data_sync -class=Item -site=Mfg_ODS, -republish -update

6. To check if datasets copied to the site Design_Center are still there
   delete the IXR from the master if a copy is no longer there:

   data_sync -class=Dataset -site=Design_Center -verify -update

7. To force synchronize a list of items specified in a text file copied to
   a site and output report to a file:

   data_sync -filename="/myhome/itemlist.txt" -classoffile=Item -site=Site1
    -sync -update -force -report=report.lst

8. To force synchronize a single item or items that match a template

   data_sync -item_id=Eng* -site=Site1 -sync -update -force -report=rep.lst

9. To destroy all the Export Records to a given site and replace the
   references to the extinct site with replacement site Site1

   data_sync -site=DeadSite -verify -assert_extinct_site -replacement_site=Site1

10 To destroy all the Publication Records to a known extinct ODS site

   data_sync -u=infodba -p=infodba -site=XSite -verify -assert_extinct_ods

11 To destroy Export Records of specific deleted replica item revisions, their
   BVRs and attachments:

   data_sync -site=S1 -verify -update -fn=mylist -cof=ItemRevision

   The file mylist has item revision names in the format: item123/A

12 To destroy Export Records of specific deleted replica datasets:

   data_sync -site=S1 -verify -update -filename=mylist -classoffile=Dataset

   The file mylist has dataset names in the format: dataset123

13 To start synchronization in pull mode:

   data_sync -pull -class=Item -site=S1 -sync -update -report=report.lst

14 To force synchronize a list of items specified in a text file in pull mode:

   data_sync -pull -filename="/myhome/itemlist.txt" -force -site=S1 -sync -update -report=report.lst

15 To generate report of which items need to be synchronized in pull mode:

   data_sync -pull -filename="/myhome/itemlist.txt" -site=S1 -sync -report=report.lst

16 To Synchronize Visulization dataset(s) which are under replicated Item Revision having status

   data_sync -OnlyVIS -since=2005-01-01:01:01 -site=yatishIdsm -sync -update

   -report=report.lst -include=IMAN_Rendering -include=IMAN_specification

Important Notes:

1. When synchronizing Items, all Item Revisions, BV's, BVR's, Forms and
   Datasets associated with an Item will also be synchronized. Therefore in
   in most cases, you will only need to synchronize the Item class.
2. Changes to Specification, Requirement and Master Form attachments will
   trigger an update of the parent item's last-modified-date and force the
   item to be synced as well as the attachment. If you wish other relation
   types to trigger the synchronization of the parent item, you need to
   define the site preference ITEM_relation_types_update_lmd.
3. When synchronizing an assembly, data_sync will not automatically traverse
   the assembly tree; instead, it will sync each subassembly or component
   individually on an as-needed basis. If you want data_sync to traverse the
   assembly tree, use the -include_bom switch.
   
4. Since data_sync never involves any transfer of ownership, there is no
   need to perform export recovery if data_sync is terminated prematurely.
   
5. When synchronizing, data_sync will perform an automatic verification.
   In other words, it will first check if the object being synchronized
   still exists at the remote site before synchronizing it. If a replica
   no longer exists, data_sync will simply delete the corresponding IXR.

6. The -verbose option can be used to analyse the performance of data_sync.
   The -verbose switch prints the system time at important stages during the
   progress of the synchronization. 

7. It is highly recommended that you sync only 1 site at a time instead of
   of synchronizing multiple sites in a single run of data_sync. This
   will allow you to use the -same_as_last_export revision selector which uses
   the same import/export options used to replicate the item. If you need
   to synchronize multiple sites, create a script that will loop thru the
   sites but invoke data_sync with only 1 site at a time.

