nuodb-migrator schema
The nuodb-migrator schema command generates a DDL SQL statement script to create database objects that have been defined in a schema of a source NuoDB or third-party database.
Syntax
nuodb-migrator schema
--source.driver=source_driver_class_name
--source.url=jdbc:source_jdbc_url
--source.schema=my_schema
--source.username=userid
--source.password=passwd
--output.path=path_and_filename_for_ddl_sql_file [option]...
nuodb-migrator schema supports the following types of options:
-
Source database options
Specify the details for the source NuoDB or third-party database, such as database connection, login credentials and transaction properties.Option Required? schemaoption valid fornuodb-migrator dumpand/ornuodb-migrator loadcommandDescription --source.driver=
driverYes
nuodb-migrator dumponlyJDBC driver class name
--source.url=
urlYes
nuodb-migrator dumponlySource database connection URL in the standard syntax:
jdbc:subprotocol:subnameOptionally, include the source database username and password in the
urlspecification. As shown in the following table, the syntax can vary according to the source database. Theurlexamples show the specification ofrootuseras the username androotpwas the password.MSSQL Server using JDBC driver
--source.url= jdbc:sqlserver://192.168.0.6;user=rootuser;password=rootpw;database=tempdbMSSQL Server using JTDS driver
--source.url= jdbc:jtds:sqlserver://192.168.0.6:1433;user=rootuser;password=rootpw;databaseName=tempdbMySQL driver
--source.url= jdbc:mysql://localhost:3306/test?user=rootuser&password=rootpwNuoDB driver
--source.url= jdbc:com.nuodb://127.0.0.1/test?schema=TEST&user=rootuser&password=rootpwOracle driver
--source.url= jdbc:oracle:thin:rootuser/rootpw@192.168.0.11:1521/XEPostgreSQL
--source.url= jdbc:postgresql://192.168.0.99:5432/test?user=rootuser&password=rootpwIt is allowed to specify the database username and password in both the
source.urloption and in thesource.usernameandsource.passwordoptions. If you do this and the specifications are not the same then there is a warning message but thenuodb-migrator schemacommand continues execution by using one of the specifications. Which specification the command uses depends on which source driver you are using:Specification in source.urlSpecification in source.usernameandsource.passwordMSSQL Server using JTDS driver MySQL driver Oracle driver PostgreSQL driver
MSSQL Server using JDBC driver NuoDB driver
--source.username=
usernameYes
nuodb-migrator dumponlySource database username. Alternatively you can specify the user name in the
source.urloption.--source.password=
passwordNo
nuodb-migrator dumponlySource database password. Alternatively you can specify the password in the
source.urloption.--source.properties=
propertiesNo
nuodb-migrator dumponlyAdditional connection properties encoded as URL query string, e.g. “
property1=value1&property2=value2…”--source.catalog=
catalogNo
nuodb-migrator dumponlyDefault database catalog name to use
--source.schema=
schemaNo
nuodb-migrator dumponlyDefault database schema name to use
--source.auto.commit= { true | false }
No
nuodb-migrator dumponlyIf set to
true, each individual statement is treated as a transaction and is automatically committed after it is executed. The default isfalse.--source.transaction. isolation=
valueNo
nuodb-migrator dumponlySets the transaction isolation level for the migration execution. A valid value can be either a symbolic name or an integer constant representing transaction isolation levels as defined in the JDBC
java.sql.Connectionclass. Valid values include:-
noneor 0 -
read.uncommittedor 1 -
read.committedor 2 -
repeatable.reador 4 -
serializableor 8 -
vendor_dependent_level
NuoDB does not support all of the levels, only
read.committedor 2,serializableor 8 and two additional levels that are not in the JDBC standard. See Supported Transaction Isolation Levels for more information. -
-
Target database options
Specify the details for the target NuoDB database, such as database connection, login credentials and schema information. If target database options are provided then the DDL SQL script is executed in the target NuoDB database and it creates the database objects.Options related to the target database connection. If provided, the DDL commands will be executed in the target database. The target parameters can also define specifics regarding data mapping definitions. Option
Required?
schemaoption valid fornuodb-migrator dumpand/ornuodb-migrator loadcommandDescription
--target.url=
urlNo
nuodb-migrator loadonlyTarget database connection URL in the format,
jdbc:com.nuodb://host:port/database--target.username=
usernameNo
nuodb-migrator loadonlyTarget database user name
--target.password=
passwordNo
nuodb-migrator loadonlyTarget database password
--target.properties=
propertiesNo
nuodb-migrator loadonlyAdditional connection properties encoded as URL query string, e.g. “
property1=value1&property2=value2…”--target.schema=
schemaNo
nuodb-migrator loadonlyDatabase schema name to use. If not provided, objects will be generated in the same schema as the source database schema.
-
Output script definition and formatting
Specify filters for which objects to generate DDL SQL object create statements. You can also specify which objects to not include in DDL SQL statement creation. For example, specify the type of DDL commands generated for each object, such asDROPand/orCREATEstatements and define syntax such as qualifying schema name and using quotes.Option Required? schemaoption valid fornuodb-migrator dumpand/ornuodb-migrator loadcommandsDescription --output.path=
path/filenameNo
-
Saves DDL SQL script to a file specified by
path/filename. If this parameter is omitted, the DDL is displayed to standard output.--table.type=
table_type[,table_type…]No
nuodb-migrator dumpand/ornuodb-migrator loadComma separated types of table objects (
TABLE,SYSTEM TABLE,GLOBAL TEMPORARY,ALIAS,SYNONYM, etc. to process. By default, onlyTABLEtype is processed. Views, triggers, functions, and stored procedures are not currently supported by thenuodb-migratortool.--meta.data.
value={true | false}No
nuodb-migrator dumpand/ornuodb-migrator loadIncludes or excludes specific metadata types from the generated output. Valid values are:
-
table -
primary.key -
index -
foreign.key -
check -
sequence -
column.trigger
By default, all objects are generated. If you have tables with a sequence auto-generated column, you cannot use the
--meta.data.sequence=falseoption when migrating those tables.--script.type={drop | create}
No
nuodb-migrator loadonlyType of DDL statement to be generated for each object.
Default is both
DROPandCREATEstatements for each object.--group.scripts.by={table | meta.data}
No
nuodb-migrator loadonlyGroup generated DDL scripts. Group by table is the default.
CREATE/ALTERstatements for the table and all indexes, foreign keys, etc. will be generated before it moves to the next tableCREATEstatement.--identifier.quoting={ minimal | always |
fully_qualified_class_name}No
nuodb-migrator loadonlyIdentifier quoting policy name, implementing
com.nuodb.migrator.jdbc.dialect.IdentifierQuoting. Valid options are:-
minimal- policy quotes only SQL keywords and not valid identifiers (valid identifier matches [a-zA-Z0-9_]* pattern) -
always- policy quotes all identifiers. This is the default behavior. -
A fully qualified class name of a custom identifier quoting policy (i.e.
com.somepackage.CustomIdentifierQuoting).
--identifier.normalizer={ noop | standard | lowercase | uppercase |
fully_qualified_class_name}No
nuodb-migrator loadonlyIdentifier transform to use, implementing
com.nuodb.migrator.jdbc.dialect.IdentifierNormalizer. Valid options are:-
noop- strategy returns unchanged identifier. This is the default behavior. -
standard- strategy delegates identifier normalization to the dialect, which by defaults does no normalization (and looks similar tonoop) -
lowercase- transforms characters to lowercase -
uppercase- transforms characters to uppercase -
a fully qualified class name of a custom normalizer (i.e.
com.somepackage.CustomIdentifierNormalizer)
--naming.strategy={ auto | hash | qualify}
No
nuodb-migrator loadonlyNaming strategy to define how some object names are generated. This relates to objects of type index, foreign key, sequence, trigger. Valid options are:
-
auto- generates a qualified name for the specific object types (seequalifyoption). If the object name is greater than the maximum object name limit of 128 characters, it will generate a shorter name (seehashoption). This is the default value. -
qualify- this generates qualified name for the specific object types, depending on the object type. For example, index object names are generated as table name, followed by each column name defined by the index. Each are separated by an underscore. -
hash- generates a shorter name for objects by appending a hash value to an index type prefix. For example, index object names are generated asIDX_some hash value. -
A custom strategy may be defined by specifying a fully qualified class name (i.e.
--naming.strategy=com.package.MyCustomName). This strategy allows for full control over object name definition for all types of objects: tables, columns, sequences, indexes, primary keys, foreign keys, check constraints, and triggers.
-
-
Data type mapping options
Override the default data types that will be generated.Option Required? schemaoption valid fornuodb-migrator dumpand/ornuodb-migrator loadcommandDescription --type.code=
type_codeNo
nuodb-migrator loadonlyThis parameter identifies a type in the source database for which we want to specify a customized mapping. See
type.code.--type.size=
type_sizeNo
nuodb-migrator loadonlyDefines the size of a source data type. This parameter will allow you to map source types of different sizes to different target types. See also
type.size, precision, scale.--type.precision=
type_precisionNo
nuodb-migrator loadonlyThe maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point. This parameter will allow you to map source types of different precision to different target types. See also
type.size, precision, scale.--type.scale=
type_scaleNo
nuodb-migrator loadonlyThe number of fractional digits (digits after the decimal point) for numeric data types. This parameter will allow you to map source types of different scale to different target types. See also
type.size, precision, scale.--type.name=
type_nameNo
nuodb-migrator loadonlySQL type name , i.e.,
DECIMAL(p[,s])orVARCHAR(n), wherepis precision,sis scale, andnis a maximum size. Seetype.name.--config=
pathNo
nuodb-migrator loadonlySpecifies a custom type mapping configuration file, where
pathis a full path and filename for the file. This file is used to transform source database data types to target database data types. If the fileconf/nuodb-types.configis to be used, it is not necessary to use this parameter. It is only necessary to use the--use.nuodb.types=truecommand line parameter.--use.nuodb.types={ true | false }
No
nuodb-migrator loadonlyInstructs
nuodb-migratorto transform source database types to the best matching NuoDB types, whereCHAR,VARCHARandCLOBsource types will be rendered asSTRINGcolumns. Theconf/nuodb-types.configfile is the source file for type overrides. If some other file is to be used, the--config=pathparameter must be used to define the file. This option is false by default. See Example ofnuodb-migratorSchema Command, anduse.nuodb.typesbelow.--use.explicit.defaults={ true | false }
No
nuodb-migrator loadonlyAffects only MySQL implicit default values. This option allows MySQL implicit defaults to be moved over to the NuoDB schema explicitly. The option is
falseby default. See Example ofnuodb-migratorSchema Command.
The output from running nuodb-migrator schema includes a data types mapping summary. For each source type, the summary shows the NuoDB type it was mapped to.