Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RESTORE LOG Issue

Status
Not open for further replies.

richrich05

Programmer
Aug 15, 2005
24
US
Hi I have accidentally dropped six key tables from my database and i'm trying to recover them from the transaction log. Whenever i use the following command in sql query analyzer.

USE Master

RESTORE LOG TSIT
FROM DISK = 'D:\Databases\Microsoft SQL Server\TeamDB\Data\MSSQL\Data\TeamDB_Log.LDF'
WITH STOPAT = N'3/22/2010 6:01:45 AM', With NORECOVERY


I get the following error

Incorrect syntax near the keyword 'With'.

So when i take out 'With' i get this error

The preceding restore operation did not specify WITH NORECOVERY or WITH STANDBY. Restart the restore sequence, specifying WITH NORECOVERY or WITH STANDBY for all but the final step.

so what gives what can i do to fix it?
 
Try

RESTORE LOG TSIT
FROM DISK = 'D:\Databases\Microsoft SQL Server\TeamDB\Data\MSSQL\Data\TeamDB_Log.LDF'
with norecovery,
WITH STOPAT = N'3/22/2010 6:01:45 AM'
 
Per the BOL,

Code:
RESTORE LOG TSIT
FROM DISK = 'D:\Databases\Microsoft SQL Server\TeamDB\Data\MSSQL\Data\TeamDB_Log.LDF'
WITH NORECOVERY,
STOPAT N'3/22/2010 6:01:45 AM'
/code]

Notice only one WITH is used and the NORECOVERY comes first.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Try

RESTORE DATABASE DB
FROM Backups
WITH MOVE 'Data' TO 'C:\MySQLServer\tdb.mdf',
MOVE 'Works_Log' TO 'C:\MySQLServer\tdb.ldf';
GO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top