Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Tedious Backup and Restore with EM
I do a full backup on a production SQL2K database daily to one file (BAK)
and hourly transaction log backups (that began after the full backup) to
another file (TRN). When I transfer these two backup files to another dev
machine and try to do a restore (as a test) with EM it becomes very tedious.

I first restore the BAK leaving the "database operational but able to
restore transaction logs" after choosing the device and changing the
physical file names for the dev machine. Then, I do the same for the TRN
file (choose transaction log, leave database operational but able to
restore, change the physical file name, etc.). When I add the device, I can
"View Content" and see the hourly transaction log backups, but EM only
allows me to choose one "Backup number" at a time. Then I do the restore
successfully and the window closes and I have to start all over again for
the next backup number in the TRN file starting all over again for each of
the backups (choose transaction log, leave database, etc.). And finally at
the end, I leave the database operational.

Needless to say, this is all very tedious. I've tried selecting "Read backup
set information" but that doesn't appear to do anything.

Am I missing something here? Is there a more efficient/less tedious way to
apply these 23 backups from the transaction log to the full backup?

Thanks for any help or directions.



Report this thread to moderator Post Follow-up to this message
Old Post
Don Miller
12-14-06 12:12 AM


Re: Tedious Backup and Restore with EM
Don
Ofcause it is up to you ,but why you are using EM ? Would not it be simple
to rum a script from QA?


"Don Miller" <nospam@nospam.com> wrote in message
news:OGCuBhsHHHA.1264@TK2MSFTNGP03.phx.gbl...
>I do a full backup on a production SQL2K database daily to one file (BAK)
>and hourly transaction log backups (that began after the full backup) to
>another file (TRN). When I transfer these two backup files to another dev
>machine and try to do a restore (as a test) with EM it becomes very
>tedious.
>
> I first restore the BAK leaving the "database operational but able to
> restore transaction logs" after choosing the device and changing the
> physical file names for the dev machine. Then, I do the same for the TRN
> file (choose transaction log, leave database operational but able to
> restore, change the physical file name, etc.). When I add the device, I
> can "View Content" and see the hourly transaction log backups, but EM only
> allows me to choose one "Backup number" at a time. Then I do the restore
> successfully and the window closes and I have to start all over again for
> the next backup number in the TRN file starting all over again for each of
> the backups (choose transaction log, leave database, etc.). And finally at
> the end, I leave the database operational.
>
> Needless to say, this is all very tedious. I've tried selecting "Read
> backup set information" but that doesn't appear to do anything.
>
> Am I missing something here? Is there a more efficient/less tedious way to
> apply these 23 backups from the transaction log to the full backup?
>
> Thanks for any help or directions.
>



Report this thread to moderator Post Follow-up to this message
Old Post
Uri Dimant
12-14-06 12:12 AM


Re: Tedious Backup and Restore with EM
Yes, I can write a script, but I thought I might be missing something using
EM (since it *is* easier at times to just point and click)

"Uri Dimant" <urid@iscar.co.il> wrote in message
news:OnsvQksHHHA.3780@TK2MSFTNGP02.phx.gbl...
> Don
> Ofcause it is up to you ,but why you are using EM ? Would not it be simple
> to rum a script from QA?
>
>
> "Don Miller" <nospam@nospam.com> wrote in message
> news:OGCuBhsHHHA.1264@TK2MSFTNGP03.phx.gbl... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Don Miller
12-14-06 12:12 AM


Re: Tedious Backup and Restore with EM
> Am I missing something here?

Nope, you are not missing anything. FWIW, 2005 allow you to select several b
ackups from the backup
device so you can "click" them all and let the GUI execute several RESTORE c
ommands in one sweep.

When you have more than a few, you will find it easier to execute the RESTOR
E commands from a query
window.

Or, you can even generate the restore commands based on the output from REST
ORE HEADERONLY, using a
bit of TSQL programming. See http://www.karaszi.com/SQLServer/ u...
file.asp for
example, which would have to be adapted to suit your needs.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/


"Don Miller" <nospam@nospam.com> wrote in message news:OGCuBhsHHHA.1264@TK2MSFTNGP03.phx.gb
l...
>I do a full backup on a production SQL2K database daily to one file (BAK) a
nd hourly transaction
>log backups (that began after the full backup) to another file (TRN). When 
I transfer these two
>backup files to another dev machine and try to do a restore (as a test) wit
h EM it becomes very
>tedious.
>
> I first restore the BAK leaving the "database operational but able to rest
ore transaction logs"
> after choosing the device and changing the physical file names for the dev
 machine. Then, I do the
> same for the TRN file (choose transaction log, leave database operational 
but able to restore,
> change the physical file name, etc.). When I add the device, I can "View C
ontent" and see the
> hourly transaction log backups, but EM only allows me to choose one "Backu
p number" at a time.
> Then I do the restore successfully and the window closes and I have to sta
rt all over again for
> the next backup number in the TRN file starting all over again for each of
 the backups (choose
> transaction log, leave database, etc.). And finally at the end, I leave th
e database operational.
>
> Needless to say, this is all very tedious. I've tried selecting "Read back
up set information" but
> that doesn't appear to do anything.
>
> Am I missing something here? Is there a more efficient/less tedious way to
 apply these 23 backups
> from the transaction log to the full backup?
>
> Thanks for any help or directions.
>



Report this thread to moderator Post Follow-up to this message
Old Post
Tibor Karaszi
12-14-06 12:12 AM


Re: Tedious Backup and Restore with EM
Thanks for the link. I may have to move to 2005 sooner than planned.

In the meantime, I used RESTORE HEADERONLY on the TRN file and found that
last backup on Production.TRN was on 12/13/06 at 7am (there were 10 sets). I
tried the script below using the stoptime of an hour before the last. After
it completes, the db icon appears in the db list but is gray and says
'Loading' and I cannot access the db (Database 'testRecover' cannot be
opened. It is in the middle of a restore.). I've waited 15 minutes, and then
have to delete the restored db and start over (there seems to be no
activity).

Am I missing something here with the RESTORE LOG and STOPAT command? Do you
have to write a separate script for each log backup set using FILE = 1, FILE
= 2, etc., with the last one using WITH RECOVERY?

Thanks.

RESTORE DATABASE testRecover
FROM DISK = 'C:\Production.BAK' --- has one backup set
WITH NORECOVERY,
MOVE 'Production_dat' TO 'c:\testRecover.mdf',
MOVE 'Production_log' TO 'c:\testRecover_log.ldf'
RESTORE LOG testRecover
FROM DISK = 'C:\Production.TRN'  --- has 10 backup sets
WITH RECOVERY,
STOPAT = '2006-12-13 06:00 AM'




"Tibor Karaszi" <tibor_please.no. email_karaszi@hotmai
l.nomail.com> wrote in
message news:O3KMqItHHHA.2232@TK2MSFTNGP02.phx.gbl... 
>
> Nope, you are not missing anything. FWIW, 2005 allow you to select several
> backups from the backup device so you can "click" them all and let the GUI
> execute several RESTORE commands in one sweep.
>
> When you have more than a few, you will find it easier to execute the
> RESTORE commands from a query window.
>
> Or, you can even generate the restore commands based on the output from
> RESTORE HEADERONLY, using a bit of TSQL programming. See
> http://www.karaszi.com/SQLServer/ u...
file.asp for example,
> which would have to be adapted to suit your needs.
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www. solidqualitylearning
.com/
>
>
> "Don Miller" <nospam@nospam.com> wrote in message
> news:OGCuBhsHHHA.1264@TK2MSFTNGP03.phx.gbl... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Don Miller
12-14-06 12:12 AM


Re: Tedious Backup and Restore with EM
Assuming you restore the most recent database backup and only the most recen
t log backups (skipping
log backups in between), then SQL Server should have returned an error messa
ge for the attemt to
restore that log backup. Yes, you do have to execute a RESTORE LOG command f
or each log backup. If
you have them in the same file, you would use FILE = x to specify which one 
you want to restore.
Something like:

RESTORE DATABASE testRecover
FROM DISK = 'C:\Production.BAK' --- has one backup set
WITH NORECOVERY...
RESTORE LOG testRecover
FROM DISK = 'C:\Production.TRN'  --- has 10 backup sets
WITH FILE = 1, NORECOVERY...
RESTORE LOG testRecover
FROM DISK = 'C:\Production.TRN'  --- has 10 backup sets
WITH FILE = 2, NORECOVERY...
...
RESTORE LOG testRecover
FROM DISK = 'C:\Production.TRN'  --- has 10 backup sets
WITH RECOVERY, FILE = 10,
STOPAT = '2006-12-13 06:00 AM'

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/


