SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL backups to AWS s3 bucket


SQL backups to AWS s3 bucket

Author
Message
JnrDbaK
JnrDbaK
Mr or Mrs. 500
Mr or Mrs. 500 (542 reputation)Mr or Mrs. 500 (542 reputation)Mr or Mrs. 500 (542 reputation)Mr or Mrs. 500 (542 reputation)Mr or Mrs. 500 (542 reputation)Mr or Mrs. 500 (542 reputation)Mr or Mrs. 500 (542 reputation)Mr or Mrs. 500 (542 reputation)

Group: General Forum Members
Points: 542 Visits: 214
Hello All,

I currently have backup files that are sent to AWS using batch files embedded in windows tasks.

In addition I have a purge task which deletes old backup files after an X amount of days.

Now the issue since the purge tasks runs every night and it needs to keep running I worry that it can delete files which still haven't been uploaded to AWS since some of the files are big (>>>600 GB )

This is my current script which uploads files & logs a trail into a text doc.

@echo START - ABC: %date% %time% >> P:\Aws_times\Daily\ABC\ABCAWSDaily.txt
aws s3 sync P:\Backups\Daily\ABC s3://backups-daily/ABC
@echo END - ABC : %date% %time% >> P:\Aws_times\Daily\ABC\ABCAWSDaily.txt

This is my purging script which deletes files older than 3 days

forfiles -p "P:\Backups\Daily" -s -m *.* -d -3 -c "cmd /c del @path"

Now my questions are:

1. How do I add a script which deletes a file ONLY after it's been uploaded to AWS?
2.In the log files (ABCAWSDaily.txt), there's only time, how do I script it for it to tell me which exactly files have been uploaded?
3. Can this be done by just editing the batch command or do I need to use powershell & if so since I'm a newbie how do I go about it?

Please let me know if this is clear.

Any help regarding this would be appreciated.

To know where you're heading, you gotta know where you been Alien
Mário Pereira
Mário Pereira
SSC-Enthusiastic
SSC-Enthusiastic (114 reputation)SSC-Enthusiastic (114 reputation)SSC-Enthusiastic (114 reputation)SSC-Enthusiastic (114 reputation)SSC-Enthusiastic (114 reputation)SSC-Enthusiastic (114 reputation)SSC-Enthusiastic (114 reputation)SSC-Enthusiastic (114 reputation)

Group: General Forum Members
Points: 114 Visits: 0
Hello JnrDbaK,

You can now export .bak file from a EC2 instance running SQL Server to S3.

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html

But if you want to code everything by you check my GitHub https://github.com/mariopoeta/backupsqlservertos3
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search