开发环境
名称 | 版本 |
---|---|
操作系统 | Windows 10 X64 |
Oracle | win64_11gR2_database |
PLSQL Developer | 11.0.4.1788(64 bit)01.179332 - Unlimited user license |
问题描述
系统里面 PATENT_HISTORY 表的导出功能超过半小时都无法导出,导致系统报错。
问题分析
PATENT_HISTORY 表结构如下:
create table PATENT_HISTORY
(
case_id VARCHAR2(255) not null,
tencent_code VARCHAR2(600),
invent_name VARCHAR2(3000),
create_time DATE,
creator_full_name VARCHAR2(255),
apply_code VARCHAR2(600),
apply_date DATE,
first_inventor VARCHAR2(510),
other_inventor VARCHAR2(1000),
costcenter_code VARCHAR2(255),
costcenter_name VARCHAR2(255),
pact_company VARCHAR2(255),
applicantor VARCHAR2(600),
dept_id VARCHAR2(255),
org_name VARCHAR2(600),
proclaim_date DATE,
proclaim_no VARCHAR2(600),
law_state_name VARCHAR2(255),
patent_type_name VARCHAR2(255),
apply_country_chname VARCHAR2(600),
is_university_cooperation VARCHAR2(255),
related_product VARCHAR2(600),
keyword VARCHAR2(1500),
transaction_type_name VARCHAR2(600),
sync_date DATE,
balancing_seg VARCHAR2(255),
ou_name VARCHAR2(255),
current_step_name CLOB,
abstract CLOB,
inventor CLOB,
first_tag_name CLOB,
second_tag_name CLOB,
third_tag_name CLOB
)
猜测是 PATENT_HISTORY 中的 CLOB 导致的。
问题解决
1.备份 PATENT_HISTORY 表
alter table PATENT_HISTORY rename to PATENT_HISTORY20200728;
2.创建新的表
CLOB 字段修改为 varchar2(4000),注意数据丢失问题
create table PATENT_HISTORY
(
case_id VARCHAR2(255) not null,
tencent_code VARCHAR2(600),
invent_name VARCHAR2(3000),
create_time DATE,
creator_full_name VARCHAR2(255),
apply_code VARCHAR2(600),
apply_date DATE,
first_inventor VARCHAR2(510),
other_inventor VARCHAR2(1000),
costcenter_code VARCHAR2(255),
costcenter_name VARCHAR2(255),
pact_company VARCHAR2(255),
applicantor VARCHAR2(600),
dept_id VARCHAR2(255),
org_name VARCHAR2(600),
proclaim_date DATE,
proclaim_no VARCHAR2(600),
law_state_name VARCHAR2(255),
patent_type_name VARCHAR2(255),
apply_country_chname VARCHAR2(600),
is_university_cooperation VARCHAR2(255),
related_product VARCHAR2(600),
keyword VARCHAR2(1500),
transaction_type_name VARCHAR2(600),
sync_date DATE,
balancing_seg VARCHAR2(255),
ou_name VARCHAR2(255),
current_step_name VARCHAR2(4000),
abstract VARCHAR2(4000),
inventor VARCHAR2(4000),
first_tag_name VARCHAR2(4000),
second_tag_name VARCHAR2(4000),
third_tag_name VARCHAR2(4000)
);
3.同步 PATENT_HISTORY20200728 表数据到 PATENT_HISTORY
-- =============================================
-- Author: v_hwhao
-- Create date: 2020年7月29日10:15:25
-- Description: 同步 TPS_OST_PATENT20200728 表数据到 TPS_OST_PATENT
-- =============================================
insert /*+APPEND*/ into PATENT_HISTORY
(
case_id
,tencent_code
,invent_name
,create_time
,creator_full_name
,apply_code
,apply_date
,first_inventor
,other_inventor
,costcenter_code
,costcenter_name
,pact_company
,applicantor
,dept_id
,org_name
,proclaim_date
,proclaim_no
,law_state_name
,patent_type_name
,apply_country_chname
,is_university_cooperation
,related_product
,keyword
,transaction_type_name
,sync_date
,balancing_seg
,ou_name
,current_step_name
,abstract
,inventor
,first_tag_name
,second_tag_name
,third_tag_name
)
select
case_id
,tencent_code
,invent_name
,create_time
,creator_full_name
,apply_code
,apply_date
,first_inventor
,other_inventor
,costcenter_code
,costcenter_name
,pact_company
,applicantor
,dept_id
,org_name
,proclaim_date
,proclaim_no
,law_state_name
,patent_type_name
,apply_country_chname
,is_university_cooperation
,related_product
,keyword
,transaction_type_name
,sync_date
,balancing_seg
,ou_name
,current_step_name
,abstract
,inventor
,first_tag_name
,second_tag_name
,third_tag_name
from PATENT_HISTORY20200728;
commit;
测试结果
这里的数据量是 32900 条
1.使用 PATENT_HISTORY 表导出数据
导出时间 17:52-17:55
2.使用 PATENT_HISTORY20200728 导出数据
导出时间 10:08-10:58