In linux, databases are regularly backed up after time.

Source: Internet
Author: User

In linux, databases are regularly backed up after time.

bakfordatabase.shmysqldump -uuser -ppassword database>folder/`date  "+%Y-%m-%d~%H-%M-%S"`.sql

Back up a mysql database in a specified time



Mongodump-d database-o folder' back up mongodb Databases

Cd folder

Tar-cf database-''%%y-%m-%d''.tar database'

Rm-r database 'delete the original file


Back up the mangodb database by name


00 07 * * * sh folder/bakfordatabase.sh<pre name="code" class="plain">00 */8 * * * sh folder/bakfordatabase.sh

 

Regular backup in crontab





In linux, how does one implement regular database backup?

Run crontab-e as the root user.
Format:
* *** Command (dd, tar, or another method)
Minutes, days, months, and weeks
For example
1 2 3 4 * tar jcvpf/back/home.tar.bz2/home
Put/home in the/back directory in the format of bz2 at 02:01 on January 1, April 3.
For example
1 2*4 3 tar jcvpf/back/home.tar.bz2/home
Package/home in the format of bz2 in the/back directory at 02:01 every week, January 1, April.

Linux oracle Scheduled Backup

The scripts executed by crontab are called by the root user. Therefore, you must add oracle user environment variables such as ORACLE_HOME, ORACLE_BASE, and ORACLE_SID. ORACLE_HOME/bin must also be added to the path.
In addition, expdp_oracle.sh other users must have the execution permission.
Example:
Vi expdp_oracle.sh
Export ORACLE_BASE =/u01/app/oracle
Export ORACLE_HOME =/u01/app/oracle/product/10.2/db_1
Export ORACLE_SID = orcl
Export PATH =/u01/app/oracle/product/10.2/db_1/bin; $ PATH

Expdp system/oracle directory = DDPDATA21 dumpfile = rrq. dmp schemas = 'ms ';
Wq:

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.