Use crontab on AIX to automatically back up Oracle databases at regular intervals

Source: Internet
Author: User

Take oracle users as an Example

1. log on to the system with an oracle user
2. Create the Backup Directory mkdir backup
3. write the script/Oracle/backup. sh:
Export $ ORACLE_HOME =/Oracle/APP/product/9.2.0;
Export $ oracle_sid = orcl;
Export $ Path = $ ORACLE_HOME/bin: $ path;
Exp test/test file =/Oracle/backup/$ (date + "% Y % m % d "). DMP tables = user log =/Oracle/backup/$ (date + "% Y % m % d "). log
3. Use LS-L to check whether backup. Sh has executable permissions. If you do not use chmod U + x backup. Sh, grant the backup. Sh executable permission.
4. Execute backup. Sh. If DMP is exported successfully, perform Step 1. Otherwise, check the backup. Sh script.
5. Check whether oracle users can use the crontab command:
Check the cron. deny and cron. allow files in the/var/adm/cron directory. Each row in these two files is a user name.
Without these two files, only the root user can use crontab.
If you only use cron. deny, make sure that the file does not contain oracle.
If there is only cron. allow, check that the file contains Oracle Only .
If cron. deny and cron. allow exist, cron. deny does not contain Oracle, and cron. allow contains oracle. .
For more details, use man crontab to view the description.
6. Enter the command crontab-e to open a text editor.
7. Enter 55 23 1 ** \ oracle \ backup. Sh to execute a backup script at on the first day of each month.


Note:
because crontab-E is used to edit a job, therefore, you do not need to restart the cron process or the machine.

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.