.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Restore script that previously worked now fails half way through restore

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :SharePoint


SharePoint1 – Farm installation = (Windows Server 2008 STD SP2 & SharePoint Foundation 2010 v14.0.4763.1000 ) + (Windows Server 2008 STD SP2 & SQL Server 2008)

SharePoint2 – Standalone installation = (Windows Server 2008 STD SP2 & SharePoint Foundation 2010 v14.0.4763.1000)

For months I have successfully used this combination of scripts to backup and restore my SharePoint site, since migrating to a new server the restore no longer works.

I have them on scheduled tasks, the backup running at 1am and the restore running at 4am.


Backup Script:


More Related Resource Links

cannot restore a site if it has been restored previously

Hi there, I just found out that if I have restored a site but then realized that I need to put it on a different URL, I can't add it anymore. Here's what happen ... We have 2 SP servers, the live one and the test one: - live --> sp.company.org - test --> sharepoint2010 The plan was to backup the site collection from the live one and restore it on the test server. The site in question called mysite and the current URL (on live server) is http://sp.company.org/sites/mysite Using SharePoint2010 Management Shell, I did: restore-spsite -identity http://sharepoint2010 -path c:\backup\mysite.bak And I realized that mysite was restored at the root of http://sharepoint2010 ... I thought it will re-create the path (/sites/mysite). So I delete that '/' collection and tried to restore it again to a different path. I ran: restore-spsite -identity http://sharepoint2010/sites/mysite -path c:\backup\mysite.bak --> note that the mysite part is a non-existent path to avoid using -force switch but then it gave an error: Restore-SPSite : The operation that you are attempting to perform cannot be completed successfully.  No content databases in the web application were available to store your site collection.  The existing content databases may have reached the maximum number of site collections, or be set to read-only, or be offline, or may already contain a copy of t

Error when running an SQL script to restore a database on SQL Server 2008 R2 Express

Hi, At work, I use SQL Server 2008 Express running on Windows XP Professional Service Pack 3. At home, I also use SQL Server 2008 Express running on Windows XP Professional Service Pack 3. Whenever I do work on the database at work, I usually restore the database at home (or vice versa) I have been using the following SQL scripts to back up the database and to restore the same database (at work or at home). BackupRealEstate.sql USE Master BACKUP DATABASE [RealEstate] TO DISK = N'F:\My Documents\My Database\RealEstate.bak' WITH NOFORMAT, INIT, NAME = N'RealEstate-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO RestoreRealEstate.sql USE Master RESTORE DATABASE [RealEstate] FROM DISK = N'F:\My Documents\My Database\RealEstate.bak' WITH  FILE = 1, NOUNLOAD, REPLACE, STATS = 10 GO Everything worked fine until I replaced my 8yo home computer with a newer and faster one. My new home computer is running Windows 7 Home Premium and I use the latest SQL Server 2008 R2 Express. When I tried to run the above restore SQL script, I got the following error message: Msg 3101, Level 16, State 1, Line 2 Exclusive access could not be obtained because the database is in use. Msg 3013, Level 16, State 1, Line 2 RESTORE DATABASE is terminating abnormally. There was no other application/process using this database. Can someone please help me? Regards,

BackUp and Restore through Central Administration fails




I took the backup through Central Administration.


Now I installed MOSS as Server farm installation on 2 different servers.I mean, one is Application server and the second one is the Database server.

While Restoring the Backup :

I could not connect to the Database server.

But if I restore the same backup on a stand alone/Single server installation of MOSS, I could succeed.


Hence for a server farm installation of MOSS on 2 different server, Why I could not connecct to the Database server,while restoring ?


Is there any special configuration I need to configure for Database server Access.


can anybody tell me, the step by step restore process of a backup through Central Administration for the Server farm installation(2 different servers in the farm.).



