Backup scripts for Oracle databases

Source: Internet
Author: User

You need to back up the Oracle database automatically on a regular basis and want to use the simplest tools and methods.

Timing: Use the scheduled tasks that come with windows to complete.

Backup: Use the Oracle export tool export. The command line is exp, and the command to view help is> exp-help

You need to write a script to execute the exp command, and call the script to run it on a scheduled task.

Oracle_backup.vbs

Option   Explicit

On   Error   Resume   Next

Dim Fname, cmd
Dim Wshshell

Set Wshshell =   Createobject ( " Wscript. Shell " )

Fname = Date   &   " _ "   &   Hour ( Now ) &   " _ "   &   Minute ( Now ) &   " _ "   &   Second ( Now )

CMD =   " Exp log = ../backup/ "   & Fname &   " _ Oracle_bak.log file = ../backup/ "   & Fname &  

" _ Oracle_bak.dmp parfile1_exp.txt"

Wshshell. Run cmd

Set Wshshell =   Nothing

Exp.txt configuration file content:
Userid = username/password @ Database
Owner = Scott
Indexes = y
Grants = y
Rows = y
Constraints = y
Compress = N

Configuration File description:
The main modification parameters are:
Userid = username/password @ Database
: This is to use the user to back up the database and specify the connected database. Here, the username user is used to back up the database, and the password is password,
The database to be backed up is the database. This part must be changed.
Owner = SCOTT: user to be backed up. In this example, the Scott user is backed up. To back up multiple users, separate them with commas. This part must be changed. For example, if you back up Scott and system users, 'owner = Scott, system '.
If you are familiar with the exp backup tool, you can use this other parameter. You can also add other parameters to the exp.txt file.

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.