In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The company has three sql server databases. Every day, the data is backed up locally through sql server scheduling tasks, and then uploaded locally to the data server for preservation. This is repeated, sometimes because the work is busy and forgot to upload, resulting in the phenomenon that the data is replaced without backup.
After learning from Linux, I found that all these are just minor problems, there is no need for so much trouble, so just do it.
By checking the information, sql server can be backed up remotely. If the remote backup function of sql server is configured, the data will be backed up to the designated data storage server every day.
Convert data backup server from windows 7 to centos 6.5
The problem now is that the database files sent by sql server every day have the same file name, and the original backup will be replaced, so that the data can not be saved for many days. If I want to use the script method, when the database backup file is sent, I will create a date folder in the current directory, and then automatically move the database file to this folder, so that the next backup will not be replaced. If the loop
In order to prevent the disk from running out of space, I added find to the script to clean up the data that is longer than 30 days. (find. /-type f-mtime + 30-name "* .bak" | xargs rm-f) only keep it for 30 days, because the company is not very strict about the number of days to keep the database, so I will decide by the disk space.
Then use df-h to check the amount of space on the backup disk and do a daily email to tell the administrator which day's backup was deleted and how much disk space is left.
The following is the script implementation:
#! / bin/bash
WEEK= `date +% w`
# Disk size chkeck
Echo `df-h | awk'{print $4}'| sed-n '5p' | sed-r's # (. *) # Waring / Hddf Avail\ 1 please chkeck Disk#' `> / Shell/backup.log
Find / Hddf/database/-maxdepth 1-mtime + 24-type d!-name "zabbix"!-name "db"!-name "RTX*"-exec rm-rf {}\;
Echo `df-h | awk'{print $4}'| sed-n '5p' | sed-r's # (. *) # Waring / Hddf Avail\ 1 please chkeck Disk#' `> > / Shell/backup.log
If [$?-eq 0]; then
Echo "`date +% y% m% d` deleted successfully `find / Hddf/database/-maxdepth 1-mtime + 24-type d!-name" zabbix "!-name" db "!-name" RTX* "`" > > / Shell/b
Ackup.log
Else
Echo "`date +% y% m% d` deletion was not successful" > > / Shell/backup.log
Fi
# from email admin
Mail-s "databackup" zhongliang@hdbattery.cn > / Shell/mvdata.txt
Fi
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.