Difference between revisions of "MS SQL Restore a database on your Windows VPS"

From Hostek.com Wiki
Jump to: navigation, search
(Created page with "==Restore a MS SQL database on your Windows VPS== On a Windows VPS, you can restore a database with MS SQL Management Studio. Please follow these steps to complete a restore...")
 
(Restore a MS SQL database on your Windows VPS)
 
Line 3: Line 3:
 
On a Windows VPS, you can restore a database with MS SQL Management Studio.  Please follow these steps to complete a restore.
 
On a Windows VPS, you can restore a database with MS SQL Management Studio.  Please follow these steps to complete a restore.
  
#Go to Start--->All Programs--->Microsoft SQL Server--->SQL Server Management Studio
+
*Go to Start--->All Programs--->Microsoft SQL Server--->SQL Server Management Studio
#Expand Databases
+
* Expand Databases
#Click on New Query
+
* Click on New Query
#Run the following code:
+
* Run the following code:
 
<pre>ALTER DATABASE [DB_NAME_HERE] SET SINGLE_USER WITH NO_WAIT</pre>
 
<pre>ALTER DATABASE [DB_NAME_HERE] SET SINGLE_USER WITH NO_WAIT</pre>
 
Replace [DB_NAME_HERE] with the actual database name
 
Replace [DB_NAME_HERE] with the actual database name
#Click Execute
+
* Click Execute
#Under databases, right click on the database.  Select Tasks--->Restore--->Database
+
* Under databases, right click on the database.  Select Tasks--->Restore--->Database
#Select the "From Device" button
+
* Select the "From Device" button
#Click on the "..."
+
* Click on the "..."
#Click on Add
+
* Click on Add
#Navigate to your backup file and select it
+
* Navigate to your backup file and select it
#Click on Options on the far left.
+
* Click on Options on the far left.
#Select Overwite the existing database
+
* Select Overwite the existing database
#Click into the Restore As path
+
* Click into the Restore As path
#Add an extra \ to each \ in the path.  For example C:\Backup\MSSQL\Backups would become C:\\Backup\\MSQL\\Backups
+
* Add an extra \ to each \ in the path.  For example C:\Backup\MSSQL\Backups would become C:\\Backup\\MSQL\\Backups
#Repeat the above step for the Log path as well
+
* Repeat the above step for the Log path as well
#Click Ok
+
* Click Ok
#Once the restore is complete, open New Query again
+
* Once the restore is complete, open New Query again
#Run the following code:  
+
* Run the following code:  
 
<pre>ALTER DATABASE [DB_NAME_HERE] SET MULTI_USER WITH NO_WAIT</pre>
 
<pre>ALTER DATABASE [DB_NAME_HERE] SET MULTI_USER WITH NO_WAIT</pre>
 
Replace [DB_NAME_HERE] with the actual database name
 
Replace [DB_NAME_HERE] with the actual database name
#Click Execute
+
* Click Execute
  
 
Your database has now been restored and set back to multi-user mode.
 
Your database has now been restored and set back to multi-user mode.
  
 
[[Category:Windows-VPS]]
 
[[Category:Windows-VPS]]

Latest revision as of 20:42, 27 April 2013

Restore a MS SQL database on your Windows VPS

On a Windows VPS, you can restore a database with MS SQL Management Studio. Please follow these steps to complete a restore.

  • Go to Start--->All Programs--->Microsoft SQL Server--->SQL Server Management Studio
  • Expand Databases
  • Click on New Query
  • Run the following code:
ALTER DATABASE [DB_NAME_HERE] SET SINGLE_USER WITH NO_WAIT

Replace [DB_NAME_HERE] with the actual database name

  • Click Execute
  • Under databases, right click on the database. Select Tasks--->Restore--->Database
  • Select the "From Device" button
  • Click on the "..."
  • Click on Add
  • Navigate to your backup file and select it
  • Click on Options on the far left.
  • Select Overwite the existing database
  • Click into the Restore As path
  • Add an extra \ to each \ in the path. For example C:\Backup\MSSQL\Backups would become C:\\Backup\\MSQL\\Backups
  • Repeat the above step for the Log path as well
  • Click Ok
  • Once the restore is complete, open New Query again
  • Run the following code:
ALTER DATABASE [DB_NAME_HERE] SET MULTI_USER WITH NO_WAIT

Replace [DB_NAME_HERE] with the actual database name

  • Click Execute

Your database has now been restored and set back to multi-user mode.