First, the database is a large storage of data warehouse, in order to ensure data integrity, to prevent some accidental loss of data, such as the need for data backup and restore.Backing up data does not affect the normal operation of the database.
1. Back up and restore the databaseStart by backing up the database with the following steps:1) put the mouse in the select the database you want to back u
, directly to the entire MySQL backup forget);Mysqldump-uroot-pxxxxx--all-databases > All.sql
mysql when exporting a database with mysqldump "--warning:skipping the data of table M Ysql.event. Specify the--events option explicitly. "
This is because mysqldump default is not to back up the event table, only add the--events, the solution:
plus--events--ignore-table=mysql.events parameters can be;
mysqldump- U
the following stored procedure to the master databaseIf exists (select name from sysobjects where name= ' usp_restoredb ')drop proc Usp_restoredbGo/*EXEC usp_restoredb "library", "D:\bak.bak"*/Create proc Usp_restoredb(@dbname varchar (255),--database name@filepath varchar (255)--File path)AsSET NOCOUNT ON--exec (' Use master go ')EXEC (' ALTER DATABASE ' [email protected]+ ' Set offline with ROLLBACK IMMEDIATE ')EXEC (' Restore database ' [email pro
To restore a database:
The code is as follows
Copy Code
Mysql-h Localhost-u root-p123456 www
To back up a database:
The code is as follows
Copy Code
Mysqldump-h localhost-u root-p123456 www > d:/www2008-2-26.sql
Local:1. Into the MySQL directory under the bin folder: E: Enter;
E:>CD Mysqlbin Carriage return
2. Export database: Mysqldump-u user name-p database name > export
Five: MongoDB import, export, backup, restore, user authorizationOne: Data export, data importAs a DBA (administrator), you often encounter the need to import and export data, as described in the following utilities (bring-your-own):1: Data import MongoexportExport files in CSV format./mongoexport-d test-c User1-o/tmp/user1.out--Specify the location and filename of the export fileDatabase collection (table)
Backup:
Specifically to do this:
The first is to use the root user, must, then to/directory, is the root directory, and then you can use the command given below a key backup, easy:
The code is as follows
Copy Code
Tar cvpzf backup.tgz/--exclude=/proc--exclude=/lost+found--exclude=/backup.tgz--Exclude=/mnt--exclude=/sys
Here a little bit about the code, should have kn
server| Backup | data | database
Back up the database, for example:
BACKUP DATABASE Northwindto DISK = ' C:\Northwind.bak 'Restore the database, for example:
--Returns a result set consisting of a list of databases and log files contained in the backup setRESTORE filelistonlyFrom DISK = ' C:\Northwind.bak '
--
In the previous article we mentioned hot copies (the hot copy of MySQL backup and restore), and hot copies were backed up using the mysqlhotcopy command when MySQL or other database services were running. This article explains how to ensure data consistency. Now suppose there is a situation where we always back up the database in the wee hours, assuming that a database exception occurs after the wee hours,
segment properties (physical properties, storage properties, tablespace, logs, and so on), storage is used to identify segment storage properties, and value is used to specify whether to include segment properties or segment storage properties A object_type used to specify the object type.IMPDP Scott/tiger Directory=dump dumpfile=tab.dmpTransform=segment_attributes:n:table10.transport_datafilesThis option is used to specify the data files to be imported to the target database when moving spaceT
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.