Script này hỗ trợ các bạn restore toàn bộ databse chỉ trong một lần bấm
Trước khi Restore nhớ tạo thư mục như sau
C:\DB
Sau khi tạo xong nhớ để toàn bộ database vào đó rồi mới chạy Script nhé.
Các bạn có thể xem toàn bộ Script ở bên dưới:
Trước khi Restore nhớ tạo thư mục như sau
C:\DB
Sau khi tạo xong nhớ để toàn bộ database vào đó rồi mới chạy Script nhé.
USE [master]
RESTORE DATABASE [AgengSession] FROM DISK = N'C:\DB\AgengSession.bak' WITH FILE = 1, MOVE N'AgengSession' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\AgengSession.ndf', MOVE N'AgengSession_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\AgengSession_log.ldf', NOUNLOAD, STATS = 5
RESTORE DATABASE [BettingGameCore] FROM DISK = N'C:\DB\BettingGameCore.bak' WITH FILE = 1, MOVE N'BettingGameCore' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\BettingGameCore.ndf', MOVE N'BettingGameCore_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\BettingGameCore_log.ldf', NOUNLOAD, STATS = 5
RESTORE DATABASE [BettingGameCore.History] FROM DISK = N'C:\DB\BettingGameCore.History.bak' WITH FILE = 1, MOVE N'BettingGameCore.History' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\BettingGameCore.History.ndf', MOVE N'BettingGameCore.History_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\BettingGameCore.History_log.ldf', NOUNLOAD, STATS = 5
RESTORE DATABASE [CskhSession] FROM DISK = N'C:\DB\CskhSession.bak' WITH FILE = 1, MOVE N'CskhSession' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\CskhSession.ndf', MOVE N'CskhSession_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\CskhSession_log.ldf', NOUNLOAD, STATS = 5
RESTORE DATABASE [DbitSecurityService] FROM DISK = N'C:\DB\DbitSecurityService.bak' WITH FILE = 1, MOVE N'DbitSecurityService' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\DbitSecurityService.ndf', MOVE N'DbitSecurityService_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\DbitSecurityService_log.ldf', NOUNLOAD, STATS = 5
RESTORE DATABASE [DWConfiguration] FROM DISK = N'C:\DB\DWConfiguration.bak' WITH FILE = 1, MOVE N'DWConfiguration' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\DWConfiguration.ndf', MOVE N'DWConfiguration_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\DWConfiguration_log.ldf', NOUNLOAD, STATS = 5 GO
Các bạn có thể xem toàn bộ Script ở bên dưới: