Use Crontab in RedHat Linux to implement Oracle 10 Gb Scheduled Backup

Source: Internet
Author: User

Use Crontab in RedHat Linux to implement Oracle 10 Gb scheduled backup (including SFTP download instructions ).

This is to say that regular backup is a hot backup, that is, writing a shell script. The syntax is oracle10g, and 9i is slightly modified (using exp syntax)

After the scheduled backup, you can use the client machine to automatically download, use the sftp client, and set it to automatic download. If not, you can go to the Internet to find the implementation of sftp. java has open source.

1. Create a shell backup script file

#! /Bin/sh

# Oracle command

Expcmd = "/opt/ora10/product/10g/bin /"

# Bakup dir: the Backup directory needs to be created first with expdp, which is contained in 10 Gb. You can run the create directory command on your own.

Dbbakdir = "dbbakdir"

# Bakup file name

Filebak1 = "$ (date + % Y % m % d % H % M % S) dbbak1.dmp"

# Bakup db log

Dboplog = "db1.log"

# Table name is used to back up a table. For other statements, see the expdp syntax.

Tablenames = "xxxtablename"

./Expdp username/password @ dbname directory = $ dbbakdir dumpfile = $ filebak1 logfile = $ dboplog filesize = 4G tables = $ tablenames

Save it as/oralce/shelltest. sh and grant the execution permission chmod + x. You need to use oracle to install users such as useroracle and cannot use root users.

2. Add a crontab task

Use oracle to install a user, such as useroracle, to execute the following command

# Crontab-e

30 01 ***/oralce/shelltest. sh

The preceding settings are executed at half past one every morning. For the specific syntax, see the crontab format.

After setting, you can use the crontab-l command to view

 

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.