Manage backup biles on network share
Osolage
Posts: 15
I haven't had time to determine whether there's an effective way to use the copy to "Copy backup to network" feature. It seems that when I do this, the original backup file remains on the local disk. Is there a way to force SQL Backup to delete the files on the local disk after the backup is complete? Additionally, is there a way to update the backup catalog with the location of the corresponding file on the network share? (if this is not handled in SQL Backup 5 but is handled in SQL Backup 6, please let me know.)
Thanks,
Ra Osolage
Thanks,
Ra Osolage
Thanks,
Ra Osolage
Ra Osolage
Comments
But there is a command argument to control how many files/days(?) to keep network backup files
and next version of SQL Backup GUI should have better "network" backup management as far as I recall reading on this forum
DBA, MCITP
No, not in the msdb tables. SQL Backup does store details of the backup files in a SQL Server Compact database, located in the "C:\Documents and Settings\All Users\Application Data\Red Gate\SQL Backup\Data\<instance name>" folder. In the backupfiles table, there is a 'file_type' column. A value of 'P' indicates a primary backup file. A value of 'C' indicates a copied file.
You can use the 'sqbdata' extended stored procedure as a proxy to query this database e.g.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
For instance, My SQL server has about 750GB hard drive and about 400GB of SQL data. My full backups compressed to about 70GB. I would like to move that 70GB of data to another network share and bring it back or restore from the network location when needed...
That options isn't available now? If not, is that a planned feature? This has to be a popular way of doing backups I would think.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
Shouldn't this be a user selection?
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
or something...
Otherwise, people are forced to have to manually delete backups locally which can get irritating to have to remember that it has to be done.
will delete all full database backups of the AdventureWorks database in the g:\backups\ folder older created more than 2 hours ago.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
For example, all files older than 3 days are deleted on the local and the copied location?
You can achieve this by having WITH ERASEFILES = x, FILEOPTIONS = 1 in your job which runs. This will then erase both local and remote files according to the same retention period.
Replace x with the number of days you wish to keep the files for. If it is only hours use xh.
I hope this helps.
Redgate Foundry
Thanks for the quick reply. That worked perfectly!
-Adrian
Sorry for not understanding, but where do I execute this at? Do I do this in SQL Server?
Where do I run this at?
Delete existing backup files in this folder for the selected databases.
If you want to also delete files in a secondary location (Copy backup to network) you need to add FILEOPTIONS = 1 to your command if running it manually or edit the SQL Server Agent job in SSMS/EM to include FILEOPTIONS = 1 in the job step.
Running manually would become :
I hope this helps.
Redgate Foundry
When I get to the last screen on the edit job (Step 5 of 5) and I can see the script when I click the script tab, but I can't edit it.
Where do I actually edit the script that is generated?
My script has the following (I put X's in where the stuff you shouldn't care about):
I don't have the FILEOPTIONS in my script...
On this screen click on Steps, make sure the step is highlighted and choose Edit.
You should now see the backup command that the job will run, here you can edit it.
If you are just using the Backup Wizard, you need to copy the the script from the script tab, paste it into SSMS/QA and then edit it to include FILEOPTIONS = 1 before executing it.
Redgate Foundry
So just so I am totally clear, when I add the "FILEOPTIONS = 1" to the script, it will then delete the local and network copy of the backup. Is that correct?
Redgate Foundry
Now when I try to edit the backup job in SQL Backup, I get "The GUI does not support editing the command you selected"
I was able to edit it before I changed the script in SSMS/EM. Now I am unable to do so.
Any ideas? I really don't want to have to manually delete backups that are older than my specified timeframe because I will forget to do it and I will get issues like I did Friday.
Here is my script:
Unfortunately after editing your script to include these parameters you can no longer edit it in the SQL Backup GUI.
What version of the SQL Backup Server Components are you running?
Could you please use Help>Check for updates in the SQL Backup GUI to upgrade to 5.4 and then upgrade the Server Components?
Thanks,
Redgate Foundry
SQL Backup version: 5.4.0.55
Service Application Version: 5.4.0.55
I had manually upgrade to version 5.4 and then when it started it told me my server components needed to be upgraded so I did.
How long ago did you upgrade to version 5.4?
Redgate Foundry
Here is the situation now...
The same script is being used from above, but only the network files are being deleted like they should...I looked in the help file and here is what the help said about fileoptions:
So reading from that, my FILEOPTIONS flag needs to be set to 3 if I want to delete files at BOTH locations that are older than the specified ERASEFILES flag...
is that right?
By reading what the FILEOPTIONS flag does, I have to think this has to be a bug...
If I set it to 1, it will delete the files from the network. Tonight I will run a backup with the flag set to 2 to see if it deletes the files from disk. If that works, then there should be no reason that 3 would not do both (from what the help file explained the flag).
Any help on this would be great.
I have the same situation on my system. Make sure the Windows OS Archive Flag is not set on the local system for the files. SQL Backup will not delete these files if the Archive Flag is set (even if the file meets the date time criteria).
Mike
No. One of the File Attributes Windows puts on a File is "Archived" (A). Read-Only (R), Hidden (H), System (S) are some other File Attributes.
The Archived Flag is designed to be used by backup systems so when a file is created it gets the Archive Flag. When certain Windows backup software backs up the file, it removes the Archive Flag. This is Windows way of protecting files that have not been backed up (to tape or whatever) from being deleted prematurely.
SQL Backup product looks for that flag and if it is set, it will not delete the local .sqb files.
In Windows Explorer, right-click on the File and choose properties. Then click on the "Advanced" button in the Attributes section of the form. The "File is ready for archiving" will be checked if the Archive Flag is true.
Mike
There is no way (that I know of) to prevent Windows from setting this flag when a file is created or modified.
However, you can run a command to remove that flag on an entire directory and all its subdirectories. Just put the following command in a batch file and run it on your desired schedule:
Mike
If that's right (which I am not doubting you, just talking out loud), then there is no way to naturally delete the local files that you create...so the FILEOPTIONS flag is meaningless without doing something manually...
I am fixing to try and run a backup after I remove the archive flag. Coincidentally, the network files have been deleting (when I had the proper FILEOPTIONS flag set) even when the archive flag was set on them...