expdp 匯出多重路徑,expdp匯出路徑

來源:互聯網
上載者:User

expdp 匯出多重路徑,expdp匯出路徑
一、前言:
    有的使用者DBA水平不是太高,不會使用RMAN進行備份恢複,如果對現場的工程師或使用者進行RMAN的培訓這樣將會導致額外的開銷以及導致一些不必要的麻煩。如果在使用者
對資料恢複要求不是特別高的情況下,或者做異機恢複的時候expdp/impdp 則是一個比較不錯的選擇。
   
    如果在RAC環境下,使用者需要多份備份的情況下,那麼我們可以通過expdp 的多重路徑備份來實現在ASM上備份一份,同時在本地備份一份,或者還可以在NAS共用盤上備一份,
這樣就可以完美的解決任意一台伺服器或儲存損壞都能實現資料恢複。

    如下是我的測試過程,根據實際情況修改目錄即可:

    我這是測試環境,生產環境也類似,只需修改目錄即可,(ASM路徑寫法: +DISKGROUP_NAME/DIRPATH)

二、建立相關目錄並賦予許可權

[root@source DBData]# cd /[root@source /]# cd DBBackup/[root@source DBBackup]# ls[root@source DBBackup]# mkdir expdp1[root@source DBBackup]# mkdir expdp2[root@source DBBackup]# chown -R oracle:oinstall expdp1[root@source DBBackup]# chown -R oracle:oinstall expdp2[root@source DBBackup]# lltotal 8drwxr-xr-x 2 oracle oinstall 4096 Sep 5 13:33 expdp1drwxr-xr-x 2 oracle oinstall 4096 Sep 5 13:33 expdp2

三、進入資料庫做directory及賦予許可權

[root@source DBBackup]# su - oracle[oracle@source ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Fri Sep 5 13:34:12 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL>SQL> create directory expdp1 as \

四、開始執行匯出

[oracle@source expdp1]$ expdp ggs/ggs dumpfile=expdp1:ggs001.dmp,expdp2:ggs001.dmp parallel=2Export: Release 11.2.0.4.0 - Production on Fri Sep 5 13:43:14 2014Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsFLASHBACK automatically enabled to preserve database integrity.Starting \



Oracle資料匯入匯出imp/exp命令 10g以上expdp/impdp命令 詳細的 詳細的

這個百度上一搜一大把,都說的很詳細,樓主沒搜過,
資料匯出:
1 將資料庫TEST完全匯出,使用者名稱system 密碼manager 匯出到D:daochu.dmp中
exp system/manager@TEST file=d:daochu.dmp full=y
2 將資料庫中system使用者與sys使用者的表匯出
exp system/manager@TEST file=d:daochu.dmp owner=(system,sys)
3 將資料庫中的表inner_notify、notify_staff_relat匯出
exp aichannel/aichannel@TESTDB2 file= d:datanewsmgnt.dmp tables=(inner_notify,notify_staff_relat)

4 將資料庫中的表table1中的欄位filed1以"00"打頭的資料匯出
exp system/manager@TEST file=d:daochu.dmp tables=(table1) query=" where filed1 like '00%'"

上面是常用的匯出,對於壓縮,既用winzip把dmp檔案可以很好的壓縮。
也可以在上面命令後面 加上 compress=y 來實現。

資料的匯入
1 將D:daochu.dmp 中的資料匯入 TEST資料庫中。
imp system/manager@TEST file=d:daochu.dmp
imp aichannel/aichannel@HUST full=y file=d:datanewsmgnt.dmp ignore=y
上面可能有點問題,因為有的表已經存在,然後它就報錯,對該表就不進行匯入。
在後面加上 ignore=y 就可以了。
2 將d:daochu.dmp中的表table1 匯入
imp system/manager@TEST file=d:daochu.dmp tables=(table1)

基本上上面的匯入匯出夠用了。不少情況要先是將表徹底刪除,然後匯入。

注意:
操作者要有足夠的許可權,許可權不夠它會提示。
資料庫時可以連上的。可以用tnsping TEST 來獲得資料庫TEST能否連上。

當然,上面的方法在匯出資料時可能會匯出很大的包,那是因為你的使用者可能在授權的時候授予了DBA的許可權,所以可以採用下面方法來進行Database Backup:

Database Backup
建議系統過渡後,每周進行一次備份。或者在資料表發生重大改變前,對要改變的資料表進行備份。
執行以下步驟,進行備份。
在命令列裡,敲入“cmd”,斷行符號,進入命令列視窗。
在視窗中,輸入:
exp mas/123456@mas

系統提示:輸入數組提取緩衝區大小: 4096 >
可以直接斷行符號;

系統提示:匯出檔案: EXPDAT.DMP>
此處輸入匯出檔案的位置,其路徑必須存在,Oracle在這裡不會自動建立路徑,但可以建立檔案名稱。備份檔案以dmp作為尾碼。
輸入內容如:e:\work\mas_db_090925v1.dmp 斷行符號

系統提示: (1)E(完整的資料庫),(2)U(使用者) 或 (3)T(表): (2)U > u
此處可以輸入u,也可以直接斷行符號,因為系統此時預設的是U

系統提示:匯出許可權(......餘下全文>>
 
使用EXPDP匯出2個使用者,SCHEMAS=USER1,USER2 IMPDP匯入時,如果只想匯入user1,怎寫

SCHEMAS參數中唯寫一個,
如果還要轉換使用者名稱,在REMAP_SCHEMA參數中,唯寫一個使用者就可以了。比如在REMAP_SCHEMA=USERA:USERB
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.