I believe that a large number of system administrators are doing the same job mdash and mdash every day to back up data. If one day is neglected, the system just sends
I believe that a large number of system administrators are doing the same job mdash and mdash every day to back up data. If one day is neglected, the system just sends
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. It would be nice to set a fixed time every day for the system to automatically back up data! Next, I will talk about the automatic backup of Oracle databases in a UNIX environment based on my practical experience.
We plan to allow the database to perform export backup at a.m., copy the backup file to the tape at a.m., and copy the backup file to another UNIX machine at a.m, to do this, we can perform the following operations:
1. Export the database
The export command backs up data in the database into a binary file. There are usually three modes: user mode, table mode, and whole database mode. This document uses the user mode. before backup, you must create a backup directory to hold backup files. For example, you can create a/backup directory. Then we can create two files, ora-backup and tar-backup, respectively, in the Oracle directory of UNIX (or another directory. It should be noted that the Oracle parameter needs to be initialized in the previous file. For convenience, we may wish to put the initialization command in a file (the file name should be set to ora-env ), then the first file calls it.
1. The ora-env file initializes Oracle parameters. The content is as follows:
ORACLE-HOME = $ ORACLE-HOME; export ORACLE-HOME
ORACLE-SID = ora73; export ORACLE-SID
ORACLE-TERM = sun; export ORACLE-TERM
LD-LIBRARY-PATH = $ ORACLE-HOME/lib; export LD-LIBRARY-PATH
ORA-NLS32 = $ ORACLE-HOME/ocommon/nls/admin/data; export ORA-NLS
PATH =.:/usr/ccs/bin:/usr/ucb: $ ORACLE-HOME/bin: $ PATH; export PATH
DISPLAY = host1: 0; export DISPLAY
NLS-LANG = american-america.zhs16cgb231280; export NLS-LANG
2. the ora-backup file exports the Database export, and the exported file name can be set at will. This document specifies the letter "xx" and the date of the day, that is, if the date of the day is January 1, December 10, the exported file name is "xx1210.dmp", which is different from the backup file of other dates.
Ora-backup file content:
./Oracle/ora-env
# Initializing an Oracle database
Rq = 'date + "% m % d ″′
# Assign the date of the day to the variable rq
Rm/backup/
# Clearing/backup directories
Exp test/test file =/backup/xx $ rq. dmp log =/backup/xx $ rq. log
This command is used to export the data of the user test (whose password is also test) at the $ prompt. The exported files and logs are stored in the/backup directory.