Scribe for SQL Server

Backup a database

To back up a database all you need is a SQL Server user account with read permissions and access to the server. Following is the command line format for calling Scribe.

scribe backup /data_source:"connection string" /output_path:"file path" /objects:"table,data,etc." /chunk_size_mb:10 /transaction_size_mb:5 /max_thread_count:5 /skip_thread_count:"true/false"

Options

/data_source:
Data source to use, as a connection string surrounded by quotes.
/data_source:"Data Source=localhost;Initial Catalog=AdventureWorks;"

/output_path:
Output path for the generated script files. Files are named "Schema.sql", Constraints.sql, "Data0001.sql", "Data0002.sql", etc. based on the chunk size.
/output_path:"c:\output\"

/objects:
Objects for which you want to generate scripts. This is a comma-separated list of the following values:

  1. table
  2. view
  3. function
  4. storedprocedure
  5. userdefinedtype
  6. data

The default value is "table,view,function,storedprocedure,userdefinedtype,data".
/objects:table,data

/chunk_size_mb:
Determines the maximum size for data script files. Scripts use UTF-16, so file sizes are twice as big as the text in them (5-1000; default: 10).
/chunk_size_mb:25

/transaction_size_mb:
Determines the maximum size for transactions (1-50; default: 5).
/transaction_size_mb:2

/max_thread_count:
Determines maximum number of threads to allow (1-50; default: 5).
/max_thread_count:10

/skip_thread_check
At start, scribe tries to determine if the remote database server can handle multiple concurrent recordsets. If you know it can, you can save a few seconds by skipping this check (true or false; default: false).
/skip_thread_count:true

Behavior

When Scribe runs a backup operation, it first tries to determine if the remote server can handle multiple threads (connections) by attempting a schema pull with 2 threads. This process usually takes a few seconds, so if you want to save some time you can set your thread count and disable the check.

The scripts saved to the output folder include:

  • Schema.sql
    This file contains table, view, and other schema objects without foreign key constraints. This file does contain other constraints, like default column values.
  • Constraints.sql
    This file contains table foreign key constraints and is restored last.
  • Data####.sql
    These files, numbered from 0001 up to 9999 hold chunked data insert scripts. When the backup is running, each table is backed up to its own script file. When complete, Scribe then reads those files and creates these chunked data files based on the options you've set.