Pre-requisite
The CAST Database Extractor can be run in command line (CLI) mode should you wish to automate the extract/initialize process.
When using the command line, the process consists of a set of instructions and commands contained in a batch file (.bat) file. When the batch file is executed, the Java tool (CASTDBGUI.jar) is launched and the process begins. If you are extracting a large amount of data (i.e. multiple schemas/databases or one very large schema/database), you must use a batch file that contains specific Java Heap Space configuration commands (the -Xmx command), otherwise you will likely receive out of memory exceptions. Below is an example batch file for launching the .JAR tool.
Download from extending
Download and extract - com.castsoftware.aip.extractor.sqldatabase.2.3.25-funcrel.nupkg
Please modify the following script to suit your needs and environment
*** CASTDBGUI - Example batch script (basic) starts here [batch file] ***
REM ===============================
REM EXTRACT ACTION
REM ===============================
java -Xmx1024M -cp CASTDBGUI.jar com.castsoftware.extractor.cli.DatabaseExtractor -vendor <vendor name> -driver <driver name> -url <JDBC URL> -user <username> -password <password> -parameters <database|schema>=<database/schemas for extraction>;minimal_access_mode=<dba|all>;skip_comments=<no|yes>;skip_modification_check_schema=<schemas not to test for modification> -target <path to output location - no trailing backslash> -l <path to extract log file>
REM ===============================
REM EXAMPLE
REM java -Xmx1024M -cp CASTDBGUI.jar com.castsoftware.extractor.cli.DatabaseExtractor -vendor SQLServer -driver net.sourceforge.jtds.jdbc.Driver -url jdbc:jtds:sqlserver://dbserver:1433 -user sa -password mypassword -parameters database=MYDATABASE -target D:\DBExtractor\results -l D:\DBExtractor\output_extractor.txt
REM ===============================
REM ===============================
REM INITIALIZE ACTION
REM ===============================
java -Xmx1024M -cp CASTDBGUI.jar com.castsoftware.extractor.cli.Importer -source <path to source location - no trailing backslash> -target <path to output location - no trailing backslash> -relativepaths -l <path to initialize log file>
REM ===============================
REM EXAMPLE
REM java -Xmx1024M -cp CASTDBGUI.jar com.castsoftware.extractor.cli.Importer -source D:\DBExtractor\results -target D:\DBExtractor\initialize -relativepaths -l D:\DBExtractor\output_initialize.txt
REM ===============================
*** CASTDBGUI - Example batch script (basic) ends here ***
Please modify the following script to suit your needs and environment
*** CASTDBGUI - Example batch script (using Environment variables) starts here [batch file] ***
@echo off
REM SQLExtractor folder path
set EXTRACTOR_PATH=C:\Program Files\CAST\<version>\Extractors\SQLExtractor
REM Extract Parameters
REM ==================
REM -parameters parameter value. Note that the example below is set for Oracle Server only.
REM To extract MS SQL Server/Sybase ASE, use set "EXTRACT_PARAMETERS=database=<databases for extraction>"
set EXTRACT_PARAMETERS=schema=<schemas for extraction>;minimal_access_mode=<dba|all>;skip_comments=<no|yes>;skip_modification_check_schema=<schemas not to test for modification>
REM -l parameter value
set EXTRACT_LOGFILEPATH=<path to extract log file>
REM -target parameter value, and Initialize -source parameter value
set EXTRACT_TARGET=<path to output location - no trailing backslash>
REM -driver parameter value
set EXTRACT_DRIVER=<driver name>
REM -url parameter value
set EXTRACT_URL=<JDBC URL>
REM -user parameter value
set EXTRACT_USER=<extraction user>
REM -password parameter value
set EXTRACT_PASSWORD=<extraction user password>
REM Initialize Parameters
REM ==================
REM -l parameter value
set INITIALIZE_LOGFILEPATH=<path to initialize log file>
REM -target parameter value
set INITIALIZE_TARGET=<path to output location - no trailing backslash>
java -cp "%EXTRACTOR_PATH%\CASTDBGUI.jar" com.castsoftware.extractor.cli.DatabaseExtractor -driver "%EXTRACT_DRIVER%" -url "%EXTRACT_URL%" -user "%EXTRACT_USER%" -password %EXTRACT_PASSWORD% -parameters "%EXTRACT_PARAMETERS%" -target "%EXTRACT_TARGET%" -l "%EXTRACT_LOGFILEPATH%"
SET RETURN_CODE=%ERRORLEVEL%
IF '%RETURN_CODE%' == '0' ( ECHO Extract Succeeded. Details in '%EXTRACT_LOGFILEPATH%'
) ELSE ( ECHO Extract Failed with %RETURN_CODE%. Details in '%EXTRACT_LOGFILEPATH%'
exit /B 1 ' Extract ERROR
)
java -cp "%EXTRACTOR_PATH%\CASTDBGUI.jar" com.castsoftware.extractor.cli.Importer -target "%INITIALIZE_TARGET%" -source "%EXTRACT_TARGET%" -l "%INITIALIZE_LOGFILEPATH%"
SET RETURN_CODE=%ERRORLEVEL%
IF '%RETURN_CODE%' == '0' ( ECHO Initialize Succeeded. Details in '%INITIALIZE_LOGFILEPATH%'
) ELSE ( ECHO Initialize Failed with %RETURN_CODE%. Details in '%INITIALIZE_LOGFILEPATH%'
exit /B 2 ' Initialize ERROR
)
exit /B 0
*** CASTDBGUI - Example batch script (using Environment variables) Ends here ***
Jenkins job
Create a job with
Point the batch file location
Click on save the job