Today, let's take a look at how convenient it is to use the batch processing command to back up a table during database backup in oracle 10 Gb.
Today, let's take a look at how convenient it is to use the batch processing command to back up a table during database backup in oracle 10 Gb.
Note:
1. I use an oracle 10 Gb database and export emp and dept tables under the scott user;
2. Place the exported backup file in D: pantpbackup.
3. The password of scott is orcl;
4. The database SID is ORCL;
5. the backup file exported from the database is named daochu plus the date of today, for example, daochu_20120725.dmp.
5. My oracle installation path is the root directory of the d disk;
Paste the content of the batch processing file below:
The Code is as follows: |
Copy code |
Backup_table.bat @ Rem turn off the command line to display information, and do not display the echo off Command Information @ Echo off Echo oracle database is being backed up. Please wait .... @ Rem ===================================================== ========================================================== ================================ @ Rem assume that the backup file is stored in the backup file under the pantp folder on disk D. First, check whether the specified folder on disk D exists. If the folder does not exist, create a new one. Dir d: | find "pantpbackup" @ Rem % errorlevel % after each command is run, you can use this command line format to view the return code to determine whether the command was successfully executed. The default value is 0. If % errorlevel % = 0 goto OK If % errorlevel % = 1 goto end : OK The echo folder already exists. : End Md d: pantpbackup @ Rem ===================================================== ========================================================== ============================== @ Rem switch to the bin directory under the oracle Installation Directory Cd/d "D: oracleproduct10.2.0db _ 1BIN" @ Rem: Obtain the current system time. The format is 20120725. Set currentTime = % date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2% @ Rem: Set the name of the backup file, write the absolute path, and write the exported suffix. dmp. Set filename = d:/pantp/backup/daochu _ % currentTime %. dmp @ Rem call the exp Command provided by oracle to export the data of a specified table under a specified user Exp scott/orcl @ ORCL file = % filename % tables = (emp, dept) Echo oracle Database Backup has been completed. Press any key to exit... Pause |
If you need to use this batch processing script, you need to modify the following parts based on the actual situation (check or modify ):
1. bin directory of the oracle exp command;
2. username, password, and SID of the oracle database;
3. Tables in the oracle database to be exported;
Local Test
Double-click the backup_table.bat file and run it as follows: