Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Tara's DB Backup Script....Revisited

Author  Topic 

beanz
Starting Member

35 Posts

Posted - 2005-06-14 : 13:38:13
Is anyone around who has implemented these?

I'm trying to implement them on another server and am having problems deleting the older backups. No errors are recorded and the backup is performed fine.

How could I go about troubleshooting this?

Cheers,
Danny

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-06-14 : 22:06:04
See if the account you are testing with has delete file permissions on the directory. I would start there. It's also helpful to post error messages.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

beanz
Starting Member

35 Posts

Posted - 2005-06-15 : 05:40:39
Thanks for the response.

The account that SQL runs under has full control of the backup folders but the job itself is run as SA - how do I give this account permission on a folder?

I don't have an option to set any other user to run the job as.

Danny
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-06-15 : 21:55:30
If the job running this is sa, then the service account that SQL Agent runs under will be the user that needs access to the backup folder. Let us know if that works.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

beanz
Starting Member

35 Posts

Posted - 2005-06-20 : 03:57:02
sorry for the late follow up!

The account that the SQL Agent service runs under has full control of the folder in question yet the backups aren't deleting...

What is the best way to go about debugging this?

Cheers,
Danny
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-06-20 : 09:25:05
I would put some statements in the SProc that "log" to a table created for the purpose. @@ERROR and @@ROWCOUNT values after each step, and so on.

Kristen
Go to Top of Page

beanz
Starting Member

35 Posts

Posted - 2005-06-20 : 09:32:14
I've just noticed something when running this again.

If i run the proc on the remote server from my machine using QA logged in as myself then it runs fine. Running it on the actual server as sa/service account then the older files aren't deleted...

I have the same permissions as the Sql Service account.

Danny
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-06-20 : 10:32:55
"I have the same permissions as the Sql Service account"

Log into the server and check the Effective Permissions of the folder in question for each of the user accounts?

Kristen
Go to Top of Page

beanz
Starting Member

35 Posts

Posted - 2005-06-20 : 12:39:41
I've managed to fix this issue!

I took a look at my earlier post about Tara's backup script at:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49192

I changed the SET DATEFORMAT line from "mdy" to the UK format "dmy" and it worked first time. I checked all the regional settings in SQL Enterprise Manager and in Windows and they match between the two machines!

Can anyone shed any light on how/why the change worked??

Thank you to everyone for your input, it's greatly appreciated!

Danny
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-06-21 : 14:14:37
Tara's script, IIRC, is interpreting the output from a DOS DIR, and that will display the filedate in the Date Format of the machine its set up on, so would probably need tinkering with for US / UK / Japanese style dates.

Kristen
Go to Top of Page

beanz
Starting Member

35 Posts

Posted - 2005-06-21 : 18:09:37
Thanks for the follow up Kristen. That does seem to be the case - I just can't understand why two machines that are configured identically would need different date formatting...

Cheers,
Danny
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-06-21 : 18:31:41
Just noticed this thread. Another user had the same issue as yourself. I'm glad you were able to realize the problem. My sheltered world over here assumes everyone is in the US.

Tara
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-06-22 : 07:04:34
"My sheltered world over here assumes everyone is in the US"

The USA is just an island really, eh? Unlike us ....

... famous newspaper headline here, from a long time ago:

"Continent cut off by fog"

Kristen
Go to Top of Page
   

- Advertisement -