SqlServer/PowerShell: simple test of backup and restore

The SQLServer package has taken over from SQLPS. Basic backup and restore examples on my GitHub, and the data I used to create the tables (just create the databases by hand for now).

And the screenshots as I got the hang of it…

 

Advertisements

SqlServer backup and restore

Useful commands…

–Addumpdevice…
https://msdn.microsoft.com/en-gb/library/ms188409(v=sql.110).aspx

— restore options
https://msdn.microsoft.com/en-gb/library/ms186858(v=sql.110).aspx

USE master;
GO
EXEC sp_addumpdevice ‘disk’, ‘mydiskdump’, ‘F:\ssistemp\BikeRides.Bak’;

select * from sys.backup_devices

 

restore database BikeRides
from mydiskdump
with
move ‘BikeRides’ to ‘f:\database\data\BikeRides.mdf’,
move ‘BikeRides_log’ to ‘f:\database\logs\BikeRides_log.ldf’