|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 2:05 AM
Points: 856,
Visits: 2,115
|
|
Hello,
xp_delete_file not deleting files on share drive. is there any permission to be given?
Regards Durai Nagarajan
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: 2 days ago @ 1:56 PM
Points: 1,658,
Visits: 8,564
|
|
I think read/write access to shared location is must.
Manu
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 2:05 AM
Points: 856,
Visits: 2,115
|
|
it has write access as the job is creating the log files backup in the folder which is required.
in which services will the XP_Delete_File runs ,hope that permission might left out.
Regards Durai Nagarajan
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 8:27 PM
Points: 6,735,
Visits: 11,788
|
|
You could always switch to a CmdExec step type. Or write a PowerShell script to interact with the file system, which it is more capable of doing than T-SQL.
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: 2 days ago @ 3:26 AM
Points: 2,621,
Visits: 2,759
|
|
What security context is running the xp_delete_file? Is the shared drive visible to that security context?
Author: SQL Server FineBuild 1-click install and best practice configuration of SQL Server 2012, 2008 R2, 2008 and 2005. 25 March 2013: now over 23,000 downloads. Disclaimer: All information provided is a personal opinion that may not match reality. Concept: "Pizza Apartheid" - the discrimination that separates those who earn enough in one day to buy a pizza if they want one, from those who can not.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 2:05 AM
Points: 856,
Visits: 2,115
|
|
what services will be userd to tun XP_Delete_File. i dont know about that.
opc, i'll try that but how about deleting files on a date range basis.
Regards Durai Nagarajan
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: 2 days ago @ 2:19 PM
Points: 2,037,
Visits: 3,761
|
|
Make sure that your proxy account has access to the location that you are attempting to delete the files. When you use xp_ functions, it uses the proxy account (and it's inherited security from the domain (AD)) by default.
______________________________________________________________________________ "Never argue with an idiot; They'll drag you down to their level and beat you with experience"
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 8:27 PM
Points: 6,735,
Visits: 11,788
|
|
durai nagarajan (8/29/2012) opc, i'll try that but how about deleting files on a date range basis. A simple chore with PowerShell. Here is a one-line PowerShell command that does the work for you. You can execute the command from a PowerShell step type in a SQL Agent job. Adjust constants to suit...remove the -WhatIf to have it really do the deletion:
Get-ChildItem -Path "E:\Backups\" -Filter "*.bak" |? {$_.LastWriteTime -lt (Get-Date).AddDays(-7)} | Remove-Item -WhatIf
To also look in all sub-folders:
Get-ChildItem -Path "E:\Backups\" -Filter "*.bak" -Recurse |? {$_.LastWriteTime -lt (Get-Date).AddDays(-7)} | Remove-Item -WhatIf
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 10:43 AM
Points: 2,945,
Visits: 10,517
|
|
Make sure you have the latest SQL 2005 service pack installed.
There was a problem with deleting files in maintanance plans in the early versions of SQL 2005.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 2:05 AM
Points: 856,
Visits: 2,115
|
|
i never worked in PowerShell do i have to install somehting or am i missing something?
Regards Durai Nagarajan
|
|
|
|