天天看点

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/