Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

xp_delete_file not deleting files on share drive Expand / Collapse
Author
Message
Posted Wednesday, August 22, 2012 9:08 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!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
Post #1348487
Posted Saturday, August 25, 2012 2:59 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

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
Post #1350077
Posted Sunday, August 26, 2012 11:45 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!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
Post #1350133
Posted Monday, August 27, 2012 4:03 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

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
Post #1350632
Posted Tuesday, August 28, 2012 3:12 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

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.
Post #1350752
Posted Wednesday, August 29, 2012 4:58 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!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
Post #1351515
Posted Wednesday, August 29, 2012 6:05 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

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"
Post #1351541
Posted Wednesday, August 29, 2012 8:22 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

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
Post #1351655
Posted Wednesday, August 29, 2012 9:13 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

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.



Post #1351694
Posted Wednesday, August 29, 2012 9:44 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!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
Post #1351730
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse