.Bat database backup Oracl

=========================== 
@echo OFF    
echo =================== =============================   
 echo   automatic backup scripts under Windows Oracle database  
 echo   1 . name backup files using the current date.  
echo ================================================     
: : set the user name, password, and to back up the database.  
the USER SET :: = Detection1   
:: SET PASSWORD = Detection1   
:: SET DATABASE = ORCL   
:: remove the current time "YYYYMMDD" format. 
year SET =% DATE: ~ 0 , . 4 % 
REM GET month The 
SET month The =% DATE: ~ . 5 , 2 %
rem get data 
set date=%DATE:~8,2%
rem get mydate 
set mydate=%year%%month%%date%  
::创建备份目录。
if not exist "D:\YtForever\YTPQM\DB\backup\"       mkdir D:\YtForever\YTPQM\DB\backup\   
set DATADIR=D:\YtForever\YTPQM\DB\backup\  
exp detection1/detection1@127.0.0.1/orcl  file=%DATADIR%\detection1_%mydate%.dmp
exp ytdetection1/ytdetection1@127.0.0.1/orcl  file=%DATADIR%\ytdetection1_%mydate%.dmp

exit  

 

Delete> 7 days of file

 

forfiles /p "D:\YtForever\YTPQM\DB\backup" /s /m *.* /d -7 /c "cmd /c del @path"

 

Oracle export empty table statement

- execute the query 
SELECT  ' ALTER Table ' || table_name || ' the allocate extents; '  from USER_TABLES; 

- execution of the query statement results in complete

 

Guess you like

Origin www.cnblogs.com/zl0828/p/11846952.html