重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 654|回复: 0
打印 上一主题 下一主题

[Oracle] ORA-1722 During Import

[复制链接]
跳转到指定楼层
楼主
发表于 2024-9-29 14:47:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
现象:
When importing a table:


imp <USER>/<PASSWORD>file=<DUMPFILE NAME>.dmp fromuser=<USER 1> touser=<USER 2> tables=<TABLENAME> rows=n buffer=20000000 ignore=y log=<LOGFILE>.log feedback=100000

the import log file contains:


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

Export file created by EXPORT:V09.02.00 via conventional path
import done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
. importing <USER 1>'s objects into <USER 2>
IMP-00017: following statement failed with ORACLE error 1722:
" ALTER TABLE "<TABLE NAME>" MODIFY ("<COLUMN NAME>" DEFAULT '0,2


原因:
Bug 4038803 IMP-3 ORA-1722 WHEN USING NLS_NUMERIC_CHARACTERS != '.,' SET IN ENVIRONMENT

or

Database corruption

处理方法:
Workaround for the Bug 4038803:
In the source database:

1. Create a reference table:


create table <TABLE NAME>
(
   obj#     number,
   name     varchar2(30),
   default$ varchar2(4000)
);

2. Fill that reference table with the useful information:


declare
  v1 number;
  v2 varchar2(30);
  v3 varchar2(4000)
  CURSOR c_select IS select obj#, name, default$ from col$;

begin
  Open c_select;
  LOOP
    Fetch c_select into v1, v2, v3;
    exit when c_select%NOTFOUND;
    insert into <TABLE NAME> values (v1, v2, v3);
  END LOOP;
  Close c_select;
  commit;
end;
/

3. Query that reference table to check which object and column could have the wrong format:



select distinct O.object_name, D.name, D.default$
from   dba_objects O, <TABLE NAME> D
where  D.obj# = O.object_id and
       (default$ like '%,0%' or
        default$ like '%,1%' or
        default$ like '%,2%' or
        default$ like '%,3%' or
        default$ like '%,4%' or
        default$ like '%,5%' or
        default$ like '%,6%' or
        default$ like '%,7%' or
        default$ like '%,8%' or
        default$ like '%,9%' or
        default$ like '%0,%' or
        default$ like '%1,%' or
        default$ like '%2,%' or
        default$ like '%3,%' or
        default$ like '%4,%' or
        default$ like '%5,%' or
        default$ like '%6,%' or
        default$ like '%7,%' or
        default$ like '%8,%' or
        default$ like '%9,%');

4. Change the incorrect default value to a good one:


Alter table <TABLE_NAME> modify column default NEW_DEFAULT_VALUE;

Then you should be able to do your export and import without the issue.

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-24 22:06 , Processed in 0.103569 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表