Tuesday, February 21, 2012

Restore .BAK and incremental .TRN each day?

Hello,
Each morning, I have a plan fire at 2 AM that backs up my boss's
favorite database. I also have a 1 hour job that starts at 3 AM which
backs up the transaction log. The database is in FULL recovery and we
don't truncate the logs manually. I would like to know if anyone has
a script or suggestion for restoring the .TRN files all day long.
I can't spend $ on another product so TSQL is likely the answer. I do
not need the database operational at all times, as it is being
restored 'just in case'. I have read that restoring the .TRN files
WITH NORECOVERY is the best method as I don't want to lose anything.
Is it possible to do something like a JOB that uses XP_CMDSHELL to
list the .TRN files and just keeps restoring them? Or should I use an
external script completely? Also, what if the MASTER database
changes? I already looked into a DOS script that adds -m -c, restarts
MSSQL, restores the MASTER, removes the startup switches and then
restarts. Is that the right approach?
I just want to keep the two databases in sync, but cannot use
replication directly do to business rules. BTW, I am using an XCOPY
between the running MSSQL server and the 'just in case' one.
Any insight, TSQL, software recommendations or experiences would help.
Gracias,
TimTim,
What you are describing is referred to as Log Shipping. If you have
Enterprise edition of SQL Server you can use the maintenance wizard to set
this up. If you only have Std you can find scripts in the Resource Kit to
help with this. There is lots of information out there on this subject.
You can also do a google search for Log Shipping and I am sure you will find
some past posts that show some sample scripts.
--
Andrew J. Kelly
SQL Server MVP
"Tim" <SQLRESTORE@.CFAPOSTLE.COM> wrote in message
news:947a9f8a.0311211714.3f670726@.posting.google.com...
> Hello,
> Each morning, I have a plan fire at 2 AM that backs up my boss's
> favorite database. I also have a 1 hour job that starts at 3 AM which
> backs up the transaction log. The database is in FULL recovery and we
> don't truncate the logs manually. I would like to know if anyone has
> a script or suggestion for restoring the .TRN files all day long.
> I can't spend $ on another product so TSQL is likely the answer. I do
> not need the database operational at all times, as it is being
> restored 'just in case'. I have read that restoring the .TRN files
> WITH NORECOVERY is the best method as I don't want to lose anything.
> Is it possible to do something like a JOB that uses XP_CMDSHELL to
> list the .TRN files and just keeps restoring them? Or should I use an
> external script completely? Also, what if the MASTER database
> changes? I already looked into a DOS script that adds -m -c, restarts
> MSSQL, restores the MASTER, removes the startup switches and then
> restarts. Is that the right approach?
> I just want to keep the two databases in sync, but cannot use
> replication directly do to business rules. BTW, I am using an XCOPY
> between the running MSSQL server and the 'just in case' one.
> Any insight, TSQL, software recommendations or experiences would help.
> Gracias,
> Tim

No comments:

Post a Comment