Sunday, March 25, 2012

how to refresh a database in sql server

Simple steps:

1) Take the backup of the source db
2) copy the backup
3) refresh the db at the destination; while refreshing if you haven't taken a backup of the destination db, it would prompt you that the tail of the log for this db hasn't been backed up and wouldn't allow you to restore; In that case use "replace" option in your restore database script.
4) After the restoration fix the logins:
use <dbname>
sp_change_users_login 'report'
go
once you get the logins which need to be fixed use this:
sp_change_users_login 'auto_fix','loginname'

If you don't have logins for the db users then they couldn't be fixed until  you create the logins.
Also you can't fix logins for windows users, you have to manually do it.
 


No comments:

Post a Comment