title: sql server Restore Database
body: <p>Backed up a database from my hosting account. Using the following script to restore.</p>
  
  <pre><code>RESTORE DATABASE [XYZ] 
  FROM  DISK = N'E:\Online Website Backup\_db_backups\XYZ.bak' 
  WITH  FILE = 1,  MOVE N'XYZ' TO N'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\XYZ.mdf',  
  MOVE N'XYZ_log' TO N'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\XYZ.LDF',  
  MOVE N'sysft_XYZ' TO N'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\XYZ',  
  NOUNLOAD,  REPLACE,  STATS = 10
  GO
  </code></pre>
  
  <p>Getting the following errors</p>
  
  <pre><code>Msg 3634, Level 16, State 1, Line 1
  The operating system returned the error '5(Access is denied.)' while attempting 'OpenForRestore' on 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\XYZ\SQL.HDR'.
  Msg 3156, Level 16, State 2, Line 1
  File 'sysft_XYZ' cannot be restored to 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\XYZ'. Use WITH MOVE to identify a valid location for the file.
  Msg 3119, Level 16, State 1, Line 1
  Problems were identified while planning for the RESTORE statement. Previous messages provide details.
  Msg 3013, Level 16, State 1, Line 1
  RESTORE DATABASE is terminating abnormally.
  </code></pre>
  
  <p>Thanks.</p>