Wednesday, November 07, 2007

Oracle Calendar Command Line Conversion

As usual the best ideas come from our clients, and in this case kudos go to Steve in Georgia.

For an Oracle Calendar to Zimbra migration he suggested "Why not make the OCS conversion command-line driven? Then we can script the entire process end to end."

Not a bad idea -- so we went ahead and did it.

OraCalReader.exe is our tool that takes OCS Export files from UNICPOUTU and turns them into our intermediate format (from here they can go into Exchange or Zimbra).

So now to run this on the DOS command line:

OraCalReader /ALL /TZ:tzValue /TH:xx /DROPDT:"dt" /EXPDIR:pp /OUTDB:ppdb

Notes:
  • If you run /ALL without any other command line parameters, the code takes the DEFAULT settings saved in the UI preferences. UI preferences are visible by running the application without any switches on the command line
  • The code will read the export files and insert them into the database.
  • The code's default behavior is to delete ALL existing data in the database prior to insertion.
  • Two Logfiles are generated: _OraCalReader_log.log, and _OraCalReader_Error.log
/ALL Required and has no command options

/TZ:tz Timezone.
Acceptable values are: EST5EDT CST6CDT MST-3MDT PST8PDT
NAST9NADT MST7MDT GMT0BST MET-1METDST MEZ-1MESZ
CIST-12:45CIDT IST-2IDT MST-3MDT UCT-5:30 UCT-7 CST-8 UCT-8
JST EST-10EDT UCT6 UCT4 UCT EST5EDT

/Th:xx Threshold xx is a percent, ranging from 1 to 100, Default is 80
This is a number, not a decimal. Exclude the percent sign

/DROPDT:dt DROP/Cutoff Date Where dt is any valid date format in US format time, e.g., mm/dd/yyyy, mm-dd-yyyy
One year from today

/EXPDIR:pa OCS export file directory (path) Where: Pa is any path, e.g.:“f:\data\ocsout”
Defaults to the current path. The path should be enclosed in quotes. Do not include a trailing "\"

/OUTDB:db MS Access Output database Where db is the name of the database, including the path NO DEFAULT You must specify this parameter!

So the following would be a real world example:

oracalreader /all /TH:80 /TZ:"EST5EDT" /EXPDIR:"C:\Documents and Settings\Zyg\Desktop\Tech Data" /OUTDB:"C:\Documents and Settings\Zyg\Desktop\Tech Data\gt3-prime.mdb" /DROPDT:"11/1/2006"

The above command specifies an 80% recurrence threshold, Oracle's Eastern Standard Time, directories and database as shown, and to only take calendar data AFTER November 1, 2006.

No comments: