Sql-server – Why does Veritas backup take longer through CMDEXEC than cmd

backupjobssql serversql server 2014

"c:\...\dbbackex.exe" -f "C:\...\backup.bch" -p policy_name -s server_name -np

The above command, when run from command line takes something like 30sec to finish for a small db or transaction logs. When I run the same command in a job step using CMDEXEC step type it takes right around 10 minutes.

In NetBackups I don't see the job in the status view until that last 30 seconds when the job is actually doing something, but I DO see a process kick off in the task mgr.

I've already talked to our NetBackups admin. He showed me his log. It clearly indicates the task is only taking the 30sec that it always does, so the slowdown is definitely local to the sql server.

I've already tried using cmd-xpshell in a tsql statement. Same results.
To be clear: the job does finish. I don't get access denied errors or anything like that, it just takes much much longer.

Edit for future googlers

I talked with our NetBackups lead and she said she had seen it before but was never able to ping it down. For now we are in research mode, so nothing super helpful, but at least I'm not crazy!

Best Answer

I can't tell you why with the information provided, but I can give you some guidance to figuring it out.

Monitor your wait statistics while the longer job is running. You should be able to figure out which session is running the backup, see what it is waiting on. sys.dm_exec_requests will tell you this (check the wait_type, and also look at blocking_session_id in case it is getting blocked), you'll just need to refresh often.

Or you could roll up your sleeves and run a targeted extended events session, or turn on trace flags that give more insight into slow backups (see here).