質問

I created a job to backup my SQL Database, just I am not sure if it is working correctly. In SQL Server 7 when it does a backup you get the mdf, and log files. The file that was backed up doesn't have an extension.

BACKUP DATABASE [TIMECLOCK] TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.CIPHERPOS\MSSQL\Backup\TCBU' WITH NOFORMAT, NOINIT, NAME = N'TIMECLOCK', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO declare @backupSetId as int select @backupSetId = position from msdb..backupset where database_name=N'TIMECLOCK' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N'TIMECLOCK' ) if @backupSetId is null begin raiserror(N'Verify failed. Backup information for database ''TIMECLOCK'' not found.', 16, 1) end RESTORE VERIFYONLY FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.CIPHERPOS\MSSQL\Backup\TCBU' WITH FILE = @backupSetId, NOUNLOAD, NOREWIND GO

TITLE: Microsoft SQL Server Management Studio

Restore failed for Server 'POSWIN2K8\CIPHERPOS'. (Microsoft.SqlServer.SmoExtended)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476


ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: File "TIMECLOCK" cannot be restored over the existing "C:\Program Files\Microsoft SQL Server\MSSQL10_50.CIPHERPOS\MSSQL\DATA\TIMECLOCK.mdf". Reissue the RESTORE statement using WITH REPLACE to overwrite pre-existing files, or WITH MOVE to identify an alternate location. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&LinkId=20476


BUTTONS:

OK

Thanks for the help in advance!

役に立ちましたか?

解決

I had to delete the .mdf .ldf and .ndf database files from the folder before I could restore the backup. The backup restored just fine after that.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top