In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Full inventory:
#! / bin/bash
# name: full library backup
# backup directory
Back_Dir=date +% Y-%m-%d
# create backup direct
Mkdir / opt/$back_Dir
# definition backup path
Back_path=/opt/$back_Dir
# definition backup command
Command=which mysqldump
EmailFile='/tmp/email.txt'
Echo "" > $emailFile
Echo $(date +% Ymuri% mmury% d''% H:%M:%S) > > $emailFile
# backup DCOM library
$command-- login-path=backtest-- add-locks-Q DCOM > $back_path/$back_Dir.sql
If [[$? = = 0]]; then
Echo $(du-h $back_path/$back_Dir.sql) > > $emailFile
Echo "DataBase DCOM Backup success!" > > $emailFile
Fi
Cat $emailFile | mail-s "Mysql Backup" qujian@joyveb.com
Rm-rf $emailFile
two。 Back up a table with data (only the backup data does not contain table structure)
#! / bin/bash
Path=/opt/sql
Dir=mkdir $path/$ (date +% Y-%m-%d)
Dir1=$ (date +% Y-%m-%d)
Mysql-- login-path=backtest-e "show tables from DCOM" > $path/$dir1/tables.txt
For i in cat $path/$dir1/tables.txt
Do
Number=mysql-- login-path=backtest-e "select count (*) from DCOM.$i" | tail-1
If [$number-gt 0]
Then echo "$I" > > $path/$dir1/datanum.txt
Else echo "$I" > > $path/$dir1/nodatanum.txt
Fi
Done
For tables in cat $path/$dir1/datanum.txt
Do
Mysqldump-login-path=backtest-add-locks-Q-t DCOM $tables > $path/$dir1/$tables.sql
Done
Rm-f $path/$dir1/ {datanum.txt,nodatanum.txt,tables.txt}
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.