Friday, March 9, 2012

Restore all data (system must not exit during restore) using SQL DMO

I am using the SQL DMO to do my backup and restore. The restore works fine for one thing. I there is current connections on my database I cannot perform the restore. I need to be logged on to the system to be able to do the restore (restore must be built into the system), but if I log in I cannot do the restore of the database.

Need help ASAP!!

Thanks!!!Is the database you're attempting to restore your default database on the server? If so, change it. You can't restore a database if any connections exist to that database.|||I'll explain to you what exactly needs to be done then you maybe can help me better.

I need to do a full backup and restore of the database. The user with the correct login details will have the ability to perform the backup and restore.

And it is right there where the problem comes in. A user is logged into the system so a connection to the database exist.The "master" database in SQL Server is the default db.

Another option that I am considering is to remove the requirement that a user must be logged in to do a backup. Let me explain how this will be possible. The application is written to function in a server enviroment and I am writen a standalone app to be installed on the server to perform certain tasks of which one is the backup/restore functionality. Seeing that only one or two people will have access to the server, user controll is already managed.

If I do this, it means that no current connections exist on my database and the backup can be performed!

Now you know the exact problem and the two options I have got. I'm not keen on the second option of removing the login, but will do so if I have no other choice.

Any suggestions?

MS|||If the default database of the user is "master" then you shouldn't have this problem. I'd take a look at the server when this user is connected to see what other connections exist. You can be connected to the server and restore a database other than the one you're connected to.|||

I

|||I am taking back up of database ABC (ABC.bak )from Server A. My application need is such that i should be able to restore ABC.bak on server A as well as Server B. My ASP Application is connected to server A. so while restoring back up, db already exists ,I am overwriting the current but different application users are connected to server A. therefore restore fails. What could be the possible solution for this situation?

No comments:

Post a Comment