Oracle automatic backup script in Linux

Source: Internet
Author: User
Cron is a linux scheduled execution tool that can run jobs without human intervention. Cron is a built-in service in Linux, but it is not automatically used.

Cron is a linux scheduled execution tool that can run jobs without human intervention. Cron is a built-in service in Linux, but it is not automatically used.

Script file:
Backup. sh
Rq = 'date' + % Y % m % d % H % m''
Su-Oracle-c "exp zjhk/zjhk_123 owner = zjhk file =/home/oracle/zjhk _ $ rq. dmp"

Cron is a linux scheduled execution tool that can run jobs without human intervention. Since Cron is a built-in service in Linux, but it does not automatically get up, you can use the following methods to start and close this service:

/Sbin/service crond start // start the service

/Sbin/service crond stop // close the service

/Sbin/service crond restart // restart the service

/Sbin/service crond reload // reload the configuration

You can also enable the service automatically when the system starts:

Add:

/Sbin/service crond start

Directly use the crontab command to edit


The cron Service provides the crontab command to set the cron service. The following are some parameters and descriptions of this command:


Crontab-u // set a user's cron service. Generally, the root user needs this parameter when executing this command.


Crontab-l // list the details of a user's cron Service


Crontab-r // Delete the cron service of no user


Crontab-e // edit a user's cron Service


For example, to view your cron settings as root: crontab-u root-l


For another example, root wants to delete fred's cron settings: crontab-u fred-r


When editing the cron service, the edited content has some formats and conventions. Enter crontab-u root-e.


In the vi editing mode, the edited content must conform to the following format: */1 ***** ls

The first part of this format is the time setting, and the last part is the command to be executed. If there are too many commands to be executed, you can write these commands into a script, then you can directly call this script here. Remember to write the complete path of the command during the call. We have a certain agreement on the time setting. The first five * numbers represent five numbers. The value range and meaning of the numbers are as follows:
Minutes (0-59)
Hour (0-23)
Date (1-31)
Month (1-12)
Week (0-6) // 0 represents Sunday

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.