Oracle 10 Gb Database Backup table using batch processing command

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.