Necessidades de um Backup

Hoje em dia é essencial que um administrador possua alguma rotina de backup diário do seu banco de dados. A Locaweb possui uma rotina de backup onde faz uma cópia de segurança diária das suas bases de dados. Veja nossa wiki sobre Backup.

Neste documento, mostraremos como criar sua própria rotina de backup para sua base de dados PostgresSQL e armazená-la em sua área de hospedagem.

 

Alertamos que o uso deste foi homologado apenas para bases com tamanho igual ou inferior à 20MB e por isso não garantimos que o mesmo seja funcional para bases de dados com grandes quantidades de dados!

 

Criando sua rotina de backups

Criação do arquivo backup_postgres.sh

 

#!/usr/bin/bash #Variaveis server="postgres01.dominio.com.br"   #Servidor postgres  login="login_da_base"                #login da base pw="*******"                         #senha nome_temp="all"                      #nome do arquivo temporário postgres bk="$HOME/backup_postgres/"          #Diretório para salvar arquivos de backup nw=$(date "+%Y%m%d")                 #Buscar pela data nb=3                                #número de cópias do banco de dados function backup() {  echo "Realizando backup do servidor postgres"  export PGPASSWORD=$pw  pg_dump -v -F c -h $server $login -U $login -i > "$HOME/$hs.dmp"  echo "Compactando arquivo de backup $fn.dmp.gz ..."  gzip -f "$HOME/"$fn.dmp  if [ -d $bk ]; then    continue  else    mkdir $bk  fi  cp -f "$HOME/"$hs.dmp.gz "$bk/$nw.dmp.gz"  a=0  b=$(ls -t $bk)  c=$nb  for arq in $b; do    a=$(($a+1))    if [ "$a" -gt $c ];  then      rm -f "$bk/$arq"    fi  done } backup postgres

Pronto! Salve este arquivo em sua área de hospedagem, na raíz, no mesmo nível que a pasta public_html/. Este arquivo backup_postgres.sh será o responsável por criar o diretório backup_postgres/ em sua área de hospedagem, na raíz e irá realizar um backup diário da sua base de dados, armazenando sempre os últimos 03 dias. Os arquivos de backups serão compactados e ficarão salvos em:

/home/login-de-FTP/backup_postgres/

Lembre-se apenas de dar permissão 755 no arquivo a ser executado.

 

Atenção: O código mencionado acima é somente um exemplo. Caso haja dúvidas quanto sua utilização, sugerimos que verifique juntamente a um desenvolvedor de sua confiança.

 

Esse artigo ajudou você?

