This document is for DBStream v1.0
Prerequisites
- Microsoft Visual C++ Redistributable for Visual Studio 2017 (x64)
- ODBC Driver v17 for SQL Server (x64)
DBStream may work as well with old versions of ODBC Driver, such as ODBC Driver v13, while we did most tests on ODBC Driver v17.
Permissions
- Member of administrators local group runs DBStream as Administrator
- sysadmin permissions on MS SQL Server
Installation
When we design DBStream, we consider ease for use as matter of priority. We compile it as a single small-size EXE file, and make it green. It means, installation is NOT needed. Come on, just copy and run. If needed, you may add the path to environment variables.
Cautions
DBStream is not file based. If restore fails in the middle ( because of power, network, etc ), the database may not be accessible permanently. We have to redo it from Zero. In the next release, we will consider to provide an optional way to keep backup file(s) in source, target or both.
Simplest Case
We want backup database TestDB in Server1, and restore it in Server2.
Step 1. Run the following command to start restore service on an available TCP port in Server2. In this case, let's assume TCP-3306 is available and not blocked by firewall.
[AppPath]>DBStream.exe -l=3306
Step 2. Run the following command in Server1 to backup
[AppPath]>DBStream.exe -d=TestDB -f="tcp://Server2:3306"
Then database streams to Server2 via TCP-3306 very quickly.
Paremeters
We keep as few parameters as possible to make it SIMPLE and EASY.
-l=TCP-Port
Start Restore service on given TCP port. It's applicable ONLY in target for restore. DBStream runs in target in restore mode which waits for incoming backup data stream. The TCP port should not be occupied by other application, and there is not firewall issue from source to target on this port. When database is restored, data and log files will be moved to the default data and log folder. So, it's not a problem that source and target have different drives or data/log folder settings.Example - Start Restore Service in target on TCP-3306. The database will be restored in RECOVERY mode.
[AppPath]>DBStream.exe -l=3306
-O=[R | N | RP | NP]
Restore databases in NORECOVERY or RECOVERY mode. It's applicable ONLY in target for restore.Value | Description |
---|---|
R | Default Value. Restore database to RECOVERY mode. If database exists, throw an error. |
N | Restore database to NORECOVERY mode. If database exists, throw an error. |
RP | Restore database to RECOVERY mode. If database exists, it gets overwritten. |
NP | Restore database to NORECOVERY mode. If database exists, it gets overwritten. |
Example - Start Restore Service in target on TCP-3306. The database will be restored in NORECOVERY mode. It uses current Windows/Domain Account for database connection.
[AppPath]>DBStream.exe -l=3306 -O=N
-d=Database-Name
The database to be streamed. It's applicable ONLY in source for backup.Example - Full backup TestDB, and stream the backup data to target(192.168.0.20) vis TCP-3306. If Restore Service is not started yet in target, it will return a timeout, then retry around 15 seconds later.
[AppPath]>DBStream.exe -d=TestDB -f="tcp://192.168.0.20:3306"
-f=TCP-Endpoint
The TCP end point in target to receive incoming backup data stream. It's applicable ONLY in source for backup.Example - Full backup TestDB, and stream the backup data to target(192.168.0.20) via TCP-3306 with 4 threads/streams in parallel. It's 1 by default, with max value 8. If DBStream runs into issue, please decrease the number. If Restore Service is not started yet in target, it will return a timeout, then retry around 15 seconds later.
[AppPath]>DBStream.exe -d=TestDB -f="4@tcp://192.168.0.20:3306"
-z=B
Enable SQL Server build-in backup compression. It's disabled by default. It's applicable ONLY in source for backup. Make sure your SQL Server Version supports backup compression.-a=B
Means it's a backup action. It's default action, if there is not a -l parameter. So, we can ignore it in command. It's applicable ONLY in source for backup.-b=[F | D | L]
Full, Differential or Log backup. It's applicable ONLY in source for backup. Yeah, it means it's possible for us to make our own Log Shipping solution without any need of backup file/share :-)
Example - Make differential backup of TestDB, and stream the backup data to target(192.168.0.20) vis TCP-3306. Make sure the according database are ready in target in NORECOVERY mode.
[AppPath]>DBStream.exe -d=TestDB -f="tcp://192.168.0.20:3306" -b=D
-u=[SQLLoginName] -p=[password]
If the Windows/Domain account could not access to database server with sysadmin privileges. You may use the SQL login instead.Example - Connect to database server by sa login, then full backup TestDB, and stream the backup data to target(192.168.0.20) vis TCP-3306.
[AppPath]>DBStream.exe -d=TestDB -f="tcp://192.168.0.20:3306" -u=sa -p=*******
-o=[C | S | N | Combination of C, S and N]
COPY_ONLY, CHECKSUM or NORECOVERY. It's applicable ONLY in source for backup. By default, COPY_ONLY, CHECKSUM and NORECOVERY are all disable.Value | Description |
---|---|
C | Backup with COPY_ONLY option. It's generally used to backup database in some read-only secondary node of AG, and some special cases. |
S | Backup with CHECKSUM option. It's generally un-necessary since the best way to check backup is a restore which is happening in target. |
N | Backup with NORECOVERY option. It's applicable ONLY for Log Backup. It's generaly for tail-log backup. |
Example - Backup TestDB with COPY_ONLY option, then stream data to POCDB8001 on TCP-3306.
[AppPath]>DBStream.exe -d=TestDB -o=C -f="tcp://POCDB8001:3306"
-S=[standby file]
Set databases is in Standby mode after backup or restore. Service Account should have enough permission to read/write the file.Example - Start Restore Service in target on TCP-3306. When database is restored, it will be in Standby mode, and generate standby file in place. Note, when one database is restored, close DBStream process. Otherwise, the standby file may be overwritten by other restore operations.
[AppPath]>DBStream.exe -l=3306 -S="c:\temp\TestDBStandby.dat"
Example - Backup TestDB, then stream data to POCDB8001 on TCP-3306. After that, TestDB in source will be in Standby mode with a standby file in place. It's generally used in cutover phase.
[AppPath]>DBStream.exe -d=TestDB -f="tcp://POCDB8001:3306" -S="c:\temp\TestDBStandby.dat"
-C=[CertificateName]
Encrypt the backup data stream by server certificate. It's applicable ONLY in source for backup. Create the certificate in source, and make sure the same certificate is available in target. Otherwise, restore will fail for sure, because it can NOT decrypt the backup stream.Example - Start Restore Service in target on TCP-3306. When database is restored, it will be in Standby mode, and generate standby file in place. Note, when one database is restored, close DBStream process. Otherwise, the standby file may be overwritten by other restore operations.
[AppPath]>DBStream.exe -d=TestDB -f="tcp://192.168.0.20:3306" -C="backupCert"
-v
Print version information.
Next Version
The next version is DBStream v1.1. Here is the new features under discussion.
- Folder name for standby, DBStream generates the file name by database name, backup type and timestamp. --Confirmed
- Optional way to keep backup copy in the storage of source, target or BOTH. --Confirmed
- Source White IP List to deny un-authorized backup stream. --Confirmed
Your suggests on the to-do list is welcome. Please contact gasql@outlook.com.
Exceptions
DBStream still serves in case of general exceptions, while the process may exit in case of critial exceptions.