"Don Miller" <nospam@nospam.com> wrote in message news:uaCTDZtHHHA.3676@TK2MSFTNGP03.phx.gb
l...
> Thanks for the link. I may have to move to 2005 sooner than planned.
>
> In the meantime, I used RESTORE HEADERONLY on the TRN file and found that 
last backup on
> Production.TRN was on 12/13/06 at 7am (there were 10 sets). I tried the sc
ript below using the
> stoptime of an hour before the last. After it completes, the db icon appea
rs in the db list but is
> gray and says 'Loading' and I cannot access the db (Database 'testRecover'
 cannot be opened. It is
> in the middle of a restore.). I've waited 15 minutes, and then have to del
ete the restored db and
> start over (there seems to be no activity).
>
> Am I missing something here with the RESTORE LOG and STOPAT command? Do yo
u have to write a
> separate script for each log backup set using FILE = 1, FILE = 2, etc., wi
th the last one using
> WITH RECOVERY?
>
> Thanks.
>
> RESTORE DATABASE testRecover
>   FROM DISK = 'C:\Production.BAK' --- has one backup set
>   WITH NORECOVERY,
>      MOVE 'Production_dat' TO 'c:\testRecover.mdf',
>      MOVE 'Production_log' TO 'c:\testRecover_log.ldf'
> RESTORE LOG testRecover
>   FROM DISK = 'C:\Production.TRN'  --- has 10 backup sets
>   WITH RECOVERY,
>   STOPAT = '2006-12-13 06:00 AM'
>
>
>
>
> "Tibor Karaszi" <tibor_please.no. email_karaszi@hotmai
l.nomail.com> wrote i
n message
> news:O3KMqItHHHA.2232@TK2MSFTNGP02.phx.gbl... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Tibor Karaszi
12-14-06 12:12 AM


Re: Tedious Backup and Restore with EM
Thanks. I found that worked but am disappointed there is not an elegant way
to apply just those log backups up to a point in time (I guess I don't
understand STOPAT).

"Tibor Karaszi" <tibor_please.no. email_karaszi@hotmai
l.nomail.com> wrote in
message news:OJ5XFrtHHHA.1264@TK2MSFTNGP06.phx.gbl...
> Assuming you restore the most recent database backup and only the most
> recent log backups (skipping log backups in between), then SQL Server
> should have returned an error message for the attemt to restore that log
> backup. Yes, you do have to execute a RESTORE LOG command for each log
> backup. If you have them in the same file, you would use FILE = x to
> specify which one you want to restore. Something like:
>
> RESTORE DATABASE testRecover
>  FROM DISK = 'C:\Production.BAK' --- has one backup set
>  WITH NORECOVERY...
> RESTORE LOG testRecover
>  FROM DISK = 'C:\Production.TRN'  --- has 10 backup sets
>  WITH FILE = 1, NORECOVERY...
> RESTORE LOG testRecover
>  FROM DISK = 'C:\Production.TRN'  --- has 10 backup sets
>  WITH FILE = 2, NORECOVERY...
> ...
> RESTORE LOG testRecover
>  FROM DISK = 'C:\Production.TRN'  --- has 10 backup sets
>  WITH RECOVERY, FILE = 10,
>  STOPAT = '2006-12-13 06:00 AM'
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www. solidqualitylearning
.com/
>
>
> "Don Miller" <nospam@nospam.com> wrote in message
> news:uaCTDZtHHHA.3676@TK2MSFTNGP03.phx.gbl... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Don Miller
12-14-06 12:12 AM


Re: Tedious Backup and Restore with EM
> I found that worked but am disappointed there is not an elegant way to apply just those l
og
> backups up to a point in time

SQL Server doesn't have this type of intelligence. If you have, say, 10 log 
backups and you want to
STOPAT somewhere during the time of the 10:th log backup, you have to restor
e each log backup (as
separate RESTORE LOG commands) and specify STOPAT the 10:th RESTORE LOG comm
and.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/


"Don Miller" <nospam@nospam.com> wrote in message news:%233OyputHHHA.816@TK2MSFTNGP06.phx.g
bl...
> Thanks. I found that worked but am disappointed there is not an elegant wa
y to apply just those
> log backups up to a point in time (I guess I don't understand STOPAT).
>
> "Tibor Karaszi" <tibor_please.no. email_karaszi@hotmai
l.nomail.com> wrote i
n message
> news:OJ5XFrtHHHA.1264@TK2MSFTNGP06.phx.gbl... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Tibor Karaszi
12-14-06 12:12 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 10:05 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006