Oracle 資料庫操作

來源:互聯網
上載者:User

標籤:

---恢複內容開始---

現在大型企業一般都用Oracle資料庫,Oracle資料庫在一般採用expdp,impdp 匯出匯入資料,但是在操作中經常會遇到一些問題。下面來淺析這些問題。

1. 匯出資料

一般匯出資料的時候需要建立一個目錄位址

select * from dba_directories; --查詢所有目錄位址
create or replace directory winqt_dump as ‘/home/front/dmpfile‘; --建立目錄位址
grant read,write on directory winqt_dump to qtdb; --給目錄位址賦讀寫權限

drop directory dumpwinqt; --刪除目錄位址

select username,default_tablespace from dba_users; -- 查詢使用者下面的資料表空間
select * from user_indexes; --查詢使用者下所有索引

select table_name from user_tables where NUM_ROWS > 0; --查詢有資料的表

注意在 資料庫賦值許可權的時候需要用oracle使用者登入。

expdp qtdb/qtdb dumpfile=20150907test.dmp directory=dumpwinqt schemas=qtdb logfile=export.log; --匯出資料庫

touch export.log ; --匯出日誌路徑

chomd 777 export.log; --給日誌賦許可權

如所有

問題1:

2. 匯入資料

impdp hsqtdb/hsqtdb dumpfile=20150217qtdb.dmp directory=dumpwinqt remap_schema=hnqtdb:hsqtdb nologfile=true; --匯入資料

匯出用expdp 對應的匯入就用impdp 否則會報如下錯誤:

如果用空表存在 最好用expdp 匯出 因為oracle11g中有個新特性,當表無資料時,不分配segment,以節省空間的,所以exp導不出空表。解決的辦法是用expdp

3. 建立資料庫執行個體

sqlplus / as sysdba
drop user c3front cascade;
create user c1ecifgp identified by c1ecifgp default tablespace USERS temporary tablespace TEMP ;
grant connect , resource , dba to c1ecifgp ;

 

Oracle 資料庫操作

聯繫我們

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