You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would assume so. I haven't scripted it but I do it manually with the following:
ALTERDATABASE"THE_DB"SET OFFLINE WITH ROLLBACK IMMEDIATE
RESTORE DATABASE "THE_DB"FROM DISK ='some\path\to\my.bak' WITH REPLACE,STATS=1ALTERDATABASE"TH_DB"SET ONLINE
You can run this query to see the restore progress
SELECT
session_id as SPID, command, a.textAS Query, start_time, percent_complete,
dateadd(second,estimated_completion_time/1000, getdate()) as estimated_completion_time
FROMsys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) a
WHEREr.commandin ('BACKUP DATABASE','RESTORE DATABASE')
If you take a look at mssql-cli -h the -i or --input_file parameters should let you pass in a script.
Can MSQL-CLI be used to automate the restore of a DB ?
The text was updated successfully, but these errors were encountered: