Tuesday, February 14, 2012

Determining restore sequence

Hi,
I have a lot of files in a directory. Each one have exactly one SQL Backup
Set. There are full, differential and transaction-log backup files...
How can I know what files (diffs and tlogs) should be restored (and in what
order) considering a individual full backup file (to get a the most recent
state)?
I am trying to use DatabaseBackupLSN and LastLSN. And I am having special
problems with the transaction-log backups (where to restore or not after a
specific differential).
Can anyone help me?
Thanks,
Rafael PivatoThe easiest way is to go by the time/date stamp in the
file name, which you should be using. Or by the file
dates.
Now, you need a full, and then after that, you can do the
differential after the full, and the transaction logs
after that. Or the full and all the tran logs after that.
You should keep a document somewhere that details these
things.
>--Original Message--
>Hi,
>
>I have a lot of files in a directory. Each one have
exactly one SQL Backup
>Set. There are full, differential and transaction-log
backup files...
>
>How can I know what files (diffs and tlogs) should be
restored (and in what
>order) considering a individual full backup file (to get
a the most recent
>state)?
>
>I am trying to use DatabaseBackupLSN and LastLSN. And I
am having special
>problems with the transaction-log backups (where to
restore or not after a
>specific differential).
>
>
>Can anyone help me?
>Thanks,
>Rafael Pivato
>
>
>.
>|||Hi,
Allways try to create transaction log backup file names
with the combination of TX_date_time.bak.
Thanks
Hari
"Allan Hirt" <allanh@.nospamavanade.com> wrote in message
news:02f201c3cc0e$650a5410$a101280a@.phx.gbl...
> The easiest way is to go by the time/date stamp in the
> file name, which you should be using. Or by the file
> dates.
> Now, you need a full, and then after that, you can do the
> differential after the full, and the transaction logs
> after that. Or the full and all the tran logs after that.
> You should keep a document somewhere that details these
> things.
> >--Original Message--
> >Hi,
> >
> >
> >
> >I have a lot of files in a directory. Each one have
> exactly one SQL Backup
> >Set. There are full, differential and transaction-log
> backup files...
> >
> >
> >
> >How can I know what files (diffs and tlogs) should be
> restored (and in what
> >order) considering a individual full backup file (to get
> a the most recent
> >state)?
> >
> >
> >
> >I am trying to use DatabaseBackupLSN and LastLSN. And I
> am having special
> >problems with the transaction-log backups (where to
> restore or not after a
> >specific differential).
> >
> >
> >
> >
> >
> >Can anyone help me?
> >
> >Thanks,
> >
> >Rafael Pivato
> >
> >
> >
> >
> >.
> >|||Read the file names into a temp table, ordered by its last modify date/time.
Loop through the temp table to examine each file with 'RESTORE HEADERONLY.'
This will tell you, among other things, the backup type of the backup file
or whether it is even a backup file. Keep only the latest full database
backup file, toss away any differential backup files older than the lastest
full database backup, and toss away any tran log backup files older than the
latest differential backup or the latest full database backup if there is no
differential backup.
Construct the RESTORE script in the following order:
1. Construct the database RESTORE statement by running RESTORE FILELISTONLY.
2. Construct the differential RESTORE statement by running RESTORE
FILELISTONLY on the differential backup file.
3. Construct the log RESTORE statements by running RESTORE FILELISTONLY on
each of the log backup files in the chronological order.
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Rafael Pivato" <for@.get.it> wrote in message
news:%23Sm0yx%23yDHA.2116@.TK2MSFTNGP11.phx.gbl...
> Hi,
>
> I have a lot of files in a directory. Each one have exactly one SQL Backup
> Set. There are full, differential and transaction-log backup files...
>
> How can I know what files (diffs and tlogs) should be restored (and in
what
> order) considering a individual full backup file (to get a the most recent
> state)?
>
> I am trying to use DatabaseBackupLSN and LastLSN. And I am having special
> problems with the transaction-log backups (where to restore or not after a
> specific differential).
>
>
> Can anyone help me?
> Thanks,
> Rafael Pivato
>
>

No comments:

Post a Comment