- 论坛徽章:
- 0
|
expfullbak_win_oracle.bat- @echo off
-
- SET ORACLE_SID=orcl
- SET NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
- SET Year=%date:~0,4%
- SET Month=%date:~5,2%
- SET Day=%date:~8,2%
- SET Hour=%time:~0,2%
- SET Minute=%time:~3,2%
- SET Second=%time:~6,2%
- SET NOWDATE=%Year%_%Month%_%Day%
- SET NOWTIME=%Year%%Month%%Day%%Hour%%Minute%%Second%
-
- SET BACKUPDIR=d:\Bak
- IF NOT EXIST %BACKUPDIR% (
- MD %BACKUPDIR%
- )
- IF NOT EXIST %BACKUPDIR%\%NOWDATE% (
- MD %BACKUPDIR%\%NOWDATE%
- )
-
- SET USERNAME=system
- SET PASSWORD=system
-
- exp %USERNAME%/%PASSWORD%@%ORACLE_SID% file=%BACKUPDIR%\%NOWDATE%\%COMPUTERNAME%-%ORACLE_SID%-fullbackup_%NOWTIME%.dmp log=%BACKUPDIR%\%NOWDATE%\%COMPUTERNAME%-%ORACLE_SID%-fullbackup_%NOWTIME%.log full=y direct=y consistent=y buffer=102400
-
- SET HOST=1.1.1.1
- SET FTP_USERNAME=backup
- SET FTP_PASSWORD=backup
-
- cd /d %BACKUPDIR%
-
- echo open %HOST% >> %BACKUPDIR%\ftp.cfg
- echo user %FTP_USERNAME% %FTP_PASSWORD% >> %BACKUPDIR%\ftp.cfg
- echo bin >> %BACKUPDIR%\ftp.cfg
- echo mkdir oradmp >> %BACKUPDIR%\ftp.cfg
- echo cd oradmp >> %BACKUPDIR%\ftp.cfg
- echo mkdir %COMPUTERNAME% >> %BACKUPDIR%\ftp.cfg
- echo cd %COMPUTERNAME% >> %BACKUPDIR%\ftp.cfg
- echo mkdir %NOWDATE% >> %BACKUPDIR%\ftp.cfg
- echo cd %NOWDATE% >> %BACKUPDIR%\ftp.cfg
- echo lcd %NOWDATE% >> %BACKUPDIR%\ftp.cfg
- echo mput * >> %BACKUPDIR%\ftp.cfg
- echo bye >> %BACKUPDIR%\ftp.cfg
- ftp -i -n -v -s:%BACKUPDIR%\ftp.cfg
- del /f /s /q %BACKUPDIR%\ftp.cfg 2>&1 >nul
-
- forfiles /P %BACKUPDIR% /S /C "cmd /c del /f /s /q @file" /D -1 2>&1 >nul
- for /f "usebackq" %%d in (`"dir /ad/b/s | sort /R"`) do rd "%%d" 2>&1 >nul
- for /f "tokens=*" %%a in ('dir /b /ad /s "%BACKUPDIR%"^|sort /r') do rd "%%a" 2>&1 >nul
复制代码 |
|