all groups > sql server programming > february 2007 >
You're in the

sql server programming

group:

restore trans log to another database



restore trans log to another database DBA
2/24/2007 7:55:00 PM
sql server programming: I am having trouble restoring a trans log from mone database to another. I am
getting the following error:
Server: Msg 3135, Level 16, State 2, Line 1
The backup set in file 't:\formbkp\SRE0223TRANS.trn' was created by BACKUP
LOG and cannot be used for this restore operation.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Any idea why a backup of one database to another will not restore.

Re: restore trans log to another database Hari Prasad
2/24/2007 11:38:29 PM

You can not restore the transaction log backup to a different database. The
steps to restore a log is:-

1. Restore the Full database backup with NORECOVERY
2. Restore the Transaction log backups in sequence of log backup order. Do
not use RECOVERY if you need to apply more transaction log backups.
3. While restoring the Last log backup if you need to make the database
operational give "RECOVERY"

Thanks
Hari


[quoted text, click to view]

Re: restore trans log to another database Uri Dimant
2/25/2007 12:00:00 AM
DBA
Can you post a whole script that you did?


[quoted text, click to view]

Re: restore trans log to another database Tibor Karaszi
2/25/2007 12:00:00 AM
It seems you are trying to restore a transaction log backup using the RESTORE DATABASE command. Try
RESTORE LOG instead.

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


[quoted text, click to view]
Re: restore trans log to another database DBA
2/26/2007 9:33:23 AM
so then backup the database and tell it just to restore the log?

[quoted text, click to view]
Re: restore trans log to another database Tracy McKibben
2/26/2007 10:17:11 AM
[quoted text, click to view]

You don't use RESTORE DATABASE to restore a log backup, you use
RESTORE LOG. What exactly are you trying to do?
Re: restore trans log to another database DBA
2/26/2007 10:23:35 AM
What I want to do is backup a log file from one database, and restore the log
to another database of the same name on a different server

[quoted text, click to view]
Re: restore trans log to another database Tracy McKibben
2/26/2007 10:37:33 AM
[quoted text, click to view]

You can't do that - the transaction log is "tied" to the database file
to which it belongs.
Re: restore trans log to another database DBA
2/26/2007 10:47:10 AM
What if the database file is the same name

[quoted text, click to view]
Re: restore trans log to another database Tracy McKibben
2/26/2007 10:53:53 AM
[quoted text, click to view]

Doesn't matter, the connection between them isn't based on filenames.
What is the overall problem you're trying to solve? Why are you
trying to do this?
Re: restore trans log to another database DBA
2/26/2007 11:10:02 AM
I have two databases that have the same name on two different servers. one is
live and the other is in a test env. what I would like to do is without
changing the schema of the test database restore the transactions log from
the live env to the test env database

[quoted text, click to view]
Re: restore trans log to another database Tracy McKibben
2/26/2007 11:15:58 AM
[quoted text, click to view]

Again, the name has nothing to do with it. The transaction log is a
"journal" that keeps track of data pages that have changed within the
database file. You can't simply "replay" the log from one database
into another database, which it sounds like you are wanting to do.
Re: restore trans log to another database DBA
2/26/2007 11:57:14 AM
I am trying to run the transactions from one database to another. Is there
another way?

[quoted text, click to view]
Re: restore trans log to another database Tracy McKibben
2/26/2007 12:27:57 PM
[quoted text, click to view]

If you start with identical copies of the database, you can setup log
shipping between the two. You MUST start by restoring a full backup
of the source database. You cannot just restore a log backup to
another database.
AddThis Social Bookmark Button