![]() ![]() ![]() On Windows 2008 you can use the timeout.exe command. On Windows 2003 you can get sleep.exe from the Windows 2003 Resource Kit to do this. After that though, you will need to wait for SQL Server to actually start up before issuing any commands. To do this, use the start command in front of it. ![]() To get the script to continue after the sqlservr -m command, you need to "background" the command. I also want to restore the other 3 system databases using command line scripts like this one.Ĭan someone please advice me how I need to go on? I've already noticed that restoring the temdb is not so easy, but there has to be a way.Īs mentioned in the comments - you don't backup/restore TEMPDB. So in order to execute the last 2 commands I need to separate the script into 2 smaller scripts, and run them one after the other.ĭoes anyone has an idea on how I can merge them into one single script that runs completely without any interruption? ![]() Sqlcmd -Slocalhost -E -Q "restore database master from disk='c:\master.bak' WITH REPLACE"Īfter the execution of the sqlservr -m command (used to start the server instance in single-user mode, which is only necessary when restoring the MASTER database), the script stops. Set dbdirectory=C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATAĬd C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn I've already done some testing myself (on restoring the master database) with the following commad line script as a result: ::set variables Can someone give me some advice on how to restore the 4 system databases (master, msdb, model, tempdb) of a sql server 2008 please? ![]()
0 Comments
Leave a Reply. |