Sunday, March 25, 2012

Basic backup question

I'm doing a full backup of a SQL Server database with SSMS. When I try to
restore it I get the following exception:
*******
Msg 3159, Level 16, State 1, Line 1
The tail of the log for the database "MYBACKUP" has not been backed up. Use
BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not
want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE
statement to just overwrite the contents of the log.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
*******
What is this message?
Should I backup the log before backing up the database?
Is the database backup enought to recover data?
Thanks!
GasparA couple of questions first:
Are you doing regular transaction log backups?
If not, is there a reason for you to have the database in full recovery mode
l?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Gaspar" <noreply@.nospamplease.com> wrote in message news:eSEAac8QIHA.4196@.TK2MSFTNGP04.phx.
gbl...
> I'm doing a full backup of a SQL Server database with SSMS. When I try to
restore it I get the
> following exception:
> *******
> Msg 3159, Level 16, State 1, Line 1
> The tail of the log for the database "MYBACKUP" has not been backed up. Us
e BACKUP LOG WITH
> NORECOVERY to backup the log if it contains work you do not want to lose.
Use the WITH REPLACE or
> WITH STOPAT clause of the RESTORE statement to just overwrite the contents
of the log.
> Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> *******
> What is this message?
> Should I backup the log before backing up the database?
> Is the database backup enought to recover data?
> Thanks!
> Gaspar
>|||Yes. I have schedules to backup the transaction log every 6 hours. I don't
know if this is a good practice.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23aEpff8QIHA.5988@.TK2MSFTNGP02.phx.gbl...
>A couple of questions first:
> Are you doing regular transaction log backups?
> If not, is there a reason for you to have the database in full recovery
> model?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Gaspar" <noreply@.nospamplease.com> wrote in message
> news:eSEAac8QIHA.4196@.TK2MSFTNGP04.phx.gbl...
>|||> Yes. I have schedules to backup the transaction log every 6 hours. I don't know if this is
a good
> practice.
This we can't answer since we don't know how much data your organization can
tolerate to lose in
case of a disaster...
Anyhow, I do now know you do log backups. OK, consider below:
1 Backup db
2 Users doing modifications
3 Backup log
4 Users doing modifications
5 Backup log
6 Users doing modifications
7 Backup log
8 Users doing modifications
And you now want to do RESTORE. But what about the modifications in step 8?
This will be lost if you
perform the restore. The error is SQL Server's way of reminding you that you
probably want to do a
log backup first:
9 Backup log
When you now RESTORE (1, 3, 5, 7 *and* 9), you will have no data loss. If yo
u *want* to do RESTORE
*without* doing this last log backup, you can use the REPLACE parameter for
the RESTORE command.
This behavior (the "reminder") is new for 2005, btw.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Gaspar" <noreply@.nospamplease.com> wrote in message news:ORsgVp8QIHA.5400@.TK2MSFTNGP04.phx.
gbl...
> Yes. I have schedules to backup the transaction log every 6 hours. I don't
know if this is a good
> practice.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n message
> news:%23aEpff8QIHA.5988@.TK2MSFTNGP02.phx.gbl...
>|||So, this reminder "The tail of the log for the database "MYBACKUP" has not
been backed up" is just letting me know that after I backuped up the data,
some changes where done.
Suppose I don't care about this changes (my compain can "recover" from a
one-day data loss):
1) Can I restore by only having the database backup?
2) How to avoid this message from appearing?
Thanks again
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:O%23K04v8QIHA.3516@.TK2MSFTNGP02.phx.gbl...
> This we can't answer since we don't know how much data your organization
> can tolerate to lose in case of a disaster...
> Anyhow, I do now know you do log backups. OK, consider below:
> 1 Backup db
> 2 Users doing modifications
> 3 Backup log
> 4 Users doing modifications
> 5 Backup log
> 6 Users doing modifications
> 7 Backup log
> 8 Users doing modifications
> And you now want to do RESTORE. But what about the modifications in step
> 8? This will be lost if you perform the restore. The error is SQL Server's
> way of reminding you that you probably want to do a log backup first:
> 9 Backup log
> When you now RESTORE (1, 3, 5, 7 *and* 9), you will have no data loss. If
> you *want* to do RESTORE *without* doing this last log backup, you can use
> the REPLACE parameter for the RESTORE command.
> This behavior (the "reminder") is new for 2005, btw.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Gaspar" <noreply@.nospamplease.com> wrote in message
> news:ORsgVp8QIHA.5400@.TK2MSFTNGP04.phx.gbl...
>|||> So, this reminder "The tail of the log for the database "MYBACKUP" has not been backed up"
is just
> letting me know that after I backuped up the data, some changes where done.[/vbcol
]
Yes, the message states that after your last backup (database or log backup)
there has been
modifications in the database.
[vbcol=seagreen]
> Suppose I don't care about this changes (my compain can "recover" from a o
ne-day data loss):
> 1) Can I restore by only having the database backup?
Yes. Again, consider below:
1 Backup db
2 Users doing modifications
3 Backup log
4 Users doing modifications
5 Backup log
6 Users doing modifications
7 Backup log
8 Users doing modifications
You can restore from only 1. Of course you will lose all modifications done
after 1.

> 2) How to avoid this message from appearing?
Specify the REPLACE option for your RESTORE command.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Gaspar" <noreply@.nospamplease.com> wrote in message news:ux4xwO9QIHA.1164@.TK2MSFTNGP02.phx.
gbl...
> So, this reminder "The tail of the log for the database "MYBACKUP" has not
been backed up" is just
> letting me know that after I backuped up the data, some changes where done
.
> Suppose I don't care about this changes (my compain can "recover" from a o
ne-day data loss):
> 1) Can I restore by only having the database backup?
> 2) How to avoid this message from appearing?
> Thanks again
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n message
> news:O%23K04v8QIHA.3516@.TK2MSFTNGP02.phx.gbl...
>|||This may help, it helped me.
http://www.associatedcontent.com/ar...
ps.html
On Dec 21, 6:44 am, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> Yes, the message states that after your lastbackup(database or logbackup)
there has been
> modifications in the database.
>
>
> Yes. Again, consider below:
> 1Backupdb
> 2 Users doing modifications
> 3Backuplog
> 4 Users doing modifications
> 5Backuplog
> 6 Users doing modifications
> 7Backuplog
> 8 Users doing modifications
> You can restore from only 1. Of course you will lose all modifications don
e after 1.
>
> Specify the REPLACE option for your RESTORE command.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asph
ttp://sqlblog.com/blogs/tibor_karaszi
> "Gaspar" <nore...@.nospamplease.com> wrote in messagenews:ux4xwO9QIHA.1164@.
TK2MSFTNGP02.phx.gbl...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

No comments:

Post a Comment