Copy Latest Backups from Backup Path

  • Comments posted to this topic are about the item Copy Latest Backups from Backup Path

    Regards,
    Ajay Dwivedi
    MCP SQL DBA

  • Hello,

    I tried to run the script with the following edits, however nothing happened.

    --1) Specify existing backup path

    SET @BasePath = '\Nas2\sqlbackups\SQL2012TEST\SQL2012TEST\ASBUILTS\FULL';

    --2) Specify new backup path

    SET @BasePath_Target = 'I:\SQLBackups';

    --3) Specify no of batches required

    SET@BatchCount = 2;

    I did not get any errors, the only thing that came back was the following.

    '/***********************************************************************************

    **********************************************************************************

    ****************** CMD SCRIPT TO Copy Backps To NEW BACKUP LOCATION **********

    NOTE: Execute below script on Command Prompt

    **********************************************************************************

    Please note that I am able to map a drive to the following and get to all the files using file explorer.

    \as2\sqlbackups\SQL2012TEST\SQL2012TEST\ASBUILTS\FULL

    Any ideas on how I can resolve this?

  • Hi,

    Can you try executing below sql statement in another query window of SSMS. I suspect that the @BasePath location is not being accessible by SQL Server. If everything is right, you should get all the files & folders from your @BasePath.

    exec xp_dirtree '\Nas2\sqlbackups\SQL2012TEST\SQL2012TEST\ASBUILTS\FULL',1,1

    Else, please try modified path '\\Nas2\sqlbackups\SQL2012TEST\SQL2012TEST\ASBUILTS\FULL' replacing earlier one. Also, verify if path is accessible using Run [+R].

    Regards,
    Ajay Dwivedi
    MCP SQL DBA

  • Hello Ajay,

    The path is accessible, also when I run the following I do see all the files in the query results window.

    exec xp_dirtree '\\Nas2\sqlbackups\SQL2012TEST\SQL2012TEST\ASBUILTS\FULL',1,1

    However I am not clear on what I should do next.

  • Hi Ray,

    I have made few corrections in script. The script is in approval process. Once approved, please try this one. Meanwhile I have mailed a separate copy of script to you as well. Hope this resolves your issue.

    Regards,
    Ajay Dwivedi
    MCP SQL DBA

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply