How to back up a database logically by date on Linux and Windows

Source: Internet
Author: User
When backing up a logical database, you may want to add a date variable to the dmp file to differentiate backup files of different dates and avoid accidental overwriting. Refer to eagle

When backing up a logical database, you may want to add a date variable to the dmp file to differentiate backup files of different dates and avoid accidental overwriting. Refer to eagle

When backing up a logical database, you may want to add a date variable to the dmp file to differentiate backup files of different dates and avoid accidental overwriting. Referring to eagle's book "sequential Oracle", we have tested some scripts as follows:

1. Linux or unix scripts

Includes a script:

Exp rman/rman file = 'date + % y % m % D'. dmp log = 'date + % y % m % d'. log

2. scripts on windows

The script can generate the dmp file of the current day and delete the dmp file of the previous day.

Script 1: exp_seagull.bat

Echo off

Sqlplus rman/rman @ vm10 @ exp_seagull. SQL

Script 2: exp_seagull. SQL

Column jintian new_val jt

Select to_char (sysdate, 'yyyymmdd') jintian from dual;

Host exp userid = rman/rman @ vm10 file = exp_seagull _ & jt .. dmp log = exp_seagull _ & jt .. log

Column qiantian new_val qt

Select to_char (sysdate-2, 'yyyymmdd') qiantian from dual;

Host del exp_seagull _ & qt .. dmp

Exit

,

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.