I have a java application that:
Reads a .bak file from a windows fileshare and restores it in SQL Server on a remote windows server
Does various modifications on the database restored from the
.bakfile in step 1
Backup the resulting database to a temporary .bak file (called
somename.bak_tmp) on a windows fileshare
somename.bak(in the same directory on the same windows fileshare)
All the above steps works fine sometimes... I modified the rename code at some point which basically does this:
executeSql("master..xp_cmdShell 'rename "+tmpFile+" "+newName+"'");
to use the full path as
newName. As a result the renaming failed. But now I cannot remove the
somename.bak_tmp from the fileshare. Actually I cannot even see it (only the parent folder that contains it).
I have tried to delete the restored database from SQL Server but I still cannot delete the folder containing
somename.bak_tmp. I get an
Access Denied if I try to open it. If I right click the folder it says this on the owner tab:
Unable to display current owner.
And I cannot change the owner to Administrator even though I am logged in as administrator. Any ideas on what have happened to the folder during the failed rename and how to remove it?