Orcale 備份與還原資料庫

來源:互聯網
上載者:User

Orcale Database Backup資料的命令用exp.exe,還原資料庫命令imp.exe

一、備份資料庫——exp

格式:exp 使用者名稱/密碼@資料庫 owner=擁有者 file=C:\xxx\xxx.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;

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.