Oracle Incremental backup script file in windows

Source: Internet
Author: User

Oracle Incremental backup script file in windows

@ Set ORACLE_HOME = D: \ oracle \ product \ 10.2.0 \ db_1 @ rem echo % ORACLE_HOME % @ set ORACLE_SID = orcl @ rem echo % ORACLE_SID % @ set NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK @ rem echo % NLS_LANG % @ set PATH = % ORACLE_HOME % \ bin @ rem echo % PATH % @ set RMAN = % ORACLE_HOME % \ bin \ rman.exe @ rem *************** * *** get the system time, intercept yyyy-dd-mm ****************************** @ rem ** * ***************** if the acquisition time is incorrect, modify the system time format: yyyy-mm-dd dddd ************ * ***************** @ Set MONTH = % date :~ 0, 10% @ set BACKUP_DIR = E: \ BACKUP \ % MONTH % @ if not exist % BACKUP_DIR % (mkdir % BACKUP_DIR %) @ set RQ = % date :~ 0, 10% @ set RMAN_LOG_FILE = % BACKUP_DIR % \ rman _ % RQ %. log @ rem echo % RMAN_LOG_FILE % @ rem ********************* modify the connection rman ***** according to the actual situation ****** * ********************** @ set TARGET_CONNECT_STR = yk/yk @ orcl @ set DAY = % date: ~ @ REM 0-level backup means full database backup, level 1 means data changed after level 0 backup, level 2 is the data changed after level 1 or level 0 is backed up @ REM if the previous backup is level 1, then the data modified after this backup is backed up, if the previous backup is level 0, back up the data after level 0 @ echo ==== started on % DATE %==>> % RMAN_LOG_FILE % @ set BACKUPTYPE = incremental level 2 database @ set NAME = L2 _ % d _ % T _ % s @ if "% DAY %" EQU "1" (set BACKUPTYPE = incremental level 2 databaseset NAME = F _ % d _ % T _ % sset ARCHIVE = L1 _ % d _ % T) @ if "% DAY %" EQU "2" (set BAC KUPTYPE = incremental level 2 databaseset NAME = L1 _ % d _ % T _ % sset ARCHIVE = L1 _ % d _ % T) @ if "% DAY %" EQU "3" (set BACKUPTYPE = incremental level 2 databaseset NAME = L1 _ % d _ % T _ % sset ARCHIVE = L1 _ % d _ % T) @ if "% DAY %" EQU "4" (set BACKUPTYPE = incremental level 2 databaseset NAME = L1 _ % d _ % T _ % sset ARCHIVE = L1 _ % d _ % T) @ if "% DAY %" EQU "5" (set BACKUPTYPE = incremental level 1 databaseset NAME = L1 _ % d _ % T _ % sset ARCHIVE = L1 _ % d _ % T) @ if "% DAY %" EQU "6" (set BACKUPTYPE = incremental level 2 databaseset NAME = L1 _ % d _ % T _ % sset ARCHIVE = L1 _ % d _ % T) @ if "% DAY %" EQU "(set BACKUPTYPE = incremental level 0 databaseset NAME = L1 _ % d _ % T _ % sset ARCHIVE = L1 _ % d _ % T) @ REM backup format 'e: \ backup \ dbL0 _ % d _ % T. arc 'archivelog all delete input; @ rem echo backup % BACKUPTYPE % include current controlfile; @ rem echo SQL "ALTER SYSTEM ARCHIVE Log current "; @ (echo run {@ rem manually allocates a channel Directory: E: \ BACKUP \ yyyy-mm-ddecho allocate channel Channel1 type disk format' % BACKUP_DIR % \ % NAME % '; @ rem BACKUP database and control file directory: E: \ BACKUP \ yyyy-mm-ddecho backup % BACKUPTYPE % include current controlfile; echo SQL "ALTER SYSTEM ARCHIVE LOG CURRENT"; @ rem BACKUP archiving LOG directory: E: \ BACKUP \ yyyy-mm-ddecho backup format' % BACKUP_DIR % \ % ARCHIVE % 'archivelog all delete input; @ rem Directory: E: \ BACKUP \ yyy Y-mm-ddecho backup current controlfile format '% BACKUP_DIR % \ ctl _ % d _ % T _ % s'; @ rem release channel echo release channel Channel1; echo }) | % RMAN % target % TARGET_CONNECT_STR % nocatalog msglog '% RMAN_LOG_FILE %' @ set ERRLEVEL = % ERRORLEVEL % @ if % ERRLEVEL % NEQ 0 @ goto err @ set LOGMSG = "backup successful!! "@ Goto end: err @ set LOGMSG =" backup failed. Please try again !!! ": End @ echo #>>% RMAN_LOG_FILE % @ echo ===% LOGMSG % on % DATE %===>>% RMAN_LOG_FILE %@ endlocal @ REM End of Main Program limit -----------------------------------------------------

 

 

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.