ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ORACLE常见问题以及解决方法3

ORACLE常见问题以及解决方法3

原创 Linux操作系统 作者:xccfeng 时间:2013-03-04 10:28:54 0 删除 编辑
1.   SQL*Loader 加载数据

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

常规加载数据指令:sqlldr system/system control=ldr_case2.ctl

System为需要导入的用户名

ldr_case2.ctl为控制文件,具体内容:

load data  -->固定语法

infile ldr_case1.dat -->指定数据文件

truncate into table TestSQLLDR –-> truncate:删除表中原有记录,重新插入新数据; insert:插入新数据,要求表必须为空;append:不删除表的原有数据添加数据。

fields terminated by ','( --> 指定数据文件以逗号为分隔符

t_id,

t_name,

filename,

remark lobfile(filename) terminated by EOF --> 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; --> 写日志

@alter.sql --> 执行alter.sql

4.   Oracle11g 导dmp,错误EXP-00091报错以及解决方法

先查看错误详细信息:oerr exp 00091

解决方法:

查看DB中的NLS_CHARACTERSET的值;
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/lhj@CRM201 wner=inventory tables=res_sim file=/home/oracle11g/BAK/inventory.dmp log=/home/oracle11g/BAK/inventory.log

参数owner和tables不能同时存在;

exp system/lhj@CRM201 tables=inventory.res_sim file=/home/oracle11g/BAK/inventory.dmp log=/home/oracle11g/BAK/inventory.log 

exp system/system@eplus122 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/system@eplus122 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博客 ” ,链接:https://blog.itpub.net/28588485/viewspace-755231/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-02-25

  • 博文量
    56
  • 访问量
    254454