This capability is currently only available under Windows.
In addition to using the GRT shell from within the
MySQL Migration Toolkit, you can invoke it directly from the command
line. If the location of the MySQL GUI Tools is not included in the
PATH variable, navigate to the installation
directory and find the grtsh.exe file.
Execute this file by typing:
C:\> grtsh -?
Do this and you should see the following listing:
Usage: C:\Program Files\MySQL\MySQL Tools for 5.0\grtsh.exe [-classpath path] »
[-modulepath path] [-jvm library] [-d path] [-listen port] [-verbose] [-x] [luafile]
C:\Program Files\MySQL\MySQL Tools for 5.0\grtsh.exe -j structsfile outputdir
C:\Program Files\MySQL\MySQL Tools for 5.0\grtsh.exe -p structsfile outputdir
-lua ......... Use the Lua shell (default).
-py .......... Use the Python shell.
-classpath ... Sets the java classpath to the given value.
-modulepath .. Sets the location of the GRT module directory.
-jvm ......... The java virtual machine library to use (with absolute path).
-basedir ..... Path to the data files location.
-d path ...... Modules directory
-x ........... Exits the shell after running the specified file
luafile ...... File that is run at startup.
-listen port . Runs in 'remote agent' mode on the given port number.
-verbose ..... Prints detailed startup information.
-j ........... Generates Java classes from the given structs file.
-p ........... Generates PHP classes from the given structs file.
-D var=value . Sets a global shell variable to the given value.
Environment variables:
GRT_MODULE_PATH Equivalent to -modulepath, must point to the directory
where the grtsh binary resides
The default shell is the Lua shell and is
indicated by the / > prompt. Using the
-py option opens a Python shell, indicated by the
/>>> prompt.
If you wish to set the classpath for Java classes use the
classpath option. You may also change the Java
Virtual Machine (JVM) by using the jvm option
with the absolute path to the JVM you wish to use.
The modulepath option sets the location of the
dll files used with the GRT shell. These
files are located in the same directory as the
grtsh.exe file. You can also set this
directory by defining the environment variable,
GRT_MODULE_PATH.
The location of any data files you wish to use may be set using
the basedir option.
To see the various modules that are loaded at startup use the
verbose option. The java modules are stored in
the java\com\mysql\grt\modules directory
immediately below the installation directory and the
Lua modules in the lua
directory. Currently, importing Python modules is not supported.
To include modules other than the default modules, use the
d option with a path.
It is also possible to use the GRT shell to convert XML files to
Java or PHP class files, by opening the shell using the
j or the p option and specifying
the XML source file and the destination directory.
Use the listen option with a port number to run
the GRT shell as a service that can be accessed from a remote
location.
Perhaps most importantly, you can pass a Lua
script to the shell on startup. This allows you to perform tasks
using a script file without even opening the MySQL Migration Toolkit.
This is an especially useful feature if you need to migrate the
same database a number of times or you want to customize a
migration. You can easily create a Lua script
by clicking the Generate Migration Script
when migrating using the graphical interface. For information on
creating a Lua script, see
Section 9.17, “The Summary Screen”. A Lua
migration script is examined in detail in
Chapter 11, Scripted Migration.
Passing a Lua file to the shell is usually
invoked using the x option so that the shell
closes after the script has executed.
The appearance of the GRT shell run from the command line is identical to its appearance when run from within the MySQL Migration Toolkit. All the commands and options described in Section 10.3, “Using the GRT Shell” are available when the GRT shell is invoked from the command line.
