我的导出文件中缺少 Oracle、Blob 数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22807316/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:18:36  来源:igfitidea点击:

Oracle, Blob data are missing in my export file

oracleoracle11goracle-sqldeveloperdata-export

提问by Spring

I use Oracle 11g, I am trying to export my data(only the data, not table create scripts etc.) So it can be imported by customer to their database

我使用 Oracle 11g,我试图导出我的数据(只有数据,而不是表创建脚本等)所以它可以由客户导入到他们的数据库中

When I use Oracle Sql developer's export database, it only exports the data but my BLOB's are missing! There are a lot of image files in one of my tables which I want to export as well.

当我使用 Oracle Sql 开发人员的导出数据库时,它只导出数据但我的 BLOB 丢失了!我的一张表中有很多图像文件,我也想导出它们。

I wonder If I really need to use oracle exp imp tool;

我想知道我是否真的需要使用oracle exp imp 工具;

http://docs.oracle.com/cd/B28359_01/server.111/b28319/exp_imp.htm#i1004777

http://docs.oracle.com/cd/B28359_01/server.111/b28319/exp_imp.htm#i1004777

Any idea?

任何的想法?

采纳答案by Alex Poole

From the documentation:

从文档

Format: Select the desired output format for the data to be unloaded. Depending on the selected format, other options may appear. For example, for xls (Microsoft Excel file), you can specify worksheet names for the data and the SELECT statement.

For CLOB data, exporting is supported only if the format is loader (SQL*Loader) or pdf (PDF). Some export types export only a subset of the string followed by an ellipsis (...).

格式:为要卸载的数据选择所需的输出格式。根据所选格式,可能会出现其他选项。例如,对于 xls(Microsoft Excel 文件),您可以为数据和 SELECT 语句指定工作表名称。

对于 CLOB 数据,仅当格式为 loader (SQL*Loader) 或 pdf (PDF) 时才支持导出。某些导出类型仅导出字符串的子集,后跟省略号 (...)。

It doesn't explicitly refer to BLOBs, but if CLOBs can only be exported as loader or pdf, it makes sense that BLOBs would also have that restriction. If you want to recreate this data in another schema or database, SQL*Loader format seems like a good choice.

它没有明确指代 BLOB,但如果 CLOB 只能作为 loader 或 pdf 导出,那么 BLOB 也有这种限制是有道理的。如果您想在另一个模式或数据库中重新创建这些数据,SQL*Loader 格式似乎是一个不错的选择。

What would you expect the insertstatement to look like? You'd have to have a text literal containing the binary value, which is a problem in itself, but you'd also be limited to 4k - which many image files might exceed. For a CLOB it might give you the first 4903 chars followed by an ellipsis in the string literal, but I'm not sure; for a BLOB even that wouldn't make any sense.

您希望该insert声明是什么样的?你必须有一个包含二进制值的文本文字,这本身就是一个问题,但你也被限制在 4k - 许多图像文件可能会超过。对于 CLOB,它可能会为您提供前 4903 个字符,后跟字符串文字中的省略号,但我不确定;对于 BLOB,即使这样也没有任何意义。

If you want to transfer data between databases you should consider data pump export/import, or if you (or your client) are restricted by server access then you could fall back to legacy export/import. Both support LOBs. Data pump is superior and should be used in preference if at all possible. The only downside really is that the dump files are written to the database server and getting access to them (or permissions on a directoryobject to write to canbe problematic in some organisations.

如果您想在数据库之间传输数据,您应该考虑data pump export/import,或者如果您(或您的客户端)受到服务器访问的限制,那么您可以回退到旧的 export/import。两者都支持 LOB。数据泵是优越的,如果可能的话应该优先使用。唯一的缺点是转储文件被写入数据库服务器并可以访问它们(或者在某些组织中directory写入对象的权限可能会出现问题。

回答by Veerender

Any LOB can't be inserted (export/import) directly as normal data. You have to write a place/SQL block to get blob from db and write it on is. Check out this link, this is how you exactly do it.

任何 LOB 都不能作为普通数据直接插入(导出/导入)。您必须编写一个位置/SQL 块才能从 db 中获取 blob 并将其写入 is。看看这个链接,这就是你如何做到的。

http://www.dba-oracle.com/t_writing_blob_clob_os_file.htmCheers mate V

http://www.dba-oracle.com/t_writing_blob_clob_os_file.htm干杯伙伴 V