oracle10g 空表無法匯出導致項目報錯—— 表或視圖不存在,oracle10g視圖

來源:互聯網
上載者:User

oracle10g 空表無法匯出導致項目報錯—— 表或視圖不存在,oracle10g視圖

     今天下午將遠端資料庫中資料匯出然後匯入到本機資料庫,部署的項目串連本機資料庫後jboss啟動後編譯報如下錯誤:


     嚴重: Exception sending context initialized event to listener instance of class com.dicpsi.mis.contextListener.ContextListener
org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy1.find(Unknown Source)
Caused by: java.sql.SQLException: ORA-00942: 表或視圖不存在。


尋找原因:通過報錯資訊表或試圖不存在,我試圖通過以上資訊來定位相關的不存在的表,但是我沒有找到這些不存在的表。然後,我開啟遠端資料庫此使用者的資料表和我匯入的本機資料表做對比,發現匯入本機資料庫的表中少了8張在遠端資料資料庫中資料為空白的表。


解決方案:最後我通過尋找相關文檔,通過以下sql語句重新匯出遠端資料伺服器中儲存資料為空白的表。



--選出為空白的欄位
select 'alter table '||table_name||' allocate extent(size 64k);' from tabs t     where not exists (select segment_name from user_segments s where s.segment_name=t.table_name);

註明:

oracle11g的新特性,資料條數是0時不分配segment,所以就不能被匯出。執行以上sql後,將在查詢內容中列舉出所有儲存資料為空白的表,並產生如下sql語句,然後將以下內容複寫黏貼出來執行。


--改變為空白的表,讓其匯出資料庫時識別
alter table PBCATVLD allocate extent(size 64k);
alter table PBCATTBL allocate extent(size 64k);
alter table PBCATCOL allocate extent(size 64k);
alter table MIS_WORDBOOKMARK allocate extent(size 64k);
alter table MIS_CHAT_SPARE allocate extent(size 64k);
alter table MIS_CHART allocate extent(size 64k);
alter table AS_TRANSRESULT_CHECKACCOUNT allocate extent(size 64k);
alter table AS_TRANSERRLOG allocate extent(size 64k);
alter table AS_BANKTRANSCOMPARE allocate extent(size 64k);
alter table AR_CUSTOMERINFO allocate extent(size 64k);

註明:執行完以上sql語句,原來遠端資料庫中儲存資料為空白的表將會被匯出,只不過資料依舊為空白。

匯出資料庫語句:

exp 使用者名稱/密碼@資料庫執行個體名 file=/home/oracle/exp.dmp log=/home/oracle/exp_smsrun.log

匯出資料庫語句舉例:

exp scpssts/scpssts123@dicpsi file = D:\ora\scpssts.dmp owner = scpssts log=D:\ora\scpssts.log

更改後重新啟動jboss編譯成功。

聯繫我們

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