Tuesday, March 27, 2012
abnormal message when performing restore on 2005
I have performed a full, differential and translog backup of my database.
Now when I try to restore the full backup it I get this message
Msg 3159, Level 16, State 1, Line 1
The tail of the log for the database "userdb" 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.
I then used this command
restore database userdb from disk='X:\backups\userfulldev.bak' with replace
and it restored the information correctly...
But im a bit curious exactly what I did wrong. Usually I never have to use
the "with replace" option when I restore my databases...
your thoughts?
/henrikThat is a new "error" message designed to keep you from erasing potentially
useful data. It applies when the following conditions are al true
You are restoring over an existing database
The database is in full recovery mode
There are active log segments (segments that have not been backed up).
The assumption is that the database contains useful transactions that must
be preserved.
--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Henrik Nordgren" <HenrikNordgren@.discussions.microsoft.com> wrote in
message news:84A018FB-0A32-4991-BC94-BD875EAB553B@.microsoft.com...
> Hi!
> I have performed a full, differential and translog backup of my database.
> Now when I try to restore the full backup it I get this message
> Msg 3159, Level 16, State 1, Line 1
> The tail of the log for the database "userdb" 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.
>
> I then used this command
> restore database userdb from disk='X:\backups\userfulldev.bak' with
> replace
> and it restored the information correctly...
> But im a bit curious exactly what I did wrong. Usually I never have to use
> the "with replace" option when I restore my databases...
> your thoughts?
> /henrik
>|||On Feb 14, 1:47 pm, Henrik Nordgren
<HenrikNordg...@.discussions.microsoft.com> wrote:
> Hi!
> I have performed a full, differential and translog backup of my database.
> Now when I try to restore the full backup it I get this message
> Msg 3159, Level 16, State 1, Line 1
> The tail of the log for the database "userdb" 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.
> I then used this command
> restore database userdb from disk='X:\backups\userfulldev.bak' with replace
> and it restored the information correctly...
> But im a bit curious exactly what I did wrong. Usually I never have to use
> the "with replace" option when I restore my databases...
> your thoughts?
> /henrik
This is telling you that something modified your database after your
last log backup was done. There are "new" transactions in the log
that you will lose if you proceed with the restore...
Friday, February 24, 2012
a question about Exec
When I run the following command on sql server:
exec ('print "OK"')
go
This message appears:
Server: Msg 128, Level 15, State 1, Line 1
The name 'OK' is not permitted in this context. Only constants,
expressions, or variables allowed here. Column names are not permitted.
Why? Thanks.findu_2005@.yahoo.com (findu_2005@.yahoo.com) writes:
Quote:
Originally Posted by
When I run the following command on sql server:
>
exec ('print "OK"')
go
>
This message appears:
>
Server: Msg 128, Level 15, State 1, Line 1
The name 'OK' is not permitted in this context. Only constants,
expressions, or variables allowed here. Column names are not permitted.
>
Why? Thanks.
Because when the setting QUOTED_IDENTIFIER is in effect, "" delmits
identifier. This permits you to use table names like Order Details, for
instance:
SELECT ... FROM "Order Details"
In the SQL Server world, we tend to use [] for this function, but "" is
what ANSI mandates.
QUOTED_IDENTIFIER is on by default in most contexts, but not when you
run from SQLCMD, OSQL or Enterprise Manager in SQL 2000. Or for that
matter all DB-Library applications.
When the setting is off, SQL Server reverts to the original behaviour
from 4.x days when you couls use both '' and "" to delimit strings.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Something like this will work
exec ('print ''OK''') . *Note: all are single quotes.
or you'll have to use SET QUOTED_IDENTIFIER OFF and then execute the
SQL.
Regards,
Thyagu.