Oracle Database Setup Task Scheduled Backup Record for One Week

  • 2021-10-13 08:59:42
  • OfStack

Oracle database backup:

-Keep the backup records of the last week;
= = = = Text:
= = = = = = = = = = = = == = = = = = = = = = = =


echo  Set the backup file storage folder ...  
set "tbuf=E:\Cway\backup" 
echo  Set the backup file name ( Named after the day of the week, that is, the backup file is only saved recently 1 Week )...  
set name=%date%  
set name=%name:~-3%  
set name=ORCL_backup_%name%  

echo  Whether a file with the same name exists, and if so, delete the file with the same name ...  
if exist %tbuf%\%name%.dmp del %tbuf%\%name%.dmp  
if exist %tbuf%\%name%.log del %tbuf%\%name%.log  

echo  Start backup XX Project  Oracle  Database .....    

exp User1/PassWord1@Orcl file=%tbuf%\%name%.dmp log='%tbuf%\%name%.log'  

echo  Backup complete !

= = = End = = = = = = = = =

= = Copy the contents between "start" and "end" to txt file, and modify the corresponding parameters such as: path, database name, etc.;

Save as bat format, create a task plan, and set up a daily run to realize database backup.

Note:

(1) User: The user name of the data to be backed up;
(2) PassWord: Password;
(3) Orcl: Database name;


Related articles: