EXP-00003 When Exporting From 9.2.0.5.0 or any Higher Release with a Pre-9.2.0.5.0 Export Client

本文介绍了解决使用较低版本Export工具从Oracle 9.2.0.5及更高版本数据库导出数据时出现的EXP-00003错误的方法。此问题发生在当表或大型对象分配了多个段扩展时。文章提供了两种解决方案,包括修改导出定义。
使用9.2.0.1的export导出工具 导出 10.2.0.1的数据库中的数据,确实有问题。exp-00003

ORACLE文档提供了相关资料:

使用9.2.0.5以下的export导出工具,导出9.2.0.5或以上版本的数据库的数据,的确会导致报错exp-00003.

具体的bug内容,ORACLE并没有公开。

解决方法:

确实就是您在文档中所查到的方法。

我发给您的文档中,“Workaround 2”就是描述了这样的方法。

[@more@]
Doc ID: 274076.1Type: PROBLEM
Modified Date : 04-JUL-2008Status: PUBLISHED

The information in this document applies to:

Oracle Server - Enterprise Edition - Version: 8.1.7.0 to 9.2.0.4
Oracle Server - Personal Edition - Version: 8.1.7.0 to 9.2.0.4
Oracle Server - Standard Edition - Version: 8.1.7.0 to 9.2.0.4
This problem can occur on any platform.
Table being exported is in Oracle9i 9.2.0.5.0 or any higher source database.
Table itself or Large Object (LOB) in table has more than one extent allocated.
The version of the Export utility is Pre-9.2.0.5.0.
Export can be either table level or schema level or database level.

Symptoms

... (left out previous output)
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
. . exporting table DEPT 4 rows exported
. . exporting table DUMMY 1 rows exported
. . exporting table EMP 14 rows exported
. . exporting table EMP2EXTENT
EXP-00003: no storage definition found for segment(9, 907)
. . exporting table SALGRADE 5 rows exported
. exporting synonyms
... (left out remaining output)
Export terminated successfully with warnings.

Cause

This problem during export has been introduced with the 9.2.0.5 patchset. In that patchset, a fix has been included for Bug 2948717 "Queries against DBA_SEGMENTS can be slow accessing BYTES/BLOCKS/EXTENTS columns". Note that this fix has also been implemented in Oracle10g Release 1 (10.1.0.2.0).

As a result of that fix, an export from the 9.2.0.5.0 or any higher release database (e.g. 9.2.0.6.0 or 10.1.0.4.0) with a lower release export utility, e.g. 9.2.0.4.0 or 8.1.7.4.0 will now produce the EXP-3 error. For details see:
Bug 3593227 "EXP-3 WHEN EXPORTING A TABLE WITH MORE THAN 1 EXTENT USING EXP BELOW 9.2.0.5"
Bug 3784697 "EXPORT OF LOB FROM 9205 WITH PRE-9205 EXP GIVES EXP-3 (NO STORAGE DEF FOUND)"

These bugs were closed as a duplicate of:
Bug 3291851 "EXP-3: NO STORAGE DEFINITION FOUND FOR SEGMENT" (not a public bug)

Solution

The EXP-3 error only occurs when the export from the 9.2.0.5.0 or any higher release database (e.g. 9.2.0.6.0 or 10.1.0.4.0) is done with a lower release export utility, e.g. 9.2.0.4.0. The reason to run an export from a 9.2.0.5.0
or any higher release database (e.g. 9.2.0.6.0 or 10.1.0.4.0) with a 9.2.0.4.0 export utility, is to import the export dump file later into a target database of that lower release.

Note: if your intention is to export from a 9.2.0.6.0 database in order to import (back) into a 9.2.0.6.0 target database, there is no need to use a pre-9.2.0.5 release export utility. In that situation use the 9.2.0.6.0 export utility.

Workaround 1
-------------

Rerun the export and specify the parameter COMPRESS=Y (this is the default value for COMPRESS).

