Label:SQL Server Service Instance name: 192.168.0.2Name of database to be backed up: aBackup machine name (client side): 192.168.0.3Backup machine User: ZF Password: 123Backup machine domain name: domainfolder where the backup machine provides backup requirements: D:\sqlbak Backing Up the database First step: Create a shared folder on the backup machineCall in program code (or CMD window) net share Sqlbakup=d:\sql
-- The following statement must be executed one by one in the query analyzer. Delete the annotation mark "--" run, and then add "--". Then, execute the next statement.
--
Step 1: create a shared folder on the backup machineProgramCode(Or cmd window)
--
Master .. xp_mongoshell 'md D: \ sqlbak'
--
Master.. xp_mongoshell 'net share sqlbak = D: \ sqlbak'
Tags: style blog http color os ar strong file dataSQL Server Service Instance name: 192.168.0.2Name of database to be backed up: aBackup machine name (client side): 192.168.0.3Backup machine User: ZF Password: 123Backup machine domain name: domainfolder where the backup machine provides backup requirements: D:\sqlbakBacking Up the databaseFirst step: Create a shared folder on the backup machineCall in program code (or CMD window) net share Sqlbakup=d:\sqlbak
Label:drop table Tbl_name Physical deletion. No backup, no binary log Deleting files in the system does not erase the data in the store, but only identifies the block blocks that can be reused for redistribution.So the recovery of data is still hopeful. However, the recovered data blocks cannot be overwritten by other data, and the file system itself is normal. 1. Stop MySQL Now2. View the inode number of the MySQL installation directory. Generally if there is only one MySQL directory on a disk,
you can back up, OK, next add the task plan.
7. Add the D:/php/mysql_backup to the task schedule and select the time each day.According to the monitoring results of the server, 5-8 hours per morning for the low peak traffic. Due to the cleanup of some databases at 5-7, the time can be set at 8 o'clock in the morning.
MySQL Automatic backup------This is from the Web
Time= ' Date +%g%i%d%h%m ' #年月日时分
Db=products
echo "#产品库 \ r \ n" >/sqlbak/${db}_$
network
Time = 'date + % G % I % d % H % m' # time of year, month, and day
Db = products
Echo "# product library \ r \ n">/sqlbak/$ {db }_$ time. SQL # The backup file name is [database name_year Month day hour. SQL]
Mysqldump -- add-drop-table-c -- allow-keywords -- force -- password = 1234567890 -- user = root $ db>/sqlbak/$ {db} _ $ time. SQL
Db = news # Another database
Echo "# News library \ r \ n
monitoring results of the server, the traffic is low every morning from 5 to 8. because some database cleanup operations are performed during the 5-7 period, the time can be set to eight o'clock in the morning.
Automatic mysql backup ------ this article comes from the mobile network
Time = 'date + % G % I % d % H % m' # time of year, month, and day
Db = productsEcho "# product library \ r \ n">/sqlbak/$ {db }_$ time. SQL # The backup file name is [da
Mysql automatic backup time = 'date + % G % I % d % H % M' # yyyy
Db = productsEcho "# product database">/sqlbak/$ {db }_$ time. SQL # The backup file name is [Database name_. SQL]Mysqldump -- add-drop-table-c -- allow-keywords -- force -- password = 1234567890 -- user = root $ db>/sqlbak/$ {db} _ $ time. SQL
Db = news # Another database
Echo "# News Library">/sqlb
Label:Creating a BAT file You need to put 7z.dll and 7z.exe in the bat's sibling directory and Mysqldump.exe these 3 files Echo off
CLS
CD/D%~dp0REM===========configure (start) ==============
Sethost=127.0.0.1
SetUser=AdminSetpass=Configure your MySQL passwordSetDbname=the name of the database to be backed upREM===========configure (end) ==============REMSet-date-and-time-toymd-and-his
Set"ymd=%date:~,4%%date:~5,2%%date:~8,2%"Seth=% Time: ~0,2%
SetH=%h: =0%
Set"his=%h%%time:~3,2%%time:~6,2%"Echo
Here is the script implementation process:1. Automatically package the backup on the server to a Web directory (of course this web directory is inaccessible to other people), so that the script to download.2. Download the backup package on the local server, unzip it and copy it into a dedicated backup directory.3. When the above two steps are completed, we will remove the backup package on the server to avoid leakage.
Here's the script:1. This is to filter out the latest backup on the server an
Recently the World Cup has come, has been busy between work and the World Cup, there is no time to manage my blog, today can only be the whole simple small shell to everyone. The company asked to delete one months before the backup file, so that the hard drive to the whole explosion, on the server looked down, incredibly have 3 months of backup did not clean up, Fortunately, SQL backup, otherwise hard disk space is already full.
Here is my solution:
Copy Code code as follows:
Cat del
Recently the World Cup has come, has been busy between work and the World Cup, there is no time to manage my blog, today can only be the whole simple small shell to everyone. The company asked to delete one months before the backup file, so that the hard drive to the whole explosion, on the server looked down, incredibly have 3 months of backup did not clean up, Fortunately, SQL backup, otherwise hard disk space is already full.
Here is my solution:
Cat delbak.sh
#!/bin/sh
location= "/root/
Shell deletes objects before a specified time.Since the recent World Cup, I have been busy with work and the World Cup, and I have no time to manage my blog. Today, I can only give you a simple little shell. the company asked to delete the backup file one month ago, so that the hard disk would not be cracked. After reading the file on the server, the backup files for three months had not been cleared, fortunately, it is SQL backup, or the hard disk space will be full long ago.The following is my
TemplateCat delbak.sh#!/bin/shlocation= "/root/sqlbak/"Find $location-mtime +30-type f |xargs rm-fPs:Location is the directory where the lookup is set--mtime +30 is set time is 30 days ago-type F this week the type of lookup is fileThen add crontab timing to delete:Crontab-l4 1 * */bin/sh/root/soft_shell/delbak.shSet to 1th on every month. 4:10 execute the script. Of course, you can do it according to your own needs.The same deletion method:Find/root/
original weekly down data back, but also manually to down data is the latest backup on the server, OK, in order to meet this requirement, I made some changes in the original script.
Manual Down Data script:
The code is as follows
Copy Code
#!/usr/bin/expect-fSet Timeout-1Set passwd passwdSpawn ssh-p18330 root@72.11.x.xExpect {"Yes/no" {send "YESR"; Exp_continue}"Password:" {send "$PASSWDR"}}Expect "*#*" {send "Sh/root/soft_shell/copy_newfile.shr"}Spawn Scp-r-p18330
Server online Help2:net use: is a network command inside windows.Function: Connect or disconnect a computer from a shared resource, or display information about a computer connection.This command also controls persistent network connections.3: Backing Up the databaseBackup database A to disk= ' \\192.168.12.30\sqlbak\a.bak 'Backup database A to disk= ' \\192.168.12.30\sqlbak\a1.bak ' with differential (dif
, in the linked server bar, fill in the Ip\ instance name of the standby server, which is the server you want to link to.Note: Here you want to link the standby server, which must be accessible on the primary server. If the standby server is the default instance when you install SQL Server, when you fill out the linked server, you can fill in the IP directly, without adding the instance name, if the SQL Server is a named instance when you installed it, you need to add the instance name. There is
then lock the master database, so that the data is not written in again, and then back up the data in the master database.Flush tables with read lock; the master database locks the table and prevents data from being written.Show master status; view the status of the master database and record the value of FILE and Position.Mysqldump-u root-p db | gzip>/root/sqlbak/db. SQL .gz back up SQL data in the primary database.Slave stop; stop slave from the da
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.