Last modified on 27 March 2018, at 09:10

UBIK DBTool

The command line application DBTool can be used for managing UBIK.Databases (and partially also for any other database) on a Microsoft SQL Server:

Usage: DBTOOL <COMMAND> /<parameter> <value> etc.

DBTOOL RESTORE (restore a database)

Parameters

/server ... the database server (e.g. /server "mysqlserver")
/user   ... (optional) the database user (e.g. /user sa, default: sa)
/pwd    ... (optional) the database user's password (e.g. /pwd ***), not required for SPI!
/spi    ... (optional) integrated security 'true' = yes, 'false' = no (default false).
/cat    ... the new catalog's name (e.g. /cat "XYZ")
/bak    ... the backup file path (e.g. /bak "C:\SQL\BAK\XYZ01.bak")
/force  ... (optional) force existing databases and/or data/log files to be overwritten! (default: false)
/ndpath ... (optional) the path of the new data file on the server (e.g. /ndpath "C:\SQL\DATA\XYZ02.mdf")
/nlpath ... (optional) the path of the new log file on the server (e.g. /nlpath "C:\SQL\DATA\XYZ02.ldf")
/odname ... (optional) the path of the original data file on the server (e.g. /odname "XYZ01.mdf")
/olname ... (optional) the path of the original log file on the server (e.g. /originallogfilename "XYZ01.mdf")

Examples:

DBTOOL restore /server myservername /user myusername /pwd mypassword /spi false /cat mynewcatalog /bak "C:\MSSQL\Backup\mybackup.bak"

DBTOOL restore /server myservername /user myusername /pwd mypassword /spi false /cat mynewcatalog /bak "C:\MSSQL\Backup\mybackup.bak" /force false /ndpath "C:\SQL\Data\mynewcatalog.mdf" /nlpath "C:\SQL\Data\mynaewcatalog.ldf" /odname myoriginalcatalog /olname myoriginalcatalog_log

DBTOOL UBIKSET (set a UBIK setting value)

Parameters

/server  ... the database server (e.g. /server "mysqlserver")
/user    ... (optional, default: sa) the database user (e.g. /user sa)
/pwd     ... (optional, default: empty) the database user's password (e.g. /pwd ***), not required for SPI!
/spi     ... (optional, default: false) integrated security 'true' = yes, 'false' = no.
/cat     ... the catalog's name (e.g. /cat "XYZ")
/key     ... the system setting key (e.g. /key 0)
/setting ... the system setting key (e.g. /setting 0)

Example:

DBTOOL UBIKSET /server myservername /user myusername /pwd mypassword /spi false /cat mynewcatalog /key 0 /setting "\\myserver\mydatapath"


DBTOOL RUN (run a sql expression)

Parameters

/server ... the database server (e.g. /server "mysqlserver")
/user   ... (optional, default: sa) the database user (e.g. /user sa)
/pwd    ... (optional, default: empty) the database user's password (e.g. /pwd ***), not required for SPI!
/spi    ... (optional, default: false) integrated security 'true' = yes, 'false' = no.
/cat    ... the catalog's name (e.g. /cat "XYZ")
/sql    ... the expression (e.g. /sql "SELECT * FROM mytable")
/sep    ... (optional, default ";") the expression (e.g. /sep "\t")

Example:

DBTOOL RUN /server myservername /user myusername /pwd mypassword /spi false /cat mynewcatalog /sql "SELECT * from mytable"

Examples

  • RUN

dbtool RUN /sql "SELECT * FROM dbo.UST_BASECLASS" /cat "UBIK.TEST" /server "sqlserver" /user "sa" /pwd ****** /verbose false dbtool RUN /sql "update UST_SYSTEMSETTINGS set PR_VALUE='\\fileserver\UBIKData\UBIK.TEST.COPY' where PR_KEY=0" /cat "UBIK.TEST.COPY" /server "sqlserver" /user "myuser" /pwd "mypwd"

  • UBIKSET

dbtool UBIKSET /cat "UBIK.TEST:COPY" /server sqlserver /user myuser /pwd mypwd /key 0 /setting "\\fileserver\UBIKData\UBIK.TEST.COPY"

  • RESTORE

dbtool RESTORE /cat UBIK.MANUALTEST03 /server auglnz2sql /user myuser /pwd mypwd /bak "C:\MSSQL\Backup\UBIK.TEST.bak" dbtool RESTORE /cat UBIK.MANUALTEST04 /server auglnz2sql /user sa /pwd mypwd /bak "C:\MSSQL\Backup\UBIK.TEST.bak" /force true /ndpath "C:\MSSQL\Data\UBIK.TEST.COPY.mdf" /nlpath "C:\MSSQL\Data\UBIK.TEST.COPY.ldf" /odname "UBIK.TEST" /olname "UBIK.TEST_log"