Automatic Oracle Database Backup (2)

Source: Internet
Author: User

Iii. Remote Backup

We know that FTP commands are usually used to transmit data between two hosts, but they are generally implemented through interaction, that is, you need to manually enter the IP address, user name, and password of the target host. Obviously, this does not meet the requirements of automatic backup. Fortunately, we can achieve our goal by writing a. netrc file. This file must be named. netrc and stored in the user registration directory on the machine where the FTP command is started. The file permission should be disabled for read access by the group or other users. In this way, when a user uses an FTP command, the system will find it in the user's registration directory. if you can find the netrc file, the file will be executed first. Otherwise, the user will be prompted interactively to enter the user name and password.

Before using the FTP command, you should first create a directory on another UNIX machine for backup to accommodate the backup files. The directory created in this document is/pub. It should be noted that, in order to speed up the backup, the transmission rate between the two hosts should be as high as possible, preferably on the same LAN.

The content of the. netrc file is as follows:

Machine host2

# Host2 is the host name used for backup

Login oracle

# Oracle is a user on the backup host

Password oracle

# Oracle user password

Macdef init

# Define a macro named init, which will be executed at the end of the automatic registration process

Bin

# Set the file transmission mode to binary

LCD/backup

# Go to the local working directory/backup

Cd/pub

# Enter the backup host directory/pub

Mput? ?

# Transfer all files in the/backup Directory to the backup host

Bye

# Exit the FTP session Process

After the. netrc file is compiled, run the following command:

Chmod 600. netrc

In this way, the. netrc file can only be accessed by this user.


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.