天天看點

ORACLE常見問題以及解決方法3

1.  

SQL*Loader 加載資料

指令:sqlldr(windows可以用大寫,Unix,Linux隻能用小寫)

正常加載資料指令:sqlldr system/system control=ldr_case2.ctl

System為需要導入的使用者名

ldr_case2.ctl為控制檔案,具體内容:

load data  --&gt固定文法

infile ldr_case1.dat --&gt指定資料檔案

truncate into table TestSQLLDR –-> truncate:删除表中原有記錄,重新插入新資料; insert:插入新資料,要求表必須為空;append:不删除表的原有資料添加資料。

fields terminated by ','( --&gt 指定資料檔案以逗号為分隔符

t_id,

t_name,

filename,

remark lobfile(filename) terminated by EOF --&gt remark為clob類型,此段意為将filename(/opt/oradata/TestOracle/ldr_case2.log)檔案内容寫入remark字段中

)

ldr_case1.dat為資料檔案,具體内容:

0003,TestCLOB,/opt/oradata/TestOracle/ldr_case2.log

執行成功标緻如下:

查詢資料庫表結果如下:

2.  

Sql 查詢某個資料庫表屬于哪個使用者

select t.owner,t.table_name from dba_tables t where t.table_name = '表名';

3.  

Oracle11g dmp 時,空表不會被導出的問題以及解決方法

因為oracle11g特性,導dmp時,空表不會被配置設定segment,是以不會被導出;

解決方法:向所有空表插入一個allocate extent;

用plsql工具執行sql:select 'alter table '||owner||'.'||table_name||' allocate extent;' from dba_tables where num_rows=0 and  owner in ('CCARE','BILLING','RATING','TOPENG');

結果如下:

将所有的語句複制粘貼到alter.sql中,上傳到oracle伺服器上;

Spool alter.log; --&gt 寫日志

@alter.sql --&gt 執行alter.sql

4.  

Oracle11g dmp ,錯誤 EXP-00091 報錯以及解決方法

先檢視錯誤詳細資訊:oerr exp 00091

解決方法:

select * from v$nls_parameters  where parameter='NLS_CHARACTERSET';      

檢視環境變量中的NLS_LANG;echo $NLS_LANG

沒有設定,需要設定和NLS_CHARACTERSET一樣的值;

NLS_LANG=AMERICAN_AMERICA.AL32UTF8;

設定完成,再導就不會出現EXP-000091;

5.  

EXP-00026(DMP 導單個表 TABLE): conflicting modes specified – 模式沖突

exp system/[email protected] wner=inventory tables=res_sim file=/home/oracle11g/BAK/inventory.dmp log=/home/oracle11g/BAK/inventory.log

參數owner和tables不能同時存在;

exp system/[email protected] tables=inventory.res_sim file=/home/oracle11g/BAK/inventory.dmp log=/home/oracle11g/BAK/inventory.log 

exp system/[email protected] tables=crmpub.brm_node crmpub.brm_factor crmpub.brm_datasource crmpub.brm_datagetter  file=/opt/oracle/app/oracle/oradata/eplus122/eplusdmp/crmpub.dmp log=/opt/oracle/app/oracle/oradata/eplus122/eplusdmp/crmpub.log

imp system/[email protected] fromuser=crmpub touser=crmpub  file=/opt/oracle/app/oracle/oradata/eplus122/eplusdmp/crmpub.dmp log=/opt/oracle/app/oracle/oradata/eplus122/eplusdmp/crmpub.log

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28588485/viewspace-755231/,如需轉載,請注明出處,否則将追究法律責任。

轉載于:http://blog.itpub.net/28588485/viewspace-755231/