The following articles mainly introduce how to automatically back up Oracle databases under UNIX. The following describes the specific solutions, such as tape backup and remote backup, I hope this will help you in your future studies. The following describes the specific content of the text.
I believe that many system administrators are doing the same job every day-backing up data. Once the system fails and data recovery is required, the system is powerless.
Tape backup
The tar-backup file copies the data files exported using the export command to the tape.
Tar-backup file content:
- tar rvf /dev/rmt/0n/backup/
This command backs up files generated on the current day in the/backup Directory to the tape. In this file, the tar command uses three parameters. The r option indicates that a file is written to the tape without damaging the original content of the tape. The v option indicates that the file information is displayed during the copy process, the f option is followed by the tape device name, specifying where the file is copied. The n option indicates that the tape drive is not replayed. /Dev/rmt/0 indicates the first tape drive of the UNIX host. Similarly,/dev/rmt/1 indicates the second tape drive of the UNIX host, and so on.
After writing the ora-env, ora-backup, and tar-backup files, run the following commands:
- chmod 755 ora—env
- chmod 755 ora—backup
- chmod 755 tar—backup
In this way, all three files become executable files.
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 the netrc file can be found, 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
The password of an oracle user is oracle
- macdef init
The above content is an introduction to the actual operation steps for automatic backup of Oracle databases under UNIX. I hope you will get some benefits.
Article by: http://database.ctocio.com.cn/448/8997448_1.shtml