If you have a table with a secondary object, e.g. a LOB column, then this workaround might not work and you will re-produce the EXP-3 error during export. In that case, use workaround 2.

Workaround 2
-------------

a. Make a note of the export definition of exu9tne from $ORACLE_HOME/rdbms/admin/catexp.sql

b. Copy this to a new file and add:
"UNION ALL select * from sys.exu9tneb"
to the end of the definition

e.g. In the 9.2.0.5.0 or any higher release source database (e.g. 9.2.0.6.0 or 10.1.0.4.0), the workaround view would be:

CREATE OR REPLACE VIEW exu9tne (
tsno, fileno, blockno, length) AS
SELECT ts#, segfile#, segblock#, length
FROM sys.uet$
WHERE ext# = 1
UNION ALL
SELECT * from sys.exu9tneb
/

c. Run this as the SYS user (!) against the database that needs to be exported.

d. Re-run the export as required.

e. Put back the original definition of exu9tne as obtained in step a.

Note: only use this workaround when absolutely necessary, and don't forget to put back the original definition of the view SYS.exu9tne as mentioned in step e.

References

Bug 2948717 - Performance Of Query On Dba_Segments Is Bad When Accessing Any "Size" Column
Bug 3593227 - Exp-3 When Exporting A Table With More Than 1 Extent Using Exp < 9.2.0
Bug 3784697 - Export Of Lob From 9205 With Pre-9205 Exp Gives Exp-3 (No Storage Def Found)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/87149/viewspace-1028313/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/87149/viewspace-1028313/

