Monday, March 19, 2012

Error in restoring database from .BAK file

Hi All
I have one .BAK file. When I m trying to restore 'EMail_db.bak' file, I got following an error.
MS SQL-DMO (ODBC SQLState: 42000
The backup set in file 'D:\EMail_db.bak' was created by BACKUP LOG and cannot be used for this restore operation. RESTORE DATBASE is terminating abnormally
Plz help me..
Thnx in advance..I suggest you try the RESTORE from Query Analyzer and post the restore command you executed.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Vikkas" <Vikas.jindal@.fqsltd.com> wrote in message news:87CD3985-BE3F-4B11-A594-6A3B0ECA86C3@.microsoft.com...
> Hi All,
> I have one .BAK file. When I m trying to restore 'EMail_db.bak' file, I got following an error.
> MS SQL-DMO (ODBC SQLState: 42000)
> The backup set in file 'D:\EMail_db.bak' was created by BACKUP LOG and cannot be used for this restore
operation. RESTORE DATBASE is terminating abnormally.
> Plz help me...
> Thnx in advance..|||Hi
thnx for ur response
i got this message in SQL Query Analyzer.
Server: Msg 3135, Level 16, State 2, Line
The backup set in file 'D:\EMail_db.bak' was created by BACKUP LOG and cannot be used for this restore operation
Server: Msg 3013, Level 16, State 1, Line
RESTORE DATABASE is terminating abnormally|||Hi
Sorry i forgot to paste the Quer
RESTORE DATABASE EMai
FROM DISK = 'D:\EMail_db.bak
Error was
Server: Msg 3135, Level 16, State 2, Line
The backup set in file 'D:\EMail_db.bak' was created by BACKUP LOG and cannot be used for this restore operation
Server: Msg 3013, Level 16, State 1, Line
RESTORE DATABASE is terminating abnormally
Waiting for ur reply|||That makes it easier... :-)
This file contains a transaction log backup, not a database backup. However, the file might contain several
backups. I suggest you use RESTORE HEADERONLY to see how many backups there is on this backup file, and then
use the FILE parameter to define which you want to restore. If you do not specify FILE, SQL Server assume the
first one.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Vikkas" <anonymous@.discussions.microsoft.com> wrote in message
news:03353991-A6AE-4600-A914-A0D3354CAB12@.microsoft.com...
> Hi,
> Sorry i forgot to paste the Query
> RESTORE DATABASE EMail
> FROM DISK = 'D:\EMail_db.bak'
> Error was
> Server: Msg 3135, Level 16, State 2, Line 1
> The backup set in file 'D:\EMail_db.bak' 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.
> Waiting for ur reply|||Hi,
Add on to Tibers post,
You have to identify the backup file which holds the Full database backup.
You have to restore the full database first using the below command
Restore database dbname from disk='filename' with NORECOVERY
(Norecovery clause allow you to restore the transaction log backup)
After the successful restore of database you have to go ahead with the
restore of transaction logs (Based on the suggestion from Tiber).
Restore log dbname from disk='filename' with norecovery
And in the final log file issue the command with recovery (Now the database
will open for read/write operations)
Restore log dbname from disk='filename' with RECOVERY
Thanks
Hari
MCDBA
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:#Tgb9k0NEHA.2708@.TK2MSFTNGP10.phx.gbl...
> That makes it easier... :-)
> This file contains a transaction log backup, not a database backup.
However, the file might contain several
> backups. I suggest you use RESTORE HEADERONLY to see how many backups
there is on this backup file, and then
> use the FILE parameter to define which you want to restore. If you do not
specify FILE, SQL Server assume the
> first one.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>
> "Vikkas" <anonymous@.discussions.microsoft.com> wrote in message
> news:03353991-A6AE-4600-A914-A0D3354CAB12@.microsoft.com...
> > Hi,
> >
> > Sorry i forgot to paste the Query
> >
> > RESTORE DATABASE EMail
> > FROM DISK = 'D:\EMail_db.bak'
> >
> > Error was
> >
> > Server: Msg 3135, Level 16, State 2, Line 1
> > The backup set in file 'D:\EMail_db.bak' 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.
> >
> > Waiting for ur reply
>|||No. A transaction log backup is only changes (since last transaction log backup). To be able to restore such,
you always have to first restore a database backup.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"vikkas" <anonymous@.discussions.microsoft.com> wrote in message
news:CDB0E09D-4EEB-4C46-A968-2FBD1B9F9D15@.microsoft.com...
> Again Thnx,
> But let me know that can i restore from this transaction log backup file without having database.. Bcoz i
don't have database and try to restore database from this transaction log backup file.
> Vikkas
> ----
---
> This file contains a transaction log backup, not a database backup. However, the file might contain several
> backups. I suggest you use RESTORE HEADERONLY to see how many backups there is on this backup file, and then
> use the FILE parameter to define which you want to restore. If you do not specify FILE, SQL Server assume
the
> first one.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>|||Hi Vikas,
No you cant restore the trasaction log file alone. Transaction log can be
restored only in below occasions:-
1. Destination database is standby to ur production database(destination
database must be in read only mode to acept the transaction log)
Other option is :-
1. Restore full database backup with NORECOVERY ( You should have a full
database backup file)
2. After the full database restore, Follow the Transaction log restore
---
> This file contains a transaction log backup, not a database backup.
However, the file might contain several
> backups. I suggest you use RESTORE HEADERONLY to see how many backups
there is on this backup file, and then
> use the FILE parameter to define which you want to restore. If you do not
specify FILE, SQL Server assume the
> first one.
--
Tiber mentioned that ur backup file will be having more than one file, this
can be identified by issuing RESTORE HEADERONLY
with the command. If you have multiple files then you have to use
FILE=file_number during restore.
Thanks
Hari
MCDBA
"vikkas" <anonymous@.discussions.microsoft.com> wrote in message
news:CDB0E09D-4EEB-4C46-A968-2FBD1B9F9D15@.microsoft.com...
> Again Thnx,
> But let me know that can i restore from this transaction log backup file
without having database.. Bcoz i don't have database and try to restore
database from this transaction log backup file.
> Vikkas
> ----
---
> This file contains a transaction log backup, not a database backup.
However, the file might contain several
> backups. I suggest you use RESTORE HEADERONLY to see how many backups
there is on this backup file, and then
> use the FILE parameter to define which you want to restore. If you do not
specify FILE, SQL Server assume the
> first one.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>

No comments:

Post a Comment