orcale 備份與還原資料庫

2021-06-01 00:51:21 字數 1346 閱讀 4384

orcale 資料庫備份資料的命令用exp.exe,還原資料庫命令imp.exe

一、備份資料庫——exp

格式:exp 使用者名稱/密碼@資料庫 owner=擁有者 file=c:\***\***.dmp

eg1、資料庫test完全匯出,使用者名稱:test, 密碼:test,擁有者:tb_test 匯出到d:\daochu.dmp中

exp test/test@test owner=tb_test  file=d:\daochu.dmp

第一步:進入到 oracle 安裝目錄下的bin目錄下;

第二步:exp test/test@test owner=tb_test  file=d:\daochu.dmp

eg2、將資料庫中的表test中的字段filed1以"00"開頭的資料匯出,使用者名稱:test, 密碼:test

exp test/test@test file=d:\daochu.dmp tables=(test)query="where filed1 like '00%'"

注:可以在命令後面 加上 compress=y 來實現 檔案壓縮

二、還原資料庫——imp

格式:imp 使用者名稱/密碼@資料庫 full=y file=備份檔案路徑 ignore=y log=日誌檔案路徑

eg 1、將d:\daochu.dmp檔案還原到tb_test資料庫中,使用者名稱:test, 密碼:test,日誌檔案放在d:/log.txt 中

第一步:進入到 oracle 安裝目錄下的bin目錄下;

第二步:imp system

/manager@tb_test full = y file="d:\back.dmp" ignore=y log=d:\log.txt

eg2、將d:\daochu.dmp中的表table1 匯入到tb_test資料庫中

imp system/manager@tb_test file=d:\daochu.dmp  tables=(table1)

注:如何沒有以前的表記錄的話,有可能要出現重複資料,可以通過以下方式解決

首先,刪除使用者(本人用的test):drop user test cascade

其次,新建使用者(test)

create user test identified by test

default tablespace test_data

temporary tablespace test_temp

quota unlimited on test_data

account unlock;

然後,給新建使用者授權 grant connect,dba, resource to test;

最後,執行匯入資料命令。

更多資訊請參考

資料庫備份與還原

在開發和資料庫有關的應用程式的時候,很多時候我們做的操作就是和資料庫打交道,而使用者最關心的也是資料,而一旦資料庫出現故障,我們事先又沒有做任何的預防措施,帶來的將會是災難性的錯誤。雖然資料庫本身提供備份和還原的功能,也可設定定期備份資料庫的操作,但是很多時候使用者並不知道怎樣操作,特別是還原。所以...

資料庫備份與還原

還原,將資料恢復到備份時的狀態。保護資料記錄。myisam innodb bdbmemory archive 批量插入的速度高低 高高非常高事務安全 支援 支援 全文索引 支援5.5版本支援 鎖機制 表鎖行鎖 頁鎖表鎖 行鎖儲存限制 沒有64tb沒有有 沒有b樹索引 支援支援 支援支援 雜湊索引 支...

資料庫備份與還原

window to widows 資料庫備份與還原 步驟 pg dump.exe執行程式在postgresql資料庫安裝目錄 bin 目錄下,這是在windows下的檔名。執行過程如下 1 開啟windows下的命令視窗 開始 cmd 安裝資料庫的目錄 進入bin目錄 2 匯出命令 pg dump ...