<think>好的,我现在需要处理用户的问题:“Re-exporting a type when &#39;verbatimModuleSyntax&#39; is enabled requires using &#39;export type&#39;.” 用户之前已经询问过如何导出接口类型,现在这个问题涉及到TypeScript中的一个特定配置选项,即`verbatimModuleSyntax`,以及在启用该选项时重新导出类型需要使用`export type`的情况。 首先,我要理解用户的问题。用户可能在项目中启用了`verbatimModuleSyntax`,并且在尝试重新导出类型时遇到了错误,提示需要使用`export type`。我的任务就是解释为什么在启用这个选项时会有这样的要求,以及如何正确地进行重新导出。 接下来,我需要回忆`verbatimModuleSyntax`的作用。这个TypeScript编译器选项用于控制模块的编译方式。当启用时,它会确保模块的导入和导出语句在编译后的JavaScript代码中保持原样,不会进行任何转换。这与TypeScript默认的处理方式不同,默认情况下,TypeScript会移除类型导入和导出,因为它们只在编译时存在。但有些工具(如Babel或某些打包工具)可能需要明确的类型语法,这时候`verbatimModuleSyntax`就很有用。 然后,我需要考虑重新导出类型的情况。在TypeScript中,通常可以使用`export { SomeType } from &#39;./module&#39;`来重新导出类型。但在启用`verbatimModuleSyntax`的情况下,这样做会导致问题,因为TypeScript需要明确区分类型和值的导出。类型是编译时的概念,而值是运行时的存在。如果直接使用普通的`export`语句重新导出类型,TypeScript可能会混淆,导致编译后的代码包含不必要的内容,或者出现错误。 接下来,我需要验证为什么必须使用`export type`。根据TypeScript的文档,当启用`verbatimModuleSyntax`时,所有类型相关的导入和导出都必须显式使用`type`修饰符,以明确指示这些是类型而不是值。这有助于工具链正确处理模块,避免将类型信息错误地包含在运行时代码中。 然后,我需要构造一个正确的示例,展示如何在启用`verbatimModuleSyntax`时正确重新导出类型。比如,用户可能有一个模块`types.ts`,里面定义了一个接口`User`,然后在另一个文件`index.ts`中需要重新导出这个接口。正确的做法应该是使用`export type { User } from &#39;./types&#39;;`而不是普通的`export { User } from &#39;./types&#39;;`。 此外,我还需要考虑用户可能遇到的常见错误场景。例如,用户可能尝试直接重新导出类型而没有使用`export type`,导致TypeScript编译器报错。我需要指出这种错误的具体表现,比如错误信息是什么,以及如何通过添加`type`关键字来修复。 另外,用户可能会问为什么在普通情况下不需要这样做,而只有在启用`verbatimModuleSyntax`时才需要。这时候需要解释不同编译器选项对模块处理的影响,特别是`verbatimModuleSyntax`如何改变TypeScript的默认行为,使其更严格地遵循ES模块语法,同时保留类型导入/导出的显式声明。 同时,我需要比较`verbatimModuleSyntax`与其他相关选项的区别,比如`isolatedModules`,可能用户对这两个选项的异同不太清楚。简要说明两者的不同可以帮助用户更好地理解为什么需要特定的配置。 最后,总结最佳实践,建议用户在启用`verbatimModuleSyntax`时始终使用`export type`进行类型重新导出,以确保代码的兼容性和正确性,并避免潜在的编译错误。</think>以下是关于在启用 `verbatimModuleSyntax` 时重新导出类型的详细指南: --- ### 一、问题本质解析 当 TypeScript 启用 `verbatimModuleSyntax` 编译器选项时,强制要求: - **类型导出必须显式标注 `type`**(普通值导出保持原样) - **确保编译后的 JavaScript 保留原始模块语法**(不自动转换类型声明) 此选项常用于需要严格匹配源码与编译结果的场景(如某些打包工具链) --- ### 二、错误场景演示 ```typescript // types.ts export interface User { id: string; name: string; } // index.ts export { User } from "./types"; // ❌ 错误!需使用 export type ``` **报错信息示例**: ``` Re-exporting a type when &#39;verbatimModuleSyntax&#39; is enabled requires using &#39;export type&#39; ``` --- ### 三、正确解决方案 #### 1. 单类型导出 ```typescript export type { User } from "./types"; // ✅ 正确写法 ``` #### 2. 混合导出(类型 + 值) ```typescript // utils.ts export const MAX_SIZE = 100; // 实际值 export type SizeConfig = { // 纯类型 width: number; height: number; }; // index.ts export { MAX_SIZE }; // 正常导出值 export type { SizeConfig }; // 显式导出类型 ``` #### 3. 批量导出类型 ```typescript export type { User, Product, Order } from "./models"; // ✅ 多类型导出 ``` --- ### 四、配置对比说明 | 编译器选项 | 行为特点 | 类型导出要求 | |---------------------|---------------------------------|--------------------------| | `verbatimModuleSyntax: true` | 保持源码模块语法原样输出 | **必须**使用 `export type` | | 默认配置 | 自动移除类型相关语句 | 无需特殊标注 | | `isolatedModules: true` | 强制兼容单文件编译 | 推荐使用 `export type` | --- ### 五、底层原理 1. **类型擦除特性**:TypeScript 接口/类型别名在编译后会被删除 2. **模块语法保留**:`verbatimModuleSyntax` 要求编译后的 JS 必须与 TS 源码的模块语句完全一致 3. **工具链兼容**:确保 Babel 等工具能正确处理类型(不会将类型误认为实际值) --- ### 六、扩展应用 #### 泛型类型导出 ```typescript // 正确写法 export type { ResponseWrapper } from "./api"; // 错误写法 export { ResponseWrapper } from "./api"; // ❌ ``` #### 命名空间类型导出 ```typescript export type { NamespaceType } from "./complex-types"; ``` --- ### 七、迁移建议 1. 全局搜索 `export { ... } from` 模式 2. 为所有纯类型导出添加 `type` 关键字 3. 使用 ESLint 规则自动检测: ```json { "rules": { "@typescript-eslint/consistent-type-exports": "error" } } ``` 通过遵循这些规范,可确保代码在严格模块模式下正常工作,同时保持最佳编译兼容性。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值