1

I tried to use sqlmaint.exe tool to back up a database on a remote PC. Here is an example of backup:

sqlmaint.exe -S remoteSQLServer\SQLInstance -U username -P pwdxxx -D myDB 
   -BkUpMedia DISK -BkUpDB C:\MSSQL_Backups -DelBkUps 3days ...

Here I specified to delete backups older than 3 days. However, the job seems not deleting old bak files on the remote PC(where the SQL server sits). The remote PC has Windows 2008 Server. I also set the C:\MSQL_Backups as shared network drive for EnyOne as owner. My understanding is that the job will delete any bak files older than 3 days. Not sure what I missed?

By the way, the job runs at a box with SQL server 2005 installed.

0

2 Answers 2

1

I dont have experience with the sqlmaint.exe. especially on a windows server 2008. Install the newest MS SQL 2005 patches and try to run the command again. May be this helps.

Do you want to run the backup job regularly? You can create a maintenance plan with the sql management studio. In the Maintenance plan you can create a cleanup job which deletes the old backups.

the maintenance plans are a very good and stable way to create backups of your ms sql 2005 db's.

You also should set more restrictive access to the network share. else everyone can create a new database from your backups or just delete them for fun.

You could also take a look at the tool forfiles.exe. With this tool it's possible to search for files which meets some specified criteria and delete them (or do whatever you want).

Have a nice day.

1
  • I thought about cleanup job as separate process on a remote PC (where SQL db sits). If I can get sqlMaint.exe to work as expected, that would be great. Nov 18, 2009 at 16:51
0

This simple command will do what your are looking for on Windows 2003 server

forfiles /P D:\FTP\LocalUser\svrbkp\live\webfiles /s /D -30 /M *.zip /C " cmd /c del @path" Pls refer my blog

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .