I have a standby server with log shipping running on it.
We would like to use this standby server, as an ad-hoc
reporting database. This would work great, except for not
being able to perform the restore log at hourly intervals
because users are logged in. Is there a way to restore a
log with users logged into the database. The database is
in read-only mode or warm stand-by because of the
restores. We would like to have somewhat current data to
report from, so restoring the log backups meets that need.
Any suggestions would be greatly appreciatd.No.
Restore requires exclusive access to the DB
--
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org|||Mr. Mitchell is correct that you must have exclusive
access in order to do a restore. But there is a way to
get this to work. Basically you have to kick your users
out for the duration of the restore. The database should
already be in readonly mode, so there shouldn't be an
issue with updating data. Most people think you must
issue kill statements to accomplish this, but you can
alter the database with rollback immediate.
alter database db_name set SINGLE_USER with rollback
immediate
restore log.....
alter database db_name set MULTI_USER
(check BOL for more info)
I've found that this works very well in our situation. I
guess it would depend on how much the db is used for
reporting and what impact it has on users that are
reporting from the db.
>--Original Message--
>No.
>Restore requires exclusive access to the DB
>--
>
>Allan Mitchell (Microsoft SQL Server MVP)
>MCSE,MCDBA
>www.SQLDTS.com
>I support PASS - the definitive, global community
>for SQL Server professionals - http://www.sqlpass.org
>.
>|||Thank you both for your help. I was thinking of a similar
method if a solution was not available, where my restore
job checks to see if people are logged in and takes action
accordingly.
>--Original Message--
>Mr. Mitchell is correct that you must have exclusive
>access in order to do a restore. But there is a way to
>get this to work. Basically you have to kick your users
>out for the duration of the restore. The database should
>already be in readonly mode, so there shouldn't be an
>issue with updating data. Most people think you must
>issue kill statements to accomplish this, but you can
>alter the database with rollback immediate.
>alter database db_name set SINGLE_USER with rollback
>immediate
>restore log.....
>alter database db_name set MULTI_USER
>(check BOL for more info)
>I've found that this works very well in our situation. I
>guess it would depend on how much the db is used for
>reporting and what impact it has on users that are
>reporting from the db.
>>--Original Message--
>>No.
>>Restore requires exclusive access to the DB
>>--
>>
>>Allan Mitchell (Microsoft SQL Server MVP)
>>MCSE,MCDBA
>>www.SQLDTS.com
>>I support PASS - the definitive, global community
>>for SQL Server professionals - http://www.sqlpass.org
>>.
>.
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment