Mysql,sqlsever,oracle,redis,mongo,postgres database backup and recovery instruction collation

Source: Internet
Author: User
Tags diff postgres database

The following list only gives the simplest usage of backup and recovery of each database, more detailed parameters and configuration please refer to the relevant information

First, MySQL:

Parameter description:

$user $password $targethost $port $charset $dbname $table $filename
User name Password IP (local localhost) Port Coding Database name Table name (required for table-level backup only) Filename

Backup: Mysqldump--single-transaction-l-u $user-P ' $password '-H $targethost-P $port--default-character-set= $charset $DBN Ame $table > $filename

Recovery: MySQL $dbname-u $user-P ' $password '-H $targethost-P $port--default-character-set= $charset < $filename


Second, SQL Server:

Note: sqlserver2003 and the following only support osql,sqlserver2005 and above at the same time support osql and SQLCMD, the following methods are common to sqlcmd and osql.

Parameter description:

$user $passwrod $instance $dbname $filename $diff _filename
User name Password Instance Name Database name Full-scale backup file name Incremental backup file name

Full-scale backup: Osql-u $user-P "$password"-D master-s $instance-Q "ALTER DATABASE $dbname SET OFFLINE with ROLLBACK IMMEDIATE; RESTORE DATABASE $dbname from disk= ' $filename ' with REPLACE; ALTER DATABASE $dbname SET ONLINE "

Incremental backup: Osql-u $user-P "$password"-D master-s $instance-Q "ALTER DATABASE $dbname SET OFFLINE with ROLLBACK IMMEDIATE; RESTORE DATABASE $dbname from disk= ' $filename ' with replace,norecovery; RESTORE DATABASE $dbname from disk= ' $diff _filename ' with RECOVERY; ALTER DATABASE $dbname SET ONLINE "

Full volume Recovery: osql-u $user-P "$password"-D master-s $instance-Q "ALTER DATABASE $dbname SET OFFLINE with ROLLBACK IMMEDIATE; RESTORE DATABASE $dbname from disk= ' $filename ' with REPLACE; ALTER DATABASE $dbname SET ONLINE "

Incremental recovery: osql-u $user-P "$password"-D master-s $instance-Q "ALTER DATABASE $dbname SET OFFLINE with ROLLBACK IMMEDIATE; RESTORE DATABASE $dbname from disk= ' $filename ' with replace,norecovery; RESTORE DATABASE $dbname from dist= ' $diff _filename ' with RECOVERY; ALTER DATABASE $dbname SET ONLINE "


Third, Oracle:

Oracle's backup and recovery primarily uses Rman, which is interesting to know more about the specific use of Rman


Four, Redis:

Description: The Redis data backup file is stored in a full path file name consisting of Dir+dbfilename in the configuration file;

Backup: Redis-cli-h targethost-p $port-a $password save

Recovery: Simply place the backup files in the original directory and restart Redis.


Five, MONGO:

Parameter description:

$targethost $port $dbname $backup _dir $user $password $table $recovery _dir
IP Address Port Database name Save path User name Password Table name (table-level recovery) Recovery path

Backup: Mongodump--host $targethost: $port-D $dbname-o $backup _dir-u $user-P $password

Recovery: Mongorestore--host $targethost: $port-D $dbname-u $user-p$password-c $table $recovery _dir


Six, Postgres:

$targethost $port $user $dbname $filename $recovery _file
IP Address Port User name Database name Backup files Recover files

Backup: Pg_dump-c-b-h $targethost-P $port-U "$user" $dbname > $filename

Recovery: psql-h $targethost-P $port-U "$user"-D $dbname-F $recovery _file


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Mysql,sqlsever,oracle,redis,mongo,postgres database backup and recovery instruction collation

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.