rem *******************
rem ***exp_backup 1.0***
rem *******************

rem ***Установка имени целевой БД***
Set _TargetName=MAGICASH

rem ***Установка SYS пароля целевой БД***
Set _SysPsw=NCTSYS

rem ***Установка папки резервного копирования***
Set _BackupDir=.

rem ***Установка схемы, которая должна быть экспортирована, можно указать несколько через запятую - MAGICASH5,MAGICASH6,TMS***
Set _Users=MAGICASH5

rem ***
rem ***
rem ***
rem ***
rem ***
rem ***
rem ***

Set _Date=%date%
If "%_Date%A" LSS "A" (Set _NumTok=1-3) Else (Set _NumTok=2-4)
:: Default Delimiter of TAB and Space are used
For /F "TOKENS=2*" %%A In ('REG QUERY "HKCU\Control Panel\International" /v iDate') Do Set _iDate=%%B
For /F "TOKENS=2*" %%A In ('REG QUERY "HKCU\Control Panel\International" /v sDate') Do Set _sDate=%%B
IF %_iDate%==0 For /F "TOKENS=%_NumTok% DELIMS=%_sDate% " %%B In ("%_Date%") Do Set _fdate=%%D%%B%%C
IF %_iDate%==1 For /F "TOKENS=%_NumTok% DELIMS=%_sDate% " %%B In ("%_Date%") Do Set _fdate=%%D%%C%%B
IF %_iDate%==2 For /F "TOKENS=%_NumTok% DELIMS=%_sDate% " %%B In ("%_Date%") Do Set _fdate=%%B%%C%%D
Set _Today=%_fdate:~0,4%%_fdate:~4,2%%_fdate:~6,2%

rem создание папки логов
md %_BackupDir%\logs_%_Today%
rem создание папки бекапов
md %_BackupDir%\backups_%_Today%

exp userid='SYS/%_SysPsw%@%_TargetName% AS SYSDBA' file=%_BackupDir%\backups_%_Today%\exp_%_TargetName%_%_Today%.dmp LOG=%_BackupDir%\logs_%_Today%\exp_%_TargetName%_%_Today%.LOG OWNER=(%_Users%) GRANTS=y INDEXES=y ROWS=y CONSTRAINTS=y feedback=5000000 STATISTICS=NONE
