Oracle DatabaseModerate timingDmp FileBackup can improve the security and stability of the database and facilitate recovery in the event of a fault. This article describes how to regularly back up the dmp file of an oracle database in SCO Unix. Let's take a look at it.
Prerequisites for backing up dmp files:
1. required information:
- Oracle system password and account name and password for backing up database accounts
- Sco unix root password and oracle Password
2. Files are edited by vi, folders are created by mkdir, file permissions are changed by chmod, users are switched by su, and files are executed.
3. Understand sco unix users, groups, permissions, crontab usage, and oracle dmp file generation.
1. Create a directory for storing database dmp files
- #su - oracle
-
- $cd /dbf
-
- $mkdir dmpbak
-
- $cd dmpbak
-
- $mkdir zd
-
- $mkdir cm
2. Create an exported database dmp File
1. Specify a directory
- #su - oracle
-
- $cd bin
2. Use vi to edit the exp_t File
$ Vi exp_t
Exp_t content:
- ORACLE_HOME=/oracle
-
- ORACLE_SID=ora7
-
- ORACLE_TERM=ansi
-
- export ORACLE_HOME ORACLE_SID ORACLE_TERM
-
- MENU5PATH=$ORACLE_HOME/forms30/admin/resource
-
- export MENU5PATH
-
- ORATERMPATH=$ORACLE_HOME/forms30/admin/resource
-
- export ORATERMPATH
-
- NLS_LANG=American_America.ZHS16CGB231280
-
- export NLS_LANG
-
- ORA_NLS=/oracle/ocommon/nls/admin/data
-
- export ORA_NLS
-
- home1='/dbf/dmpbak'
-
- dt1=`date "+%H%M"`
-
- echo ' ' >'$home1/'new_record
-
- file_name="$home1"/zd/zd"$dt1"
-
- echo $file_name >>'$home1'/new_record
-
- $ORACLE_HOME/bin/exp zd/zdzd file=$file_name.dmp owner=zd grants=y buffer=204800 rows=y indexes=y compress=y
-
- file_name="$home1"/cm/cm"$dt1"
-
- echo $file_name >>'$home1'/new_record
-
- $ORACLE_HOME/bin/exp common/cmcm file=$file_name.dmp owner=common grants=y buffer=204800 rows=y indexes=y compress=y
-
- file='/dbf/dmpbak/new_record'
-
- backup_dir='/oracle/sec_back'
-
- if [ -d $backup_dir ]
-
- then
-
- for i in `cat $file`
-
- do
-
- cp $i $backup_dir/
-
- done
-
- echo ' '>$file
-
- fi
3. Grant the exp_t permission
$ Chmod 755 exp_t
4. Test exp_t
- $cd /oracle/bin
-
- $exp_t
5. Check whether the dmp file is generated.
- $cd /dbf/dmpbak/zd
-
- $ls
For example, the file generated at is 1135.dmp. if the dmp file is generated, it is proved that exp_t can be used.
3. Edit crontab
# Add a line to crontab-e: 35 * su-oracle-c/oracle/bin/exp_t, which means that the dmp file is backed up every 35 minutes every day, the data on the first day will overwrite the data on the first day.
This article describes how to regularly back up the dmp files of oracle databases in SCO Unix systems. We hope this article will help you.