windows平台下Oracle自動備份指令碼

2021-09-30 07:42:47 字數 1398 閱讀 8369

因資料安全需要,要求每天定時對oracle資料庫中的業務資料進行備份,我參照相關資料編寫了一下指令碼:

@echo off

rem # windows server2000 oracle資料庫自動備份批處理指令碼

rem 取得當前日期和時間,可能因作業系統不同而取值不同

set curdate=%date:~0,4%%date:~5,2%%date:~8,2%

set curtime=%time:~0,2%

rem 小時數如果小於10,則在前面補0

if "%curtime%"==" 0" set curtime=00

if "%curtime%"==" 1" set curtime=01

if "%curtime%"==" 2" set curtime=02

if "%curtime%"==" 3" set curtime=03

if "%curtime%"==" 4" set curtime=04

if "%curtime%"==" 5" set curtime=05

if "%curtime%"==" 6" set curtime=06

if "%curtime%"==" 7" set curtime=07

if "%curtime%"==" 8" set curtime=08

if "%curtime%"==" 9" set curtime=09

set curtime=%curtime%%time:~3,2%%time:~6,2%

rem 設定所有者、使用者名稱和密碼

set owner=cmdb

set user=cmdb

set password=cmdb

set prefix=owner

rem 建立備份用目錄,目錄結構為backup/yyyymmdd/

if not exist "%curdate%"     mkdir %curdate%

set curdir=%curdate%

set filename=%curdir%/%prefix%_%curdate%_%curtime%.dmp

set explog=%curdir%/%prefix%_%curdate%_%curtime%_log.log

rem 呼叫oracle的exp命令匯出使用者資料

exp %user%/%password%@orcl file=d:oracle_backup/%filename% log=%explog% owner=%owner%      

grants=n

exit

以上指令碼若要正常工作還必須與windows中的「任務計畫」配合,設定每天該任務執行的時間,從而實現定時備份資料的目的。

若執行該任務的機器非oracle資料庫的安裝機器,則還需要在本機安裝乙個oracle客戶端。

Windows平台下安裝NLTK

在網上找了一圈,沒找到幾個靠譜的安裝流程,在上找到各平台下安裝流程 windows平台 以下操作假定你的機器上還沒有安裝python,如果你已經安裝python,請跳過最後一步,只需要安裝nltk。32位二進位製版安裝 1.安裝python 選擇2.7.3版本。2.安裝numpy 可選 3.安裝nl...

Lua Socket在Windows平台下的使用

lua的乙個比較實用的拓展庫 lua socket 在windows 下平台的使用。在網上檢視了許多關於lua socket的安裝,發現大部分都是在 linux 下的安裝,關於在 windows 平台下的使用說明很少,而且發現問題挺多。本文將介紹乙個極其簡單的方式介紹 lua socket 在win...

Windows平台下eclipse配置

安裝 go 環境 環境變數配置 對 go 的環境變數進行配置,有些安裝是預設配置,有些需要手動的配置環境變數。go 環境驗證,在控制台中輸入 go version,如顯示以下內容,則表示輸入成功。安裝環境 201606061100 platformruntime 安裝配置 mingw64 mingw...