VoltSeConvert is used to do a crude, once-off conversion from Oracle or TimesTen to VoltDB
This rep contains java sources and JDBC drivers needed to compile the converter. https://bitbucket.org/voltdbseteam/voltseconvertoracleexample contains example code.
- VoltSeUtil
- Java 1.8
- Oracle 10.2 or greater, or TimesTen, running the target application.
The main class is Converter.java.
The generic command line is:
ORACLE host port sid user pass otheruser package_name dir sqlpasses
- DB type (ORACLE or TIMESTEN)
- host
- sid (the oracle or timesten instance id)
- user - login user
- pass - login pass
- otheruser - user who owns procedures. A common pattern in Oracle/Timesten is for different users to own code versus run code.
- package_name - desired java package name
- dir - output directory. child directories sql and src will be created.
- sqlpasses - how many times the convertor looks for new parsed SQL statements, at one minute intervals.
An example set of parameters would be:
ORACLE orcl2.cpolcsopv6zq.us-east-1.rds.amazonaws.com 1521 ORCL2 orindademo orindademo otherusername org.foo /Users/drolfe/Desktop/EclipseWorkspace/voltseconvertoracleexample 1
- Creates VoltDB-friendly table definitions in the sql directory. Note that we ignore FK's.
- Creates VoltDB compatible procedures that map to the target DB's procedures.
Both Oracle and TimesTen provide a data dictionary view called ALL_ARGUMENTS that shows the input, input output and output parameters for each procedures. The view is semi-hierarchical - if a record or array is used as a parameter the level below will contains the fields of the record. In our first pass we simply get a list of procedure names.
For each procedure we get the top level parameters and their data types. We use this to define the inputs and outputs of our VoltDB procedures. All records, arrays and non-scalar types are mapped to VoltTable.
In the case of Oracle we query V$SQL, which contains the raw text of each currently parsed SQL statement. Note that we can only find SQL statements that have been recently parsed - i.e. for procedures that someone attempted to invoke.
We also query ALL_SOURCE, which contains - as the name suggests - the source code of the procedures.
We then turn the SQL statements into regular expressions and search for them in our collection of procedure source code. When we find a match we create a SQLStmt object in the generated VoltDB procedure
Each procedure will have the following:
- Input params
- Output params - defined as variables with matching code to create a VoltTable[] to to return
- SQL Statements (where available)
- Source code (commented out)
We also create VoltDB friendly tables for the Tables and Views we find in the source schema.
See here.
- Procedures with no parameters are ignored.