Database management is very important, many system users will inevitably encounter forgetting to back up data. If it happens that the system has failed at this time, then we will not be able to do this without a backup database. So, is there any way for our system to automatically back up the database? Of course, our system experts have compiled a tutorial for automatic backup of the Oracle database based on practical experience, and now share it with everyone.
First, export the database
The export command backs up the data in the database into a binary file. It usually has three modes: user mode, table mode and the entire database mode. This article intends to adopt the user mode. Before backup, you should first create a backup directory to accommodate backup files. For example, you can create a /backup directory. Then we can create two files ora—backup, tar—backup in the UNIX directory of UNIX (or other directories). It should be noted that the previous file needs to initialize the parameters of Oracle. For convenience, we may put the initialization command into a file (the file name is set to ora—env), and then it is called by the first file.
1. The ora—env file initializes Oracle parameters 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< Br>
ORA—NLS32=$ORACLE—HOME/ocommon/nls/admin/data;export ORA—NLS
PATH=.:/usr/ccs/bin:/usr/ucb:$ORACLE&mdash ;HOME/bin:$PATH;export PATH
DISPLAY=host1:0;export DISPLAY
NLS—LANG=american—america.zhs16cgb231280;export NLS—LANG
2. ora—backup file export export to the database, the exported file name can be arbitrarily determined, this article is set to the letter "xx", plus the date of the day, that is, if the date of the day is December 10, the exported file name is "ld"; Xx1210.dmp” to distinguish backup files from other dates.
ora—backup file contents:
./oracle/ora—env
#initialize Oracle database
rq=′date +″% M%d″ ′
# Assign the date of the day to the variable rq
rm /backup/
# empty/backup directory
exp test/test File=/backup/xx$rq.dmp log=/backup/xx$rq.log
This command is used to export the test user's data (the password is also test) at the $ prompt. Files and logs are placed in the /backup directory.
Second, tape backup
tar—backup file will copy the data file exported by export command to tape.
tar—backup file contents:
tar rvf /dev/rmt/0n/backup/?
This command can back up the files generated in the /backup directory to the day. On the tape. In this file, the tar command uses three parameters, where the r option means copying the file into the tape without destroying the original contents of the tape, the v option means displaying the file information during the copying process, and 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 rewinding. /dev/rmt/0 indicates the first tape drive for a UNIX host. Similarly, /dev/rmt/1 indicates the second tape drive for the UNIX host, and so on.
ora—env,ora—backup,tar—after the backup file is written, use the following command:
chmod 755 ora—env
chmod 755 ora—backup
chmod 755 tar—backup
Thus, all three files become executable files.
After modifying the txt text file, it can not be saved. What is going on? This happens because the t
How can I solve the problem that Sina mailbox cant be opened? I believe that many users have encount
Solution Use WIN+R to call up the input diskmgmt.msc. If the Virtual Disk service is disab
Recently, many users are reporting that launch csm cannot be changed. What is going on? In fact, thi
How to turn off the sound of WeChat web version?
Brief introduction to Linux system commands and Tomcat maintenance
How to solve the problem that the printer is accidentally deleted when the Foxit PDF reader prints?
Solve the CPU fan error problem
Windows implementation in the bat start s h e l l
Tips for using a wireless network on a desktop computer
How to improve the security of the FTP server in an all-round way.
Four steps to clean up Windows system disk useless garbage
Simple way to quickly kill the virus in the video file
Win users new benefits: Win10 will be compatible with iOS application
Explain the mystery of the difference in boot speed between Windows series
How to view the computer memory in the win7 system?
Win10 Mobile Preview 10162 screenshot exposure: battery icon normalization
Do not record the time of file access noatime application
Clever use of win2008 mission planning function
Selling cute little fox Firefox browser 29.0.1 official version release download
Screenshots that come with Windows 8 system
How to set the relevant input method for multiple programs in win8 system