Copy job get failed when we copy a backup file to network drive

  • Dear All,

     

    In Sql server Job, step1 , I wrote T-SQL to take differential  back up to my database and on success action , I specified to go to step 2

     

    In Step 2 , I select “Operating System command “ and I wrote Dos command to copy the Differential backup file to a Network drive.

     

    But when the job executing, first step(Backup) is running fine and when it come to the second process it gets filed.  System showing a message that  “ Acess denied and it is use for some other process”.

     

    How can I copy the files from disk to network drive with out these error message with the backup job.

     

    I am not planning to use log shipping now.  

     

    Regards

     

    Mathew

  • first check that your sqlserver agent service account has the needed rights to you networkdrive.

    I use this doscmd to do the job (without problems)

    XCOPY C:\MSSQL\BACKUP\*.* \\myserver.mydomain.com\bu2tapeDay$\mysqlservername\Database\ /c /s /k /h /v /y

     

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Yes , My Sql Server agent use the Domain Administrator account.

    After back up, with out any delay I try  windows to copy the backfile  to network drive , system showing same message  “ The file is using some other process”

     

    So I feel that this is not SQL Server agent issue,  after complete the backup process , SQL Server still holding the backup file.

     

    After 4 or 5 minutes, users can copy files the to Network Drive.

     

  • can you post you job's DDL ? (full)

     

    btw don't use a domainadmin account to run your sqlserver !

        Keep the guideline "least privilaged users" in mind !

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • I've had a few instances where I create files in jobs and then try to copy them to another location on the network and the copy fails because another process has the resource in use. I have determined the problem to be that as soon as the create step completes, the copy starts in another process, but the OS hasn't had time to close the file yet. In those situations I put a WAITFOR('00:00:01') command in between the two steps, and they work fine. One second seems to take care of the problem.

  • Hi,

    In addition to the Kemp's solution you may try to use Windows Scheduler to copy out the backup and run the scheduled task like 30 min after your SQL backup is completed.

    Regards,Yelena Varsha

  • All good work arounds for the issue. Here's a couple of other thoughts. Does your server have anti-virus software ? It could be readin just the file name/header  in order to exclude it from a scan. Also to truly determine the process that is 'holding' your file you might want to download the Winternals Proecess Viewer - It's a simple zip file, 1 readme, 1 executable and 1 help file and FREE. Just copy the files to your SQL Server and run it. It's a really great tool.

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

  • BACKUP DATABASE [OHMIS] TO  DISK = N'F:\backup\OHMISDIFFBKP\OHMISDIFFBKP' WITH  INIT ,  NOUNLOAD ,  DIFFERENTIAL ,  NAME = N'OHMIS backup',  NOSKIP ,  STATS = 10,  NOFORMAT

  • Symantec Antivirus corporate edition ver 8 antivirus  is running on my sql server and it scan a  new file that is coming on my server.

    Is any way to not run virus when sql create a backup file to my storage(Sorry .. this is not MS SQL question, but I am sure that some one have solutions on his mind)

    Regards

    Mathew

     

     

     

  • Norton (like most anti-virus software) has an 'exclusions' list (actually it's a 'mask' - e.g. *.BAK, *.TRN might have to be added).

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

  • I disable the anitivirus application,again it is not working.

    At last I find the problem,….I find the output file the reason for failing the backup.

    Output file write “System cannot find the drive specified”. I am using a map network drive to copy my backup file.

    SQL server agent and current login are using same user name.

    Through windows I can copy file. But if I try to SQL Server JOB(SQL Agent) message coming write “System cannot find the drive specified”.

     

    There is a map drive and why SQL Agent  not find the map drive? Please advice..

     

    Mathew

  • use UNC-naming :

     

    XCOPY C:\MSSQL\BACKUP\*.* \\myserver.mydomain.com\bu2tapeDay$\mysqlservername\Database\ /c /s /k /h /v /y

    ------ yourfileserver -----\-- share --\-subfolder-\--subfolder--

     

    This is the same stuff you enter when mapping the drive in explorer !

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Thanks for all.

    Backup and copying backup after the backup are working fine.

    Mathew

     

     

     

Viewing 13 posts - 1 through 12 (of 12 total)

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