How can we help you today? How can we help you today?
Matthew Flatt
Hi John, What error message did you encounter when originally trying to restore the corrupted file? Did you try converting it to Native format using our sqb2mtf tool and restoring again? Thanks, / comments
Hi John, What error message did you encounter when originally trying to restore the corrupted file? Did you try converting it to Native format using our sqb2mtf tool and restoring again? Thanks,
0 votes
Hi jortizv, I have the following script which may help, it doesn't exactly meet your requirements though. The script will go through each database on a server and restore a full backup appending 'Test' to the database name. If your backup SQL Server doesn't have the databases already created, you could retrieve the database names from a text file or something similar. The backup part of the script will need editing depending on logical/physical filenames etc USE master DECLARE @dbname NVARCHAR(260) DECLARE @newdbname NVARCHAR(260) DECLARE cDatabases CURSOR FOR SELECT name FROM sysdatabases WHERE name != 'tempdb' AND name != 'master' AND name != 'msdb' --Databases to ignore DECLARE @datestamp VARCHAR(30) DECLARE @restorepath VARCHAR(500) DECLARE @filename VARCHAR(500) DECLARE @restorestring VARCHAR(1000) DECLARE @exitcode INT DECLARE @sqlerrorcode INT SET @restorepath = 'D:\Backup\' --Directory backups are stored OPEN cDatabases FETCH NEXT FROM cDatabases INTO @dbname WHILE @@FETCH_STATUS = 0 BEGIN SET @newdbname = @dbname + 'Test' SET @filename = @restorepath + 'FULL_SQL2005_' + @dbname + '_*.sqb' -- FULL_SQL2005 relates to my template for naming backups - Only 1 full backup for each database can be in the Backup location. SET @restorestring = '-SQL "RESTORE DATABASE [' + @newdbname + '] FROM DISK = ''' + @filename + ''' WITH RECOVERY, MOVE ''' + @dbname + ''' TO ''D:\Data\' + @dbname + '.mdf'', MOVE ''' + @dbname + '_log'' TO ''D:\Data\' + @dbname + '.ldf''" -E' EXEC master..sqlbackup @restorestring, @exitcode OUTPUT, @sqlerrorcode OUTPUT IF ( @exitcode <> 0 ) OR ( @sqlerrorcode <> 0 ) BEGIN RAISERROR ( 'SQL Backup job failed with exitcode: %d SQL error code: %d', 16, 1, @exitcode, @sqlerrorcode ) END FETCH NEXT FROM cDatabases INTO @dbname END CLOSE cDatabases DEALLOCATE cDatabases I hope this is useful for you. / comments
Hi jortizv, I have the following script which may help, it doesn't exactly meet your requirements though. The script will go through each database on a server and restore a full backup appending 'T...
0 votes