Running 'restore verifyonly' from a different server

SQLRocker 126 Reputation points
2021-08-19T23:57:48.507+00:00

So we use ola's solution for backups. Currently running into an issue with t-log backups where if sql fails on the 'restore verifyonly' part - it creates a dump and sql freezes during that time which we are trying to avoid, msft is looking into the issue.

I can disable verify option, but i am looking to see if there is a way to run it from a different non-prod server...

Ola creates different folders for the dbs, each having the 'log' folder for .trn's.

so i am just thinking if anyone else has done this before, somehow i want to give the main backup folder location to the solution , which should then go in and get the .trn filenames and maybe do a restore verifyonly .... i know its a bit complicated and could be messy, but just wanted to see if someone has implemented something similar, thanks.

SQL Server | Other
{count} votes

5 answers

Sort by: Most helpful
  1. SQLRocker 126 Reputation points
    2021-08-20T14:46:07.817+00:00

    Well, the backup trn files are already on a network share, so there is no need for them to be copied over to non-prod server.

    I have already explained why i am looking into this.


  2. SQLRocker 126 Reputation points
    2021-08-23T16:06:47.5+00:00

    @Ola Hallengren - Not sure if i got the right ola, but please let me know about above if any ideas, thanks.

    0 comments No comments

  3. Tom Phillips 17,771 Reputation points
    2021-08-23T21:04:05.107+00:00

    A system dump is not normal. Please make sure you have the current patches installed for your version.
    https://learn.microsoft.com/en-US/troubleshoot/sql/general/determine-version-edition-update-level

    0 comments No comments

  4. SQLRocker 126 Reputation points
    2021-08-24T13:13:07.32+00:00

    @Tom Phillips Yes, that was the 1st thing checked, its already updated.

    @CathyJi-MSFT All that i am trying to see is if someone out there has an automated process to do 'restore verifyonly' from a different server. The .trn's are already going to a network share.

    0 comments No comments

  5. CathyJi-MSFT 22,396 Reputation points Microsoft External Staff
    2021-08-27T08:18:59.467+00:00

    Hi @SQLRocker ,

    > All that i am trying to see is if someone out there has an automated process to do 'restore verifyonly' from a different server. The .trn's are already going to a network share.

    Try below T-SQL. Please change the database names and the file location of back up files in below T-SQL.

    USE [master]  
    
    declare  @DATABASES table(ID INT,DBName  varchar(100))  
    insert into @DATABASES   values  
    
    (1, 'database01'),  
    (2, 'database02'),  
    (3, 'database03'),  
    (4, 'database04'),  
    (5, 'databae05'),  
    (6, 'database06'),  
    (7, 'database07'),  
    (8, 'database08')  
    
    
    DECLARE @DBName nvarchar(50)  
    DECLARE @PATH nvarchar(max)  
    DECLARE @logPATH nvarchar(max)  
    declare @SQL nvarchar(max)  
    DECLARE @count INT  
    SET @count = 1  
    
    WHILE (@COUNT < 30)  
    BEGIN  
    
    SELECT @DBName = (SELECT DBName  
                    FROM @DATABASES  
                    WHERE ID = @count)  
    
    SET @PATH = N'C:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019\MSSQL\Backup\' + @DBName + '.bak'  
    SET @logPATH = N'C:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019\MSSQL\Backup\' + @DBName + '.trn'  
    
    
    
    SET @SQL=N'RESTORE VERIFYONLY FROM DISK =  '''+@logPATH+''''  
    
    PRINT @SQL  
    --exec @SQL  
    EXECUTE sp_executesql @sql  
    
    
    SET @COUNT = @COUNT + 1   
    SET @DBName=''  
    set @SQL=''  
    END  
    GO  
    

    If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.