-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,34 @@ | ||
# mssqlPipe | ||
# mssqlPipe v1.0.0 | ||
SQL Server command line backup and restore through pipes using stdin and stdout | ||
|
||
mssqlPipe | ||
|
||
Usage: | ||
|
||
mssqlPipe [instance] backup [database] dbname [to filename] | ||
mssqlPipe [instance] restore [database] dbname [from filename] [to filepath] [with replace] | ||
mssqlPipe [instance] restore filelistonly [from filename] | ||
mssqlPipe [instance] pipe to devicename | ||
mssqlPipe [instance] pipe from devicename | ||
|
||
stdin or stdout will be used if no filenames specified. | ||
|
||
When restoring, default database and log path will be determined for SQL 2012+, otherwise will guess based on existing databases if filepath not specified. Files will be renamed like database_dat.mdf and database_log.ldf. Existing databases will _not_ be overwritten unless you use `with replace`! | ||
|
||
Examples: | ||
|
||
mssqlPipe myinstance backup AdventureWorks to AdventureWorks.bak | ||
mssqlPipe myinstance backup AdventureWorks > AdventureWorks.bak | ||
mssqlPipe backup database AdventureWorks | 7za a AdventureWorks.xz -si | ||
7za e AdventureWorks.xz -so | mssqlPipe restore AdventureWorks to c:\db\ | ||
mssqlPipe restore AdventureWorks from AdventureWorks.bak with replace | ||
mssqlPipe pipe from VirtualDevice42 > output.bak | ||
mssqlPipe pipe to VirtualDevice42 < input.bak | ||
mssqlPipe sql2008 backup AdventureWorksOld | mssqlPipe sql2012 restore AdventureWorksOld | ||
curl -u adzm:hunter2 sftp://adzm.net/backup.xz | 7za e -txz -so -si nul | mssqlPipe restore AdventureWorks | ||
|
||
If you need to do anything fancy, use the pipe verb with a devicename of your choosing and run a query manually. | ||
|
||
I was inspired by the VDI sample; and apparently so was [sqlpipe](https://github.com/duncansmart/sqlpipe) | ||
|
||
Happy piping! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters