.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

Multiple databases backup/restore in a transaction, if possible, into only one file

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :Sql Server

Hi dear,

I have three databases named XDW, XOLTP, XOLTPSchema. All of these are for only one application. In the application, user should do backup/restore using GUI.


1. How I should do backup/restore in one transaction? i.e. all of three actions should be success elsewhere all of them should fail.

2. Is it possible to backup them into only one file e.g. X.bak?

3. Or, What is the standard solution in this condition?

Thanks in advance.

How To: Joining multiple DataTable using “LINQ to DataSet”

View Complete Post

More Related Resource Links

Toolbox: Easy File Backup, Exploring Files And Folders Inside Visual Studio, Multiple Monitor Softwa


If the responsibility for creating, managing, and executing routine backups is yours, these tools will make it easier. Also see how you can browse folders and files from inside Visual Studio.

Scott Mitchell

MSDN Magazine May 2009

Can't restore database backup file in my database ? using sql server 2005. please help

VERY IMPORTANT i am trying to restore database.bak in sql server 2005 (i know the database.bak was also generated in sql 2005 server) i am trying to restore back up database .bak into the new database i just created in sql server 2005 i have saved my database .bak into c drive and when i select database .bak "From Device", it doesn't get populated in the list below and i see nothing and it keeps on prompting a message "You must select a restore source" Here's the screen shot:   PLEASE HELP..it's really important (i tried restoring database in sql server 2008 and it was sucessful but i am facing this problem in sql server 2005 only)  

restore user databases from diff backup

I need to migrate the server from sql server 2005 to 2008. I need to migrate all 500+ user databases. in order for me to minimize the downtime, can I do the following: 1) run full backup on 2005 source and transfer the data over to the destination 2) restore user dbs from these backups 3) shut down the apps on source 4) run diff backup on 2005 source and transfer the data over to the destination 5) restore user dbs from these backups   Is it possible to apply only diff backup on the destination or the dbs should be restored from full+diff only? Please helpJulieShop

TDE disabled and service restarted but still can't restore a new backup file

Hello, I disabled TDE on my dev database because we determined no personally identifiable info will be stored.  Disabling was done like so:Then I created a backup of MyDB database and tried to restore on a different server instance on my same machine (using SSMS) and I get  the following error: ALTER DATABASE MyDB SET ENCRYPTION OFF GO use MyDB go drop database encryption key go use master go DROP certificate DevCert GO DROP MASTER KEY GO Afterwards, I ran the following query to ensure there are no encrypted databases, and it returns zero rows: SELECT DB_NAME(database_id) AS dbname, encryption_state, case encryption_state   WHEN 0 THEN 'Unencrypted (no database encryption key present)'   WHEN 1 THEN 'Unencrypted'   WHEN 2 THEN 'Encryption in Progress'   WHEN 3 THEN 'Encrypted'   WHEN 4 THEN 'Key Change in Progress'   WHEN 5 THEN 'Decryption in Progress'   ELSE CAST(encryption_state AS varchar(20)) END AS encryption_state, key_algorithm, key_length FROM sys.dm_database_encryption_keys Then I created a backup of MyDB database and tried to restore on a different server instance on my same machine (using the SSMS) and I get the following fatal error: The media family on device 'c:\Program Files\...\Backup\TDE_removed_from_db.bak' is incorrectly formed.  SQL Server cannot process this media family. 

Transaction log backup creates big log backup file


HI All,

One of my customer having problem with the transaction log backup .There is one maintenance job that will take Full backup on daily basis.and transaction log backup in 4 hrs.On Sunday there is one rebuild index job .After this rebuild index job the transaction log is taking 17 minutes and it creates 12 gb transaction log backup (only for the first time). Usually the transaction  took 6/8 seconds and the transaction file will be in less than 100 mb.

Pleas help me to resolve this issue


Thanks in advance 


Backup/Restore 404 File not found error ;Site site created besed on Custom Site Template




I am using SharePoint (Version: 12.0.6318.5000). The scenario is like that;

  • I have created a Site Collection and under that I have 2 sub sites and under each sub sites again I have a sub site (Site Collection [level 1]>>>SubSite+Lists [level 2]>>>SubSite+ Lists [level 3]>>>Lists, Doc. Library and Picture Library

SQL server2008, CRM4.0, unable to read sql backup file when trying to restore



For a client of ours we have two CRM4.0 environments, both on a seperate domain. Domain A and Domain B.
Domain A is used for testing and developing pursoses, Domain B is the production environment.

The client has requested that we match the Domain A environment with the Domain B environment so that the testing and production evironments are the same before they continue with testing/development.

For this purpose I wanted to just copy the Domain A SQL database to the Domain B environment.

Unfortunately I am getting the following error when trying to restore the CRM4.0 SQL database of Domain A on the CRM4.0 SQL database server of Domain B.

System.Data.SqlClient.SqlError: Read on "C:\Users\Cen-Admin\Desktop\VWPCRM_MSCRM.bak" failed: 38(failed to retrieve text for this error. Reason: 15105) (Microsoft.SqlServer.Smo)

I have tried to follow these instructions but have been unable to complete them because of the fact that i cannot initiate the restore action:


The link that the error provides in the detailed desciption field provides no qlue to a solution:

Transaction Log Backup & Transaction Log file size



Database is in Full Recovery Model.  Backup is done as follows

1)  Full Back up done every Sunday 00:00

2)  Differential Backup done Done Every Day at 00:00

3)  Transaction Log is Backed Up Every 15minutes.


I have a problem Transaction Log Size suddenly gone to 22GB (Data File is only 100mb) and Transaction Log Backup ruinning for a long time but it is not backing up. 


Why is this problem occuring?  How do I solve this? 


replication initialized from multiple file backup


Our database is rather large - several hundred gig. To aid in shipping the backup across the network, we split the backup into 5 files. When setting up replication based on this backup, can I just refer to the first file, since it is only looking at the header info?

I would like to be able to use a differential as the source since our changes add up to about 5 gig per day, but i have never been abld to start replication off of a differential no mater what i do with the various agents - log, distrib etc etc.


Unable to restore from backup file when UNC path is used


I have a Visual Basic application built using Visual Studio 2008.  I connect to a SQL Server 2008 server using ODBC.  I connect to the master database and try to run the following statement:

RESTORE DATABASE [Village of Pleasant Prairie] FROM DISK = '\\\public\MyAppData\Village of Pleasant Prairie\MySQLServerData.backup' WITH REPLACE

When I do this, I get the following error:

Cannot open backup device '\\\public\MyAppData\Village of Pleasant Prairie\MySQLServerData.backup'. Operating system error 5(Access is denied.).

It may be important to note that (the address of the file server) is the same as the address of the SQL Server (both servers on running on the same physical box.  This server is also a domain controller (don't know if that is important, but it may be).

I tried changing the SQL command to:

RESTORE DATABASE [Village of Pleasant Prairie] FROM DISK = 'c:\public\MyAppData\Village of Pleasant

Restore Job has been failed with error message as "Skipped log backup file. Secondary DB"


We have already configured log shipping on server. But now restore job failed with error message as "Skipped log backup file. Secondary DB"

Kindly provide resolution steps for same.

Upload Multiple File using JQuery in asp.net

In this article I have explained how to upload multiple files using file upload control. I have used jQuery plugin for uploading multiple files.

I have also explained how to check for file type, file maximum size limit using jQuery & also using server side validation code.

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.

Multiple web methods in one transaction


Hi everyone

Sorry I am kinda new in web services, so it may sound a bit newbish question.

We have a web service that comunicates with the database and exposes web methods that enables the application to access the database. Each method does only one operation (Insert, Update or Delete). What I need to do is create a transaction that will be consisted of multiple calls to the database, meaning multiple calls of more then one web methods. Can I do that? (I read that if the web method does not throw exception - or ContextUtil.SetAbort() is not called - the transaction will be commited automatically when the web method finishes executing, which I don't want to happen because I want to call another web method in the same transaction, and then manually commit the transaction)

Thank you in advance.

Using the single *.rpt file with multiple data sources


I've created a set of CrystalReports (*.rpt files) for an ASP.NET web app on a development server. I call each report using the following code:

protected void BTN_RunReport_Click(object sender, ImageClickEventArgs e)
CrystalReportViewer_ClientLetter.Visible = true;

ConnectionInfo con = new ConnectionInfo();
con.ServerName = Constants.ServerIP;
con.DatabaseName = Constants.DatabaseName;
con.UserID = Constants.UserID;
con.Password = Constants.Password;

CrystalReportViewer_ClientLetter.ReportSource = Server.MapPath(Constants.ClientLetters);
ParameterFields parameter = CrystalReportViewer_ClientLetter.ParameterFieldInfo;
ParameterField batchdate = new ParameterField();
batchdate.Name = "@BatchDate";
ParameterDiscreteValue batchdate_value = new ParameterDiscreteValue();
batchdate_value.Value = Convert.ToDateTime(txtBatchDate.Text);

foreach (TableLogOnInfo tlf in CrystalReportViewer_ClientLetter.LogOnInfo)
tlf.ConnectionInfo = con;

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
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