Oracle 10g database with batch command backup table

Source: Internet
Author: User

See a friend today. A batch command backup table when doing a database backup, what a convenient thing to do in Oracle 10g Oh, let's see.

Description

1. I used the Oracle 10g database, which was derived from the EMP and Dept tables under Scott's user;

2. Exported backup files I put it in the d:pantpbackup.

3. Database Scott user's password is ORCL;

4. The SID of the database is ORCL;

5. Database exported backup file name Daochu Plus today's date, such as Daochu_20120725.dmp

5. My Oracle installation path is the root directory of D disk;

The contents of the batch file are posted directly 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 information of echo off this command
@echo off

echo Oracle database is being backed up, please wait a moment ....

@rem ==================================================================================================
@rem assume that the backed up files are placed in Backup under the PANTP folder under D disk to find out if the specified folder exists under D disk, if it does not exist, the new
Dir d:| find "Pantpbackup"

@rem%errorlevel% the end of each command, you can use this command-line format to view the return code to determine if the command was executed successfully. 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 Oracle installation directory in the bin directory
cd/d "D:oracleproduct10.2.0db_1bin"

@rem get the system current time, format such as: 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 name. dmp
Set Filename=d:/pantp/backup/daochu_%currenttime%.dmp

@rem invoke the Oracle self-led EXP command to export data from a specified table under a specified user
Exp SCOTT/ORCL@ORCL file=%filename% tables= (emp,dept)

echo Oracle Database Backup is complete, press any key to exit ...

Pause

If you need to use this batch script, you need to modify the following sections (must be checked or modified) according to the actual situation:

1.oracle the bin directory of the exp command;

User name, password, and SID of the 2.oracle database;

3. Tables in Oracle databases that need to be exported;

Test screenshot of the machine

Double-click the Backup_table.bat file to run the screenshot below:

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.