Automatic daily backup of Oracle database under Windows system _oracle

Source: Internet
Author: User
Tags oracle database

Using shells under Linux and UNIX is easy to implement if the Windows environment can be combined with scheduled tasks

1. Create backup directory d:\backup, create Batch command Bak.bat, write backup script

Exp USER/PASSWD@ORCL direct=y buffer=100000 file=d:\backup\scdd%date:~0,10% owner= (' SCDD ') log=d:\backup\data.log 
forfiles/p "D:\backup"/s/m *.dmp/d -3/c "cmd/c del @path"

Description

The exp command is a dump backup command provided by Oracle, where the%date:~0,10% is a dos date command, for example: C:\users\qyy>echo%date:~0,10% got 2016-11-30

Forfiles is a Windows file Lookup command, looking for a file that produces three days in the Backup,dmp suffix, and after it is found, the delete operation is performed

2.Windows Scheduled task daily automatically executes batch file 3. Keep the files of the last three days and automatically delete the backup files of previous dates

Forfiles parameter Description:

/p is the search path. This is where we're going to look for files to delete in the directory.

/M searches for files based on the search mask. The default is *, if you want to find the backup dump file, the format is *.DMP

/d file modification time before or after a certain time. -3 indicates a file 3 days ago.

/s contains subdirectories

/C represents a command to be executed for each file, which can be "cmd/c del/f/s/q @file" If you want to delete the file. Where the variable @file indicates that the file name F S Q indicates that forced silent deletion can not be used; cmd/c represents executing a string-specified command and then breaking

Where @file can return the following results, we use @path

@file-returns The name of the file.

@fname-returns The file name without extension.

@ext-returns only the extension of the file.

@path-returns The full path of the file.

@relpath-returns The relative path of the file.

@isdir-returns "TRUE" If a file type is a directory, and "FALSE" for files. @fsize-returns the size of the file in bytes.

@fdate-returns the last modified date of the file.

@ftime-returns The last modified time of the file

The above is a small set to introduce the Windows system Oracle database every day automatic backup, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.