Friday, March 9, 2012

Restore only data on a database

Hi to all,
I have created a program that weekly restore a database with differential backup.

It works fine the only thing is that when I restore the database the new user are dropped.

There is a way to restore only the data ?

code:

use master
ALTER DATABASE GOROB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE GOROB
FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\GOROBFULL'
with NORECOVERY

RESTORE DATABASE GOROB
FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\Differential'
WITH FILE =1 ,
RECOVERY

ALTER DATABASE GOROB SET MULTI_USER

Thank you in advance

And data added to the database SINCE the differential backup will be lost when you do a restore.

Database Users are 'data' in the database.

You may wish to add a job step to script out the Users when you make the differential backup, and then add a job step to the restore process to run that script.

|||

Anrie thank you

for your reply, there is a way to look insite the users of the database and grant the access to it?

My problem is that when I do the restore and some database administrator create new user on a database

it cannot access to data .

So I have thinked to grant the access to each user of the db .

The thinks is how this cold be done?

No comments:

Post a Comment