Get the App
SLTechnology News&Howtos  ›  Database  › 

Regular backup and import of oracle database

Shulou Source: shulou.com Published: 2022-06-01 13:46:56 10月27日 Update

PLM project has been officially launched for testing, data management is the top priority, to facilitate fault recovery processing, to avoid data loss. Idea: data export + scheduled backup + data cycle cleaning

1. Copy the exp.exe under the Oracle installation directory bin (you can also set the exp.exe environment variable) to the backup folder oraclebackup file (nothing can be created)

2. Export data xxx library, create a new folder and edit

@ echo off echo deletes spare files and logs from 10 days ago forfiles / p "E:\ oraclebackup" / m * .dmp / d-10 / c "cmd / c del @ path" forfiles / p "E:\ oraclebackup" / m * .log / d-10 / c "cmd / c del @ path" echo is backing up the Oracle database, please wait a moment. Exp system/infodba@xxx file=E:/oraclebackup/mdb%date:~0,4%%date:~5,2%%date:~8,2%.dmp log=E:/oraclebackup/mdb%date:~0,4%%date:~5,2%%date:~8,2%.log full=y buffer=65535 echo mission accomplished!

Modify the suffix .bat

3. Data recovery

Selected backup data latest data file

Imp system/infodba@xxx file=E:/oraclebackup/mdb.dmp full=y ignore=y

4. Set up windows backup

Task schedule-- > add task-- > Select time-- > Select dos file-- > execute the test

Description of relevant knowledge points:

Related to the dos command:

Forfiles / p "E:\ oraclebackup" / m * .dmp / d-10 / c "cmd / c del @ path"

Dos command forfiles folder traversal loop

/ p specified path

/ s includes subdirectories

File name mask for / m lookup

/ d specifies the date, with absolute and relative dates, where-7 refers to 7 days before the current date

The command line run by / c represents the commands executed for each file. The command string should be enclosed in double quotes.

The default command is "cmd / c echo @ file". The following variables can be used in the command string: @ file-returns the file name. @ fname-returns a file name without an extension. @ ext-returns only the extension of the file. Path-returns the full path to the file. Relpath-returns the relative path to the file. Isdir-returns "TRUE" if the file type is a directory, or "FALSE" if it is a file. Fsize-returns the file size in bytes. Fdate-returns the date the file was last modified. Ftime-returns the time when the file was last modified.

Database correlation

Exp is the data export execution file

Imp is the import execution file

Tags: Files data commands backups dates tasks file names folders paths databases variables characters strings time directories previous loop test selection top priority Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei macOS Shulou Technology MariaDB vpn