Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SQL backup

Posted on 2012-04-06
2
427 Views
Last Modified: 2012-06-27
Hi,

I did a backup of an SQL database using this code:

/* Perform a Full Backup of dbMT*/
Use master
GO
BACKUP DATABASE dbMT
TO DISK =N'C:\SQL_backup\dbMT.BAK'
WITH COMPRESSION
GO

/* Perform a Tail Log Backup of dbMT*/
BACKUP LOG dbMT
TO DISK =N'C:\SQL_backup\dbMT.TRN'
WITH COMPRESSION, NORECOVERY
GO

After that the database was stuck in stuck in “Restoring” state. I had to run this code to release it:

RESTORE DATABASE dbMT
   FROM DISK = N'C:\SQL_backup\dbMT.BAK'
   WITH REPLACE,RECOVERY

How can I do the backup without this happening?

Best regards
RTSol
0
Comment
Question by:RTSol
2 Comments
 
LVL 26

Accepted Solution

by:
Chris Luttrell earned 500 total points
ID: 37815417
Leave off the NORECOVERY when you do the tail log backup
0
 

Author Closing Comment

by:RTSol
ID: 37815492
Thanks - that made the trick.

Best regards
RTSol
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question