119 respostas para “Backups Automáticos para banco de dados Postgres”

  1. window security

    With havin so much content and articles do you ever run into any issues of plagorism or copyright violation? My blog has a lot of unique content I’ve either created myself or outsourced but it looks like a lot of it is popping it up all over the internet without my agreement. Do you know any solutions to help reduce content from being stolen? I’d certainly appreciate it.

    Responder
  2. plumbing companies read what he said

    Hey just wanted to give you a quick heads up and let you know a few of the pictures aren’t loading correctly. I’m not sure why but I think its a linking issue. I’ve tried it in two different browsers and both show the same outcome.

    Responder
  3. find more Aoqinews.com

    Thank you, I have recently been looking for info about this topic for ages and yours is the best I’ve discovered so far. But, what about the conclusion? Are you sure about the source?

    Responder
  4. see this ArvoNews.com

    Great website! I am loving it!! Will come back again. I am taking your feeds also.

    Responder
  5. Home Page Brawlernews.com

    I’m still learning from you, while I’m trying to achieve my goals. I definitely love reading everything that is written on your website.Keep the information coming. I enjoyed it!

    Responder
  6. click this

    I got what you intend, thanks for putting up. Woh I am glad to find this website through google

    Responder
  7. Shy Bladder Syndrome

    I really enjoyed this article and will be back to see more Love it!

    Responder
  8. netsportworld

    There is certainly a great deal to learn about this issue. I love all of the points you made.

    Responder
  9. check it out icetimesmagazine.com

    Heya i’m for the first time here. I came across this board and I find It truly useful & it helped me out a lot. I hope to give one thing back and help others like you helped me.

    Responder
  10. chewhosting

    Good post. I learn something totally new and challenging on websites I stumbleupon everyday. It’s always useful to read through content from other writers and use something from their sites.

    Responder
  11. click this link now 7 live news

    I’m not sure why but this site is loading extremely slow for me. Is anyone else having this problem or is it a issue on my end? I’ll check back later on and see if the problem still exists.

    Responder
  12. original site phtimesng.com

    Normally I do not read article on blogs, but I wish to say that this write-up very forced me to try and do it! Your writing style has been amazed me. Thanks, quite nice post.

    Responder
  13. download lagu

    Hello, There’s no doubt that your website might be having browser compatibility problems. Whenever I look at your site in Safari, it looks fine however, when opening in Internet Explorer, it’s got some overlapping issues. I just wanted to give you a quick heads up! Besides that, fantastic site.

    Responder
  14. Solomon Addicks

    Hi there, just became alert to your blog through Google, and found that it is truly informative. I am gonna watch out for brussels. I will be grateful if you continue this in future. Many people will be benefited from your writing. Cheers!

    Responder
  15. click now Arajilinenews.com

    There is apparently a lot to know about this. I believe you made certain good points in features also.

    Responder
  16. sliding screen doors las vegas

    Hi would you mind letting me know which webhost you’re using? I’ve loaded your blog in 3 different internet browsers and I must say this blog loads a lot quicker then most. Can you recommend a good hosting provider at a reasonable price? Thanks, I appreciate it!

    Responder
  17. special info 51kannews.com

    Howdy! This is kind of off topic but I need some advice from an established blog. Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty fast. I’m thinking about creating my own but I’m not sure where to begin. Do you have any ideas or suggestions? Appreciate it

    Responder
  18. click here

    The article posted was very informative and useful. You people are doing a great job. Keep going.water delivery

    Responder
  19. Mica Curriere

    As I website possessor I believe the content material here is rattling wonderful , appreciate it for your efforts. You should keep it up forever! Best of luck.

    Responder
  20. click this AbnewsBD.com

    I like the valuable information you provide in your articles. I’ll bookmark your blog and check once more right here regularly. I’m rather certain I will be told a lot of new stuff right right here! Good luck for the next!

    Responder
  21. Click Here legalorium.com

    I think other web-site proprietors should take this website as an model, very clean and great user friendly style and design, as well as the content. You’re an expert in this topic!

    Responder
  22. https://apnews.com/press-release/kisspr/lifestyle-nutrition-stress-medication-mental-health-66da727f167882320f97f69b1992e247

    Excellent article! We are linking to this particularly great content on our website. Keep up the good writing.

    Responder
  23. view it Aanewshop.com

    Heya i’m for the first time here. I found this board and I find It really useful & it helped me out a lot. I hope to give something back and help others like you aided me.

    Responder
  24. Credit sweeps

    Your style is really unique compared to other people I’ve read stuff from. Thank you for posting when you’ve got the opportunity, Guess I’ll just bookmark this web site.

    Responder
  25. Alexander Darvile

    Nice blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple adjustements would really make my blog shine. Please let me know where you got your design. Appreciate it

    Responder
  26. 1nza.com

    This is the perfect website for anyone who wants to understand this topic. You know a whole lot its almost tough to argue with you (not that I actually will need to…HaHa). You certainly put a fresh spin on a topic which has been written about for many years. Excellent stuff, just wonderful.

    Responder
  27. fun

    Good post. I learn something totally new and challenging on websites I stumbleupon on a daily basis. It’s always exciting to read articles from other writers and practice something from their sites.

    Responder
  28. read the full info here australnews.com

    I loved as much as you will receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get bought an impatience over that you wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly a lot often inside case you shield this increase.

    Responder
  29. a fantastic read Lindoron.com

    As I website possessor I believe the content material here is rattling excellent , appreciate it for your hard work. You should keep it up forever! Good Luck.

    Responder
  30. Military Models

    This is a topic that’s close to my heart… Cheers! Exactly where are your contact details though?

    Responder
  31. real estate agents

    Good post. I learn something new and challenging on blogs I stumbleupon every day. It’s always exciting to read articles from other authors and use something from other sites.

    Responder
  32. Mauricio Hole

    This web site is actually a walk-through its the details you wished about it and didn’t know who must. Glimpse here, and you’ll certainly discover it.

    Responder
  33. Weekender

    Pretty! This was an extremely wonderful post. Thanks for providing this information.

    Responder
  34. Electric screwdrivers

    Hi there! I could have sworn I’ve visited this blog before but after looking at a few of the posts I realized it’s new to me. Nonetheless, I’m certainly pleased I found it and I’ll be bookmarking it and checking back regularly!

    Responder
  35. porno

    Thanks for giving your ideas right here. The other point is that if a problem develops with a computer motherboard, individuals should not take the risk associated with repairing the item themselves for if it is not done right it can lead to permanent damage to an entire laptop. It will always be safe just to approach any dealer of a laptop for your repair of its motherboard. They have technicians who have an competence in dealing with pc motherboard problems and can get the right analysis and execute repairs.

    Responder
  36. usine bois

    Whats up very cool website!! Guy .. Beautiful .. Wonderful .. I will bookmark your web site and take the feeds additionally¡KI am happy to find so many useful information right here in the submit, we need work out extra techniques on this regard, thanks for sharing. . . . . .

    Responder
  37. Check This Out TgnTimes.com

    Woah! I’m really digging the template/theme of this website. It’s simple, yet effective. A lot of times it’s challenging to get that “perfect balance” between user friendliness and visual appeal. I must say that you’ve done a great job with this. Also, the blog loads extremely fast for me on Internet explorer. Exceptional Blog!

    Responder
  38. this post legal-news-central.com

    I like what you guys are up too. Such smart work and reporting! Keep up the excellent works guys I have incorporated you guys to my blogroll. I think it’ll improve the value of my web site 🙂

    Responder
  39. linked here electrician contractor

    I believe this is one of the so much vital information for me. And i am glad reading your article. But want to commentary on some normal issues, The site taste is great, the articles is really excellent : D. Good task, cheers

    Responder
  40. electronics sales daily

    bookmarked!!, I like your website!

    Responder
  41. Top cheap flights site

    Greetings! Very useful advice within this post! It’s the little changes that produce the most important changes. Thanks a lot for sharing!

    Responder
  42. local plumbers useful site

    I was just looking for this info for some time. After six hours of continuous Googleing, finally I got it in your website. I wonder what’s the lack of Google strategy that don’t rank this kind of informative web sites in top of the list. Generally the top websites are full of garbage.

    Responder
  43. see here suburbanews.com

    I have been browsing on-line greater than 3 hours lately, yet I never found any fascinating article like yours. It is pretty value enough for me. Personally, if all site owners and bloggers made good content as you did, the internet will probably be much more useful than ever before.

    Responder
  44. click this

    I like what you guys are up too. Such intelligent work and reporting! Carry on the excellent works guys I have incorporated you guys to my blogroll. I think it will improve the value of my web site

    Responder
  45. useful reference scaldingcoffee.com

    It’s actually a cool and useful piece of info. I’m happy that you just shared this helpful information with us. Please keep us informed like this. Thanks for sharing.

    Responder
  46. Doyle Krabill

    when i cook at home, i always make sure that i only cook healthy recipes because i don’t want to get fat,.

    Responder
  47. free sound effect

    A motivating discussion is definitely worth comment. I think that you should write more about this topic, it may not be a taboo matter but usually folks don’t discuss such subjects. To the next! Best wishes!

    Responder
  48. game news

    Very good article! We will be linking to this particularly great article on our website. Keep up the good writing.

    Responder
  49. Synapse XT reviews

    I really like it when folks get together and share ideas. Great website, stick with it!

    Responder
  50. discover here

    Howdy! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results. If you know of any please share. Kudos!

    Responder
  51. look at this web-site

    Good day very cool blog!! Man .. Excellent .. Wonderful .. I will bookmark your web site and take the feeds additionally…I’m happy to find numerous useful info here in the publish, we want work out extra strategies in this regard, thanks for sharing.

    Responder
  52. The Patriots Social Network Capmocracy.com

    Oh my goodness! Incredible article dude! Thanks, However I am experiencing issues with your RSS. I don’t understand the reason why I am unable to join it. Is there anyone else getting similar RSS problems? Anyone who knows the solution will you kindly respond? Thanks.

    Responder
  53. Lisha Correla

    Wow post thanks! We think your articles are great and want more soon. We love anything to do with word games/word play.

    Responder
  54. JBOKeo

    Aw, this was an exceptionally nice post. Taking the time and actual effort to create a great article… but what can I say… I hesitate a whole lot and don’t seem to get nearly anything done.

    Responder
  55. movies

    Howdy! This blog post couldn’t be written much better! Going through this article reminds me of my previous roommate! He always kept preaching about this. I’ll forward this article to him. Pretty sure he will have a great read. Thank you for sharing!

    Responder
  56. Theo Turnbough

    HOPE I DIDNT MISS OUT ON THE FOOD… IM STARVING….|MsAndreaBlue|

    Responder
  57. online-casino20.

    I agree with your opinion. From now on I will always support you.

    Responder
  58. Office moving company

    Youre so cool! I dont suppose Ive read anything like this before. So nice to find someone with some original ideas on this subject. realy thank you for beginning this up. this website is something that is needed on the web, somebody with a little bit originality. useful job for bringing one thing new to the internet!

    Responder
  59. 36dd lingerie

    I have not checked in here for a while since I thought it was getting boring, but the last several posts are great quality so I guess I’ll add you back to my everyday bloglist. You deserve it my friend 🙂

    Responder
  60. flogger

    I discovered more something totally new on this weight loss issue. Just one issue is a good nutrition is vital whenever dieting. A tremendous reduction in fast foods, sugary foodstuff, fried foods, sweet foods, red meat, and whitened flour products might be necessary. Possessing wastes unwanted organisms, and toxic compounds may prevent desired goals for losing weight. While particular drugs for the short term solve the matter, the bad side effects are not worth it, and in addition they never offer more than a temporary solution. It is just a known incontrovertible fact that 95 of celebrity diets fail. Many thanks sharing your notions on this blog site.

    Responder
  61. 출장마사지

    Hi, I do believe this is an excellent web site. I stumbledupon it 😉 I will return yet again since i have saved as a favorite it. Money and freedom is the greatest way to change, may you be rich and continue to help others.

    Responder
  62. Pest Control Ando

    This blog is great. I’ll be back soon to see more. Thanks so much! Have a nice day!

    Responder
  63. Allen Selestewa

    Having read this I thought it was rather informative. I appreciate you finding the time and energy to put Pasaran Taruhan Bola SBOBet Online this information together. I once again find myself personally spending a lot of time both reading and leaving comments

    Responder
  64. ProstaStream official website

    An impressive share! I’ve just forwarded this onto a coworker who was doing a little research on this. And he actually ordered me breakfast simply because I discovered it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx for spending some time to talk about this matter here on your internet site.

    Responder
  65. plus size babydoll chemise

    But wanna remark on few general things, The website design is perfect, the written content is really excellent. “The idea of God is the sole wrong for which I cannot forgive mankind.” by Marquis de Sade.

    Responder
  66. glamour lingerie

    of course like your web-site however you need to test the spelling on quite a few of your posts. Several of them are rife with spelling problems and I to find it very bothersome to inform the truth nevertheless I will surely come back again.

    Responder
  67. cheap viagra for sale

    I like reading through a post that will make people think. Also, thank you for permitting me to comment.

    Responder
  68. mamashop.com.au

    You’ve made some decent points there. I checked on the web for additional information about the issue and found most people will go along with your views on this website.

    Responder
  69. Skincell Pro

    Way cool! Some very valid points! I appreciate you penning this post plus the rest of the site is also very good.

    Responder
  70. more info

    I’d must check with you here. Which is not something I often do! I enjoy reading a post that may make folks think. Also, thanks for permitting me to comment!

    Responder
  71. cbd oil hicbdbye

    F*ckin’ tremendous things here. I’m very happy to see your article. Thank you a lot and i’m looking forward to touch you. Will you kindly drop me a mail? cbd for cats buy cbd

    Responder
  72. Cherry Pie Feminized Cannabis Seeds

    I enjoy looking through a post that can make men and women think. Also, thank you for allowing for me to comment.

    Responder
  73. Merrie Patrick

    Thank you, I’ve just been searching for information about this topic for a while and yours is the greatest I’ve discovered till now. But, what in regards to the conclusion? Are you sure concerning the supply?Leighann Deines

    Responder
  74. baby doll lingerie

    Heya i’m for the first time here. I came across this board and I find It really useful & it helped me out much. I hope to give something back and aid others like you aided me.

    Responder
  75. Sex toy gifts

    I have observed that online education is getting popular because obtaining your college degree online has developed into popular choice for many people. A large number of people have not had an opportunity to attend a traditional college or university nonetheless seek the increased earning potential and career advancement that a Bachelor’s Degree gives. Still others might have a diploma in one course but would want to pursue anything they now have an interest in.

    Responder
  76. free horror

    Aw, this was an extremely good post. Finding the time and actual effort to make a top notch article… but what can I say… I put things off a lot and don’t seem to get nearly anything done.

    Responder
  77. fashion

    You should be a part of a contest for one of the best websites on the web. I am going to highly recommend this blog!

    Responder
  78. Milford Huver

    Having read this I thought it was very informative. I appreciate you finding the time and energy to put Rumus Bermain Dingdong this short article together. I once again find myself personally spending a significant amount of time both reading and commenting

    Responder
  79. Millard Romenesko

    I’ve been absent for some time, but now I remember why I used to love this web site. Thank you, I’ll try and check back more frequently. How frequently you update your website?

    Responder
  80. Aptitude Tests

    I must thank you for the efforts you’ve put in writing this site. I really hope to see the same high-grade blog posts by you in the future as well. In fact, your creative writing abilities has encouraged me to get my own, personal blog now 😉

    Responder
  81. eyeliner

    Aw, this was an incredibly nice post. Taking a few minutes and actual effort to create a really good article… but what can I say… I put things off a whole lot and don’t manage to get anything done.

    Responder
  82. Roberto Bonenfant

    There is noticeably a lot of money to understand this. I assume you have made particular nice points in functions also.

    Responder
  83. Pretty Gaming

    Hello there! I simply would like to offer you a big thumbs up for your excellent info you have got right here on this post. I’ll be returning to your web site for more soon.

    Responder
  84. Delta 8 THC gummies

    This is a topic that is close to my heart… Take care! Exactly where can I find the contact details for questions?

    Responder
  85. Gertrude Burgoyne

    Nice one, there is actually some great facts on this post some of my subscribers may find this useful, will send them a link, many thanks.

    Responder
  86. Devin Leuthauser

    You are a great writer thanks. I love sucking dick btw hmu

    Responder
  87. DC white glove delivery

    I know this if off topic but I’m looking into starting my own weblog and was curious what all is needed to get set up? I’m assuming having a blog like yours would cost a pretty penny? I’m not very internet savvy so I’m not 100 certain. Any tips or advice would be greatly appreciated. Appreciate it

    Responder
  88. Linwood Galyean

    wireless routers are very necessary nowadays because we do not want so many wires running around the home*

    Responder
  89. who Qualifies For medicare

    Excellnt post. I was checking continuously this blog and
    I am impressed! Extreemely useful information. I care for
    such information a lot. I was looking for this certain information for a very long time.Thank you and good luck.

    Responder
  90. 스포츠 북

    Best view i have ever seen !

    Responder
  91. Ettie Nunoz

    Great site, I will stop by more often to read your posts.

    Responder
  92. medicare part d providers

    Well composed articles like yours renews my faith inn today’s writers.You’ve written information I cann finslly agree on and also use.Many thanks for sharing.

    Responder
  93. XINRISHENG Bici elettriche in vendita

    Only a smiling visitant here to share the love (:, btw outstanding design and style .

    Responder
  94. water heater repair near me see here now

    I’m usually to running a blog and i actually respect your content. The article has actually peaks my interest. I’m going to bookmark your web site and hold checking for brand spanking new information.

    Responder
  95. foundation companies in san antonio tx

    I’ll immediately grab your rss feed as I can’t find your email subscription link or newsletter service. Do you’ve any? Please let me know so that I could subscribe. Thanks.

    Responder
  96. How does VitalFlow work?

    You’ve made some really good points there. I looked on the web to find out more about the issue and found most individuals will go along with your views on this web site.

    Responder
  97. home warranty cost

    Hello everyone, it’s my first visit at this website, and piece oof wriging is genuinely fruitful designed ffor me, keep up posting such articles or reviews.

    Responder
  98. master plumber more tips here

    We are a group of volunteers and starting a new scheme in our community. Your site provided us with useful information to paintings on. You have done a formidable task and our whole group will probably be thankful to you.

    Responder
  99. home warranty Coverage

    I need to to thank you for this fantastic read!!

    I definitely enjoyed every bit of it.I have got you book-marked to look at
    new things you post…

    Responder
  100. 마사지알바

    I was so impressed because of your blog. Thank you so much.

    Responder
  101. find

    I simply want to tell you that I am just all new to blogging and site-building and seriously savored your blog site. More than likely I’m planning to bookmark your blog post . You definitely have fabulous writings. Thanks for revealing your webpage.

    Responder
  102. Playset assembly service

    You completed some good points there. I did a search on the topic and found mainly persons will consent with your blog.

    Responder
  103. house remodeling

    fantastic points altogether, you simply gained a new reader. What would you recommend about your post that you made a few days ago? Any positive?

    Responder
  104. look at this web-site

    This is the proper weblog for anybody who desires to search out out about this topic. You notice so much its almost onerous to argue with you (not that I really would need…HaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, just nice!

    Responder
  105. Pool table refelting

    Admiring the commitment you put into your website and detailed information you provide. It’s great to come across a blog every once in a while that isn’t the same outdated rehashed material. Fantastic read! I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

    Responder
  106. 3 digital marketing tools

    Thanks for ones marvelous posting! I quite enjoyed reading it, you could be a great author.I will be sure to bookmark your blog and will often come back later on. I want to encourage you continue your great work, have a nice day!

    Responder
  107. roadside assistance

    Excellent blog here! Also your website loads up fast! What host are you using? Can I get your affiliate link to your host? I wish my web site loaded up as fast as yours lol

    Responder
  108. Recommended Site

    Very interesting info!Perfect just what I was looking for!

    Responder
  109. alberta car towing

    I’m still learning from you, while I’m making my way to the top as well. I definitely liked reading everything that is written on your site.Keep the stories coming. I liked it!

    Responder
  110. find here

    I just want to say I’m all new to blogging and definitely enjoyed you’re blog site. Likely I’m likely to bookmark your site . You really come with very good articles. Cheers for sharing with us your website page.

    Responder
  111. Virginia pool table movers

    Its excellent as your other posts : D, thanks for putting up. “The art of love … is largely the art of persistence.” by Albert Ellis.

    Responder
  112. browse around here

    What’s Happening i’m new to this, I stumbled upon this I have found It absolutely helpful and it has helped me out loads. I hope to give a contribution & aid other customers like its helped me. Good job.

    Responder
  113. visit this page

    Sweet blog! I found it while surfing around on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Thanks

    Responder
  114. Bob Pochiba

    I just want to mention I am just beginner to blogs and seriously liked this blog. Probably I’m planning to bookmark your website . You definitely have excellent articles and reviews. Appreciate it for sharing with us your webpage.

    Responder

Comente sobre este conteúdo! Escreva o que pensa, complemente, vamos discutir. O conhecimento é livre!