DataCaster Command Line Tools
DataCaster provides a number of command line tools for administrators and users. Many of these tools duplicate functionality already available in the Web Console (
WebAdmin), or the command-line console.
Using the Command Line Tools
Each of the command line tools is a Java application, and most of these tools can be invoked using a batch file or shell script provided in the tools directory. All tools can be invoked without using launch scripts by
- setting the CLASSPATH environment variable to include datacaster.jar,
- Adding the bin directory of the java distribution to your path
- And running the command
java TOOL_CLASSNAME ARGUMENTS
For example,
=java com.applibase.db.tools.AddUser tim timpass user admin admin
With few exceptions, none of these tools can be run if the database is already opened by another program, which includes the DataCaster server or command-line console.
Create Database Tool
This tool is used to create databases. By default databases are created when used, and this command is not needed. However, it is needed in cases where the auto-creation is turned off, or to ensure database is created ahead of time.
SYNTAX
java com.applibase.db.tools.CreateDatabase database_name [username passwd]
EXAMPLE
java com.applibase.db.tools.CreateDatabase mydb admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task. By default, any authenticated user can create databases. However, only administrative users can create databases when the default database creation mode is disabled.
Drop Database Tool
This tool is used to drop databases.
SYNTAX
java com.applibase.db.tools.DropDatabase database_name [username passwd]
EXAMPLE
java com.applibase.db.tools.DropDatabase mydb admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task. Only an administrator, or database owner can drop a database. A database owner is the user who created the database.
Add User Tool
This tool adds a new user and assigns a database password for the new user. Only administrators can add new users.
SYNTAX
java com.applibase.db.tools.AddUser username password admin|user [ adminuser adminpasswd ]
EXAMPLE
java com.applibase.db.tools.AddUser tim timpass user admin admin
If the optional adminuser and adminpasswd are not specified, you will be prompted for a login name and password that is authorized for this task.
Change Password Tool
This tool lets a user or administrator change database connection passwords.
SYNTAX
java com.applibase.db.tools.ChangePasswd username [ newpasswd ] [ username password ]
EXAMPLE
java com.applibase.db.tools.ChangePasswd tim admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Store Starup Password Tool
This command line utility is used to set the password in a file that is needed to startup the DataCaster server. Without this password in a file, the datacaster server cannot be started with Tomcat on Linux. On Windows you will be prompted for the username and password on startup, if this information is not stored.
SYNTAX
java com.applibase.db.server.tools.SetStartupPasswd
For this tool, you will be prompted for all necessary parameters.
Check Index Tool
This tool checks indexes by iterating the keys and tuples and ensuring all data is in the correct place and index structure is intact
SYNTAX
java com.applibase.db.tools.CheckIndex database_name table_name index_name [ adminuser adminpasswd ]
EXAMPLE
java com.applibase.db.tools.CheckIndex mydb tim.mytable mytable_PRIMARY_KEY admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task. Only administrators can run CheckIndex.
Check Table Tool
This tool is run to check the table max tuple id and size by iterating the main index. This is normlly done after recovery, but may be required in a few other cases to ensure the subsequent inserts have no issues.
SYNTAX
java com.applibase.db.tools.CheckTable database_name table_name index_name [ adminuser adminpasswd ]
EXAMPLE
java com.applibase.db.tools.CheckTable admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task. Only administrators can run the CheckTable tool.
Dump (Archive) Tool
This tool does a dump, or archive, of an entire database, so that it can be restored from the archive later if needed.
SYNTAX
java com.applibase.db.tools.Dump database_name [username passwd]
EXAMPLE
java com.applibase.db.tools.Dump mydb admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Restore Database Tool
This tool is used to restore a database from an archive.
SYNTAX
java com.applibase.db.tools.RestoreDatabase database_name date
EXAMPLE
=java com.applibase.db.tools.RestoreDatabase mydb =
The date field is optional and can be specified upto required degree in YY-MM-DD-HHMM format. If not specified, the most recent archive is restored. The user will be prompted for a login name and password that is authorized for this task
Run Query Tool
This command line tool executes a single query from a file and prints the result to standard output.
SYNTAX
java com.applibase.db.tools.ExecuteQuery query_file database_name [username passwd [schema_name]]
EXAMPLE
java com.applibase.db.tools..ExecuteQuery select1.sql mydb admin admin
If the optional username and password are not specified, you will be prompted for a login name and password.
Run Script Tool
This command line tool executes a single script from a file and prints the result to standard output.
SYNTAX
java com.applibase.db.tools.ExecuteSqlScript script_file database_name [username passwd [schema_name]]
EXAMPLE
java com.applibase.db.tools..ExecuteSqlScript script1.sql mydb admin admin
If the optional username and password are not specified, you will be prompted for a login name and password.
List Users Tool
This tool lists all the users configured for access to the database.
SYNTAX
java com.applibase.db.tools.ListUsers [username passwd]
EXAMPLE
java com.applibase.db.tools.ListUsers admin admin
Only administrators can list users. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Optimize Lucene Index Tool
This tool is used to optimize the Lucene search index for a table.
SYNTAX
java com.applibase.db.tools.OptimizeLuceneIndex database_name table_name [username passwd]
EXAMPLE
java com.applibase.db.tools.OptimizeLuceneIndex mydb mytable admin admin
Onlu administrators are authorized to optimize Lucene indexes. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Print Index Tuples Tool
This tool is used to print tuples in a range from an index, typically for debugging purposes.
SYNTAX
java com.applibase.db.tools.PrintIndexTuples database_name table_name index_name start_key end_key [username passwd]
EXAMPLE
java com.applibase.db.tools.PrintIndexTuples mydb mytable mytable_PRIMARY_KEY 100 200 admin admin
The start key and end key are string values converted to the data type of the first column of the index key columns. Only the first column in a multi-column index can be specified in this way.
Only administrators can print index tuples. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Print Index Page Tool
This tool is used to print BTree Index pages, useful for debugging BTree index problems.
SYNTAX
java com.applibase.db.tools.PrintPage database_name table_name index_name page_number [username passwd]
EXAMPLE
java com.applibase.db.tools.PrintPage mydb mytable mytable_PRIMARY_KEY root admin admin
The index page number, or "root" can be used to get the root page. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Print System Catalog Table Tool
This tool is used to print a table from a database system catalog (DEFINITION_SCHEMA) table.
SYNTAX
java com.applibase.db.tools.PrintCatalogTable database_name catalog_name table_name [ adminuser adminpwd ]
EXAMPLE
java com.applibase.db.tools.PrintCatalogTable mydb home TABLES admin admin
Only administratove users can print system catalogs. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Print Transaction Log Tool
This tool is used to print transaction log messages for debugging purposes.
SYNTAX
java com.applibase.db.tools.PrintTransactionLog database_name num_from_end [ -s search_string ] [ user passwd ]
EXAMPLE
java com.applibase.db.tools.PrintTransactionLog mydb 1000 admin admin
Only administratove users can print transaction logs. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Remove User Tool
This tool is used to remove users.
SYNTAX
java com.applibase.db.tools.RemoveUser username [adminusername adminpasswd]
EXAMPLE
java com.applibase.db.tools.RemoveUser tim admin admin
Only administrators can remove users. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Repair Index File Tool
This tool is used to to repair damaged index files.
SYNTAX
java com.applibase.db.tools.RepairIndex database_name catalog_name table_name index_name [ adminuser adminpwd ]
EXAMPLE
java com.applibase.db.tools.RepairIndex mydb admin admin
Only administrators can repair index files. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Repair Definition Schema Index File Tool
This tool is used to to repair damaged definition schema index files.
SYNTAX
java com.applibase.db.tools.RepairDSIndex database_name catalog_name table_name index_name [ adminuser adminpwd ]
EXAMPLE
java com.applibase.db.tools.RepairDSIndex mydb home COLUMNS COLUMNS_PRIMARY_KEY admin admin
Only administrators can repair index files. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Repair Log Tool
This tool is used to repair damaged log files.
SYNTAX
java com.applibase.db.tools.RepairLog database_name [username passwd]
EXAMPLE
java com.applibase.db.tools.RepairLog mydb admin admin
Only administrators can repair logs. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Roles Tool
This tool is used to add, remove and list roles for a user.
SYNTAX
java com.applibase.db.tools.Roles (add username rolename) | (remove username rolename) | (list username) [ adminuser adminpasswd ]
EXAMPLE
java com.applibase.db.tools.Roles add tim manager admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Replicate Remote Database Tool
This tool is used to replicate a remote database.
SYNTAX
java com.applibase.db.tools.ReplicateRemoteDB local_database remote_url start_time [ adminuser adminpwd ]
EXAMPLE
java com.applibase.db.tools.ReplicateRemoteDB dcp://source_hostname:9999/TxLog/db_name 0 admin admin
A start_time value of 0 begins replicating the log from the current time. A atart_time value of -10 begins replication of the log from the first transaction log entry available in the source table. If a positive start_time is specified, the log is replicated starting from the specified time.
The command line replication tools prints the timestamp of the last log event applied. This can be used to resume replication if the replication process is terminated for any reason.
Only administrators can replicate databases. If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Set Preference Tool
This tool is to set or view a preferences parameter. Preference parameters are used fro a number of configuration purposes.
SYNTAX
=java com.applibase.db.tools.SetPreference"
+ " key [ value [ system|user ] ]=
EXAMPLE
java com.applibase.db.tools.SetPreference conf.dir
The above prints the current value of the preference parameter conf.dir
Add Remote Access Tool
This tool is used to add a new access to a remote server, to allow a user to authenticate at the individual user level.
SYNTAX
java com.applibase.db.tools.AddRemoteAccess server local_user remote_user password [ adminuser adminpasswd ]
EXAMPLE
java com.applibase.db.tools.AddRemoteAccess myserver tim tim_remote timpass2 admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Remove Remote Access Tool
This command line utility is used to remove a remote access password.
SYNTAX
java com.applibase.db.tools.RemoveRemoteAccess server local_user [ adminuser adminpasswd ]
EXAMPLE
java com.applibase.db.tools.RemoveRemoteAccess myserver tim admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Add Remote Server Tool
This command line utility is used to add a new remote client, to allow all users on that client to authenticate at the server-level, instead of authenticating each individual user.
SYNTAX
java com.applibase.db.tools.AddRemoteServer server password [ adminuser adminpasswd ]
EXAMPLE
java com.applibase.db.tools.AddRemoteServer myserver svrpasswd admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.
Remove Remote Server Tool
This command line utility is used to remove a remote server access setup at server level. Server level access allows all users on the remote client system to authenticate at the server-level, instead of authenticating each individual user.
SYNTAX
java com.applibase.db.tools.RemoveRemoteServer server [ adminuser adminpasswd ]
EXAMPLE
java com.applibase.db.tools.RemoveRemoteServer myserver admin admin
If the optional username and password are not specified, you will be prompted for a login name and password that is authorized for this task.