Restore a database

Restore mode will read previously created T-SQL scripts and restore them into an existing SQL Server database. It defaults to first erasing the destination database (drops all objects), but you can turn that off.

SQribe is a tool for fast and easy database backup and restore. So syncing or merging differences is not part of SQribe's feature set at this time.

Command syntax

sqribe restore [options]

Example restore command

sqribe restore /script_path:"~/Desktop/sqribe-backup" /data_source:"server=localhost;database=AdventureWorks2017;user id=aw2017user;password='abracadabra';" /objects:"all"

Troubleshooting

Backup and restore operations generate an activity log that contains more specific information about the last job run. In the case of SQL Server exceptions, you can look there to see the details of the error to help you troubleshoot. The file is in markdown format, so any standard text editor should be able to open it.

The file is in SQribe data folder (in your user home folder) at ~/sqribe/, and named sqribe-log.md. You can suppress the creation of this file with the /logging option mentioned above.

Restore options

The following command line arguments are available for restore operations:

/beep_on_completion:
Makes a beep sound when a SQribe operation completes (default: true).

/confirm_start:
Require a keypress to begin a restore (default: true).

/console_dark_mode:
When enabled output is light in color; dark when disabled (default: true).

/data_source:
Standard SQL Server connection string in quotation marks.

Note: the server address must be a network routable address, like "localhost", an IP address, a domain name, etc., with an optional port appended with a comma as is standard. SQribe will not work with LocalDb instances as they are a subset of SQL Server used for embedded applications and do not provide access to tools like SQribe or even Microsoft's own SSMS.

/erase_database:
Prior to restore, drop all scriptable objects  (default: false).

/logging:
Log activity and exceptions for the most recent use of SQribe to file named sqribe-log.md in the sqribe data folder (in your user home folder) at ~/sqribe/ (default: true). Note: this will include private info, like connection strings with passwords.

/max_thread_count:
Maximum number of thread to allow (1-25; default: number of logical processors in the machine).

/objects:
Comma-separated list of objects to restore (default is "all"):

all = all supported object types and data
schema = all supported object types but no data

— OR —

sc = schema collections
table = tables
pkc = table primary key constraints
index = table indexes
fkc = table foreign key constraints
cc = table check constraints
ftc = fulltext catalogs
view = views
udf = user-defined functions
usp = stored procedures
tr = triggers
uddt = user-defined data types
udtt = user-defined table types
dt = default types
xsc = XML schema collections
xp = extended properties
data = table data

/script_path:
Path for source script files (e.g. "~/Desktop/backups").

/suppress_start_warnings:
When enabled warning messages will be displayed for output script file overwrites (default: false).

/table_protection:
Specify schema and table names in a comma-separated list to skip drops and data restoration, for example "dbo.DatabaseLog,dbo.ErrorLog". Protected items can end with a wildcard asterisk (*), for example "dbo.Error*".

NOTE: Default restore behaviors can be changed by creating a file named "restore-defaults.json" in the sqribe data folder (in your user home folder) at ~/sqribe/. All properties except "data_source" and "mode" can be set here.