Examples - SNU
To completely build (or rebuild) a SuperSTAR database using the settings in the project XML file, use the following command:
snu –create –insert <project>
Replace <project>
with the filename of the project file. This must be the full path if it is not located in the current directory. For example:
snu -create -insert D:\SuperCHANNEL\MyProject.xml
Source Database Login Password
If the source database requires a login password, then you will need to specify this. The SuperCHANNEL GUI does not save this to the project file.
There are three options for specifying the password:
Use the
-sp
parameter on the command line. You will be prompted to enter the password. For example:TEXTsnu -create -insert -sp D:\SuperCHANNEL\MyProject.xml
Use the
-sp
parameter and specify the password on the command line. For example:TEXTsnu -create -insert -sp:MyPassword D:\SuperCHANNEL\MyProject.xml
Edit the project file so that it includes the password. To do this you need to open the project file in a text editor and locate the
<DATABASE />
element that identifies the source database. This will look something like this:XML<DATABASE LOCATION="jdbc:sqlserver://localhost;databaseName=Retail Banking" METHOD="SOURCE" SCHEMA="dbo" USERNAME="STRdbuser"/>
Add the
PASSWORD="<password>"
. attribute. For example:XML<DATABASE LOCATION="jdbc:sqlserver://localhost;databaseName=Retail Banking" METHOD="SOURCE" SCHEMA="dbo" USERNAME="STRdbuser" PASSWORD="MyPassword"/>
Make sure you are editing the
<DATABASE />
element for the source database (the one with the attributeMETHOD="SOURCE"
). There will also be a<DATABASE />
element for the target database (with the attributeMETHOD="TARGET"
).For security reasons, the SuperCHANNEL GUI never saves passwords to the project file. If you subsequently open the project in the GUI and save your changes, any password you have manually added to the project file will be stripped out during the save.
Out of these three options, the first one is the most secure, because the password itself is never displayed on screen. However, it is not a suitable strategy for automation because it requires the user to input the password when SNU is run. If you are implementing an automated solution then you will need to use one of the other methods.
As both of these methods require the database password to be stored in plain text (either in your script file that executes SNU or in the project file) you will need to take care to protect your password security by restricting read access to these files.
Redirecting Log Output
When you run SNU it outputs all log and error messages to the screen.
You may prefer to save this information to a log file. To do this, simply redirect the log and error messages to text files.
For example, the following command redirects logging information to a file called output.log and error messages to a file called output.err. No output will be written to the command window.
snu -create –insert D:\SuperCHANNEL\MyProject.xml 1>output.log 2>output.err
Silent Mode
By default, SNU outputs details of every cleansing action to the standard output (or to the text file if the log information is being redirected). For example:
If there are thousands of cleansing errors and associated actions taken on them, the log file can grow very large. In this situation it becomes desirable to exclude the cleansing action information from the log file.
To do this, use the -silent
parameter to run SNU in silent mode. For example:
snu -create -insert -silent D:\SuperCHANNEL\MyProject.xml
Command Abbreviations
Some of the command line options can be abbreviated. For example you can specify -c
and -i
instead of -create
and -insert
:
snu -c -i -sp D:\SuperCHANNEL\MyProject.xml
For a full list of command line options, see Command Line Options - SNU.
Example: Running SNU from a Batch File
When automating the database build process, you may need to call SNU from a bacth file. The following is an example of a Windows batch file that you could use to run SNU.
This file redirects the log output to output and error files, and writes the current date and time to the start and end of each log file.
@echo off
echo Currently Building Database
echo ---------------------------------
echo.
echo Please wait...
set StartDateTime=%date% %time%
echo %date% %time% > Project.xml.log
call snu -c -i project.xml 1>project.xml.log 2>project.xml_err.log
echo. >> projectxml.log
echo Start %StartDateTime% >> project.xml.log
echo Finish %date% %time% >> project.xml.log
echo.
echo Build Complete
echo.