AS Database Restore fails: OLAPinfo element .... (namespace) cannot appear under BackupLog. (Micros


We encounter this problem when restoring a backup from the SAME sql server version (2008R2):

TITLE: Microsoft SQL Server Management Studio

The OlapInfo element at line 1, column 445 (namespace ) cannot appear under BackupLog.




Restore Database Backup using SQL Script


I need to backup a database using query.Please help me.

BACKUP WITH CHECKSUM against an encrypted database - restore fails


I have five databases sitting on a new SQL 2008 R2 server.  The databases originated on SQL Server 7, went through both a SQL 2000 and a SQL 2005 upgrade, and last month were migrated to this new SQL 2008 server.  All five databases are in SQL 2005 compatibility mode.  All five databases are using SQL 2008's full database encryption.

Over the weekend, I changed the page verification of these databases from "torn page" to "checksum".  Nightly full backups were completed on Sunday night, and successfully restored to our reporting and hot-standby servers.  Yesterday, I added the WITH CHECKSUM keyword to the backup jobs.  Nightly full backups ran last night, completed successfully.  The restores of those same backups to reporting and standby FAILED, with several assertion failure messages.

Today, I created a brand new database, in SQL 2008 compatibility mode and "checksum" page verification.  BACKUP WITH CHECKSUM produces a restorable backup.  I then enabled encryption on that database, and did the same BACKUP WITH CHECKSUM operation.  The resulting backup cannot be restored, NOT EVEN on the same server.  The restore appears to complete, giving the normal output stating how many pages it processed, but the "recovery" portion of the restore throws an exception.

Smo Restore.ReadFileList(server) fails


I am writing a C# application to backup and restore a SQL Server database from one instance to another. I am trying to get the logical names of the data and log files of the database from the .bak file and it fails at the statement "DataTable dt = restore.ReadFileList(server);" with the error {"Incorrect syntax near the keyword 'WITH'.\r\nIncorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon."}

Is there anything I have to do before I can use the restore.ReadFileList method ? The logical names of the database files have '.' and '_' in the names, "DBName_data.mdf" and "DBName_log.ldf" . Could it be the reason for this error ?

I tried restore from SQL Server Express Instance and SQL Server Full Version to SQL Server Full Version. Both of the scenarios resulted in the same error and Restore could not complete.

SQL 2008 Fails to restore a database



I have a Windows 2008 R2 Server running SQL2008 (not R2).

I havew been trying to restore a database using the Restore Database Tool in Enterprise Manager. That is Right click the database, select Tasks ->Restore ->Database.

On the General page I have selected my source as a Database Backup and selected the file location. I have selected the only backup set in the file.

On the General Tab I have selected the 'Overwrite the existing Database (with Replace)'

When I click the OK button to action my selections I receive the following Error message:

Restore failed for Server 'WIN2008SQL'.  (Microsoft.SqlServer.SmoExtended)
System.Data.SqlClient.SqlError: File 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MAESTRODB.ndf' is claimed by 'MAESTRO_INDEX_DATFILE'(4) and 'MAESTRO_DATFILE'(3). The WITH MOVE clause can be used to relocate one or more files. (Microsoft.SqlServer.Smo)

I have not been able t ofind a solution to this...


Restore of database backup done by script failed



In my C++ application (with MFC) developed in Visual Studio 2010 the user has an option to take a backup of the current database. This is done by executing a Stored Procedure which takes the database name and backup file name as parameters:

CREATE PROCEDURE sp2_backup_database @DATABASE nvarchar(100), @FILENAME nvarchar(260)
  Exec ('Backup Database [' + @DATABASE + '] TO  DISK = ''' + @FILENAME + '''
      '-Full Database Backup'', SKIP, NOREWIND, NOUNLOAD, STATS = 10')
   Return @@ERROR

All this works fine, the backup is done properly by the SP.
What is bothering me is that when trying to make a restore of the database from the backup file the restore fails with a message like (freely translated from Swedish):

"Restore failed for [the SQL Server]. (Microsoft.SqlServer.SmoExtended)
Additional information:
System.Data.SqlClien.SqlError: RESTORE can not process the database [Database-name] since it's in use by this process. It's recommended to use master database during this task."

The only way I can

Logshipping - Restore fails - missing .tuf file

I have had successful log shipping enabled on SQL 2005, SP3 on server A and B.  I had to remove secondary db to load localized reports, and when I try to re-enable or even reconfigure Log Shipping from scratch, the .tuf file is not being created in the backup and copy folders with the log files, therefore the trn files are skipped and cannot be applied.  I have completed similar steps on alternate SQL 2005 boxes  with SP3 Hot Fix 4 producing similar results.

SQL Server Backup and Restore (video)

Restore your full backup, then run a few queries before you keep restoring transaction logs. Brent shows how to use the Standby option for restores.

In this five minute video, Brent demonstrates how to do it by creating a database, populating data, and then showing what disaster recovery is like by doing RESTORE WITH STANDBY.

Restore - Cube Analysis Services 2005

Hi, I'm from Brazil. Sorry for my English. I made a backup for my cube that has more than 2 GB, but de backup is created with only 50 mb. The backup don't showed erro message. I restored this backup without erro, but when I tryed query the cube, i receive this message: The query could not be processed: o File system error: The following file is corrupted: Physical file: \\?\C:\SQL Server\MSSQL.2\OLAP\Data\teste.59.db\"Nome_Servidor" - "Nome_Database".190.cub\Fato Inadimplencia Safra Contrato.190.det\Fato Inadimplencia Safra Contrato.167.prt\172.fact.data. Logical file . Someone can help? I realy need make this backup.Fabrício França Lima | MCP, MCTS, MCITP | Visite meu site: http://fabriciodba.spaces.live.com/ | Dicas de artigos SQL: Siga-me no twitter @fabriciodba.

SMO Backup and Restore Help

Hello Friends, I am new to SMO, Till now I have only worked with Selct,Insert/update Queries.. Now I want to Implement some backup and restore feature for my application. I looked at some documents of SMO and found it is possible using SMO. First of all I will explain my situation. My application wants to store data belongs to different companies(which is maintained with in application) in to single database server, Sql server 2008. I am planning to use Partition Scheme function and create filegroup for each company. Advantage here is, taking backup of each company will be easy. I am generating primary key for each table without taking into consideration of companies. In other words Particular table's ID 1,2 belongs to Company A, 3 Belongs to Company B and 5 belongs to Company A... But these data will be split in to Different filegroups using Company ID.(horizontal partitioning) Ok... Now the Problem.. My backup for a particular company was taken successfully. Now I want Restore function. When I am trying to restore this backup to somewhere else. Target database may or may not contain Companies installed. When Restoring Will there be any Primary key Violation? I know one solution is to generate primary key by taking into consideration Company Id. But this will cause a complete rewriting of code, as it contains lot of edit/delete queries.  I want to know, whether the

attempting to restore to a new DB and it keeps trying to save the mdf file as the original mdf file

This is using SQL Server 2005. I've had several problems and this is where I've ended up. 1. Despite the claim that this will create a new DB it doesn't.  I was getting errors about the new DB not having the specified logical file name (despite the new DB not existing).  At the time I was specifying the logical file name as it appeared in the backup. 2. if I manually create the DB I still get the error as above unless I manually change the logical file name via sql management studio.  This is meant to be an automated solution so that is not accceptable. 3. I am now giving it the logical file name of the DB that I want to restore onto (if it doesn't exist I create it), but now it's trying to save the file with the old physical file name, which is absolutely *not* what I want. My instincts tell me I need to change the logical file name in the database I'm wanting to restore onto, but I don't know how to do this via SMO.  All of the explanations I've seen are through the SQL Management Studio and that is not acceptable as this needs to be an automated solution. I have copy/pasted the code from the msdn examples verbatim changing only the dbName and the .bak file location and it has consistently failed. Here is the code in it's current incarnation. var serverName = @"myServer"; var dbName = "MIQDesignTest3"; var backupFileN

SQL2008 - Cannot Restore a new database from a full backup of a different one, database in use

I am trying to restore a brand new database from a copy of another one and am encountering an error message stating: System.Data.SqlClient.SqlError: The file <Backup source database file location> cannot be overwritten.  It is being used by database <Backup Source Database>. (Microsoft.SqlServer.Smo) I am running the Restore procedure with the REPLACE option and am wondering why it is stating that the source database is the database in use when I am trying to restore and overwrite a completely different database. This issue happens when running the replace both in C# using SMO and when manually restoring with SqlServer Management Studio Interesting note is, the original source database is created / deployed using a database project within VisualStudios 2010 and then deployed to SqlServer through VisualStudios. Any thoughts on why this is happening? Thanks in advance for any help!

What happened to the backup and restore classes in namespace Microsoft.SqlServer.Management.Smo vers

I do not see these two classes in version 10 of this namespace and I am not finding any documentation explaining what happened to them.

Error in RESTORE in LOG FILE. Anyway to exclude it?

I'm trying to install a database (on a SQL Server 2008 machine) with test data sent by a partner company in the form of a .BAK file. (Version of SQL Server they are using unknown). I'm using this script: Use Master RESTORE DATABASE XEMS FROM DISK = 'C:\temp\xemstest6-29.bak' WITH REPLACE, MOVE 'XEMS' TO 'E:\XEMS DATABASE\XEMS.MDF', MOVE 'XEMS_Log' TO 'E:\XEMS DATABASE\XEMS_Log.LDF' The Restore process churns for a while, then I get: Processed 2576 pages for database 'XEMS', file 'XEMS' on file 1. Processed 5 pages for database 'XEMS', file 'XEMS_log' on file 1. Msg 3283, Level 16, State 1, Line 2 The file "XEMS_log" failed to initialize correctly. Examine the error logs for more details. Msg 3013, Level 16, State 1, Line 2 RESTORE DATABASE is terminating abnormally. At this point the database is unusable - trying to do anything with it produces an error indicating the database is still in a Restore state. There is some problem with the LOG portion of the backup, which I really don't need anyway. I'd like to just NOT restore the log. Came across this article which seemed to refer to the exact problem I'm having...  http://support.microsoft.com/kb/915385/en-us They offered this suggestion: "Use the WITH NO_LOG clause during the restore process." However - in checking the RESTORE syntax.... http://msdn.microsoft.com/en-us/libr
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend