Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

207

积分

1

好友

4

主题
1#
发表于 2012-1-13 10:50:22 | 查看: 14461| 回复: 15
源端HPUX,目标端RHL,客户端win2003,DB 10g,由于都是在客户端操作的,因此我没有列出具体的源端和目标端信息。
从一个user模式导出的dmp中执行tables模式导入,提示:

IMP-00032: SQL statement exceeded buffer length
IMP-00008: unrecognized statement in the export file:

解决办法是增加imp参数 buffer=81920
爱老婆,爱FM,爱音乐;挨踢,爱折腾,爱Oracle
2#
发表于 2012-1-13 10:52:31
buffer默认依赖于操作系统:
BUFFER

Default: operating system-dependent. See your Oracle operating system-specific documentation to determine the default value for this parameter.

win2003下默认值是exp是4096,imp是8192,见如下测试:
C:\Users\Administrator>exp

Export: Release 10.2.0.1.0 - Production on 星期五 1月 13 10:14:36 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


用户名: system@test2.4
口令:

连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
输入数组提取缓冲区大小: 4096 > ^C

D:\>imp

Import: Release 10.2.0.1.0 - Production on 星期五 1月 13 10:16:44 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

用户名: gtlions@test2.4
口令:

连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

导入文件: EXPDAT.DMP> 1.dmp

输入插入缓冲区大小 (最小为 8192) 30720>^

回复 只看该作者 道具 举报

3#
发表于 2012-1-13 10:54:38
我操作的表结构如下:

文档中有描述的计算字段的如下:
Example: Calculating Buffer Size

This section shows an example of how to calculate buffer size.

The following table is created:

CREATE TABLE sample (name varchar(30), weight number);


The maximum size of the name column is 30, plus 2 bytes for the indicator. The maximum size of the weight column is 22 (the size of the internal representation for Oracle numbers), plus 2 bytes for the indicator.

Therefore, the maximum row size is 56 (30+2+22+2).

To perform array operations for 100 rows, a buffer size of 5600 should be specified.

([I}I2B0VS29QOXIN9O@_)R.jpg (15.48 KB, 下载次数: 551)

([I}I2B0VS29QOXIN9O@_)R.jpg

回复 只看该作者 道具 举报

4#
发表于 2012-1-13 10:55:28
按照文档描述我的表远远没有超过8192啊,怎么出现这个提示,而且提示的字面意思似乎是sql语句。。。。。

回复 只看该作者 道具 举报

5#
发表于 2012-1-13 14:54:12
纠正下:buffer默认值是exp是4096,imp是30720

回复 只看该作者 道具 举报

6#
发表于 2012-1-13 15:06:45
经过验证,至少从我这次验证来看是由于exp出来的文件中的表的创建语句太长导致的,我做了个测试,创建一个分区表,逐步增加分区数量,然后做导出和导入操作。

回复 只看该作者 道具 举报

7#
发表于 2012-1-13 15:07:23
在最后一次导入操作中出现了这个错误:
  1. [oracle@localhost test]$ imp gtlions/gtlions file=exp.dmp tables=t_largesql_test

  2. Import: Release 10.2.0.4.0 - Production on Fri Jan 13 15:04:11 2012

  3. Copyright (c) 1982, 2007, Oracle.  All rights reserved.


  4. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
  5. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  6. Export file created by EXPORT:V10.02.01 via conventional path
  7. import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
  8. . importing GTLIONS's objects into GTLIONS
  9. IMP-00032: SQL statement exceeded buffer length
  10. IMP-00032: SQL statement exceeded buffer length
  11. IMP-00008: unrecognized statement in the export file:
  12.   
  13. Import terminated successfully with warnings.
复制代码

回复 只看该作者 道具 举报

8#
发表于 2012-1-13 15:08:25
增加buffer imp成功:
  1. [oracle@localhost test]$ imp gtlions/gtlions file=exp.dmp tables=t_largesql_test buffer=81920

  2. Import: Release 10.2.0.4.0 - Production on Fri Jan 13 15:07:37 2012

  3. Copyright (c) 1982, 2007, Oracle.  All rights reserved.


  4. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
  5. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  6. Export file created by EXPORT:V10.02.01 via conventional path
  7. import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
  8. . importing GTLIONS's objects into GTLIONS
  9. . importing GTLIONS's objects into GTLIONS
  10. IMP-00015: following statement failed because the object already exists:
  11. "CREATE TABLE "T_LARGESQL_TEST" ("ID" NUMBER(10, 0) NOT NULL ENABLE, "PHONE_"
  12. 。。。
  13. 。。。
  14. Import terminated successfully with warnings.
  15. [oracle@localhost test]$
复制代码

回复 只看该作者 道具 举报

9#
发表于 2012-1-13 15:12:13
现在的问题是怎么认定建表语句长度呢?刚刚在可以执行导入成功的情况下(没有使用buffer,默认应该是30720),使用Length(Dbms_Metadata.Get_Ddl('TABLE', 'T_LARGESQL_TEST'))查看了下是34000。可能是从dmp文件中有别的计算语句的长度还是?使用show=y的情况下,排版是个大问题,难道就是使用show=y出来看到的文本?

回复 只看该作者 道具 举报

10#
发表于 2012-1-13 19:58:18
ODM Data:
  1. OERR: IMP 32 "SQL statement exceeded buffer length" [ID 21664.1]

  2. Error:  IMP 32
  3. Text:   SQL statement exceeded buffer length
  4. -------------------------------------------------------------------------------
  5. Cause:  The buffer was too small for the SQL statement being read in
  6. Action: Rerun with a larger buffer. This may also be an indication of a
  7.         corruption in the import data file




  8. IMP-32 Obtained During Import [ID 846397.1]


  9. Applies to:

  10. Oracle Server - Enterprise Edition - Version: 9.2.0.1 to 11.2.0.2 - Release: 9.2 to 11.2
  11. Information in this document applies to any platform.
  12. Symptoms

  13. You try to import an export dump using the original import urility (imp) and received the errors:

  14. IMP-00032: SQL statement exceeded buffer length
  15. IMP-00008: unrecognized statement in the export file

  16. Let's follow the next example that demonstrates this.

  17. -- create a big table (with a large DDL, 1000 columns) in schema test
  18. connect test/test
  19. create table big_table
  20. (
  21.    col000000000000000000000000001 varchar2(4000) not null,
  22.    col000000000000000000000000002 varchar2(4000) not null,
  23.    col000000000000000000000000003 varchar2(4000) not null,
  24.    col000000000000000000000000004 varchar2(4000) not null,
  25.    col000000000000000000000000005 varchar2(4000) not null,
  26.    col000000000000000000000000006 varchar2(4000) not null,
  27.    col000000000000000000000000007 varchar2(4000) not null,
  28.    col000000000000000000000000008 varchar2(4000) not null,
  29.    col000000000000000000000000009 varchar2(4000) not null,
  30.    col000000000000000000000000010 varchar2(4000) not null,
  31.    .... 1000 columns
  32.    col000000000000000000000001000 varchar2(4000) not null
  33. );

  34. -- insert one row into table
  35. declare
  36.   i number := 1;
  37.    
  38. begin
  39.   insert into big_table values  
  40.   (
  41.      lpad (to_char (i), 1000, '0'),
  42.      lpad (to_char (i), 1000, '0'),
  43.      lpad (to_char (i), 1000, '0'),
  44.      lpad (to_char (i), 1000, '0'),
  45.      lpad (to_char (i), 1000, '0'),
  46.      lpad (to_char (i), 1000, '0'),
  47.      lpad (to_char (i), 1000, '0'),
  48.      lpad (to_char (i), 1000, '0'),
  49.      lpad (to_char (i), 1000, '0'),
  50.      lpad (to_char (i), 1000, '0'),
  51.      .... 1000 columns
  52.      lpad (to_char (i), 1000, '0')
  53.   );   
  54.   commit;   
  55. end;
  56. /

  57. Export the table with:

  58. #> exp test/test file=big_table.dmp tables=big_table

  59. This ends with:

  60. Export: Release 11.1.0.7.0 - Production on Mon Jun 22 11:52:53 2009

  61. Copyright (c) 1982, 2007, Oracle. All rights reserved.

  62. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
  63. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  64. Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set

  65. About to export specified tables via Conventional Path ...
  66. . . exporting table          BIG_TABLE           1 rows exported
  67. Export terminated successfully without warnings.

  68. Drop the table in schema TEST and import it back from written dump with:

  69. #> imp test/test file=big_table.dmp tables=big_table

  70. This ends with:

  71. Import: Release 11.1.0.7.0 - Production on Mon Jun 22 11:53:55 2009

  72. Copyright (c) 1982, 2007, Oracle. All rights reserved.

  73. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
  74. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  75. Export file created by EXPORT:V11.01.00 via conventional path
  76. import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
  77. . importing TEST's objects into TEST
  78. IMP-00032: SQL statement exceeded buffer length
  79. IMP-00032: SQL statement exceeded buffer length
  80. IMP-00008: unrecognized statement in the export file:
  81. R2(4000) NOT NULL ENABLE, "COL000000000000000000000000945" VARCHAR2(4000) NOT
  82. NULL ENABLE, "COL000000000000000000000000946" VARCHAR2(4000) NOT NULL ENABLE, "C
  83. OL000000000000000000000000947" VARCHAR2(4000) NOT NULL ENABLE, "COL0000000000000
  84. 00000000000948"...
  85. IMP-00032: SQL statement exceeded buffer length
  86. IMP-00008: unrecognized statement in the export file:
  87. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  88. 00000000000000000000000000000000000000000000000000000000000000000000000000000000
  89. 00000000000000000000000000000000000000000000000000000000000000000000000000000000
  90. 000000000000000...
  91. . importing TEST's objects into TEST
  92. Import terminated successfully with warnings.
  93. Cause

  94. The internal BUFFER (default 32 KB, if not specified in imp command line) is also used to transfer the DDL statements from export dump file to Oracle server. If the DDL exceeds the BUFFER length, then IMP-32 is raised.

  95. To obtain the DDL length run at export (source) site the statement:

  96. select dbms_lob.getlength (dbms_metadata.get_ddl ('TABLE', 'BIG_TABLE', 'TEST')) "SQL_LENGTH" from dual;

  97. SQL_LENGTH
  98. ----------
  99.      67270

  100. 1 row selected.

  101. The length of the DDL statement is in this case 67270 bytes, what exeeds the default BUFFER length (30720 bytes ~ 32 KB).
  102. Solution

  103. Increase the BUFFER size:

  104. #> imp test/test file=big_table.dmp tables=big_table buffer=100000

  105. and import succeeds:

  106. Import: Release 11.1.0.7.0 - Production on Mon Jun 22 12:10:15 2009

  107. Copyright (c) 1982, 2007, Oracle. All rights reserved.

  108. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
  109. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  110. Export file created by EXPORT:V11.01.00 via conventional path
  111. import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
  112. . importing TEST's objects into TEST
  113. . importing TEST's objects into TEST
  114. . . importing table          "BIG_TABLE"          1 rows imported
  115. Import terminated successfully without warnings.



  116. IMP-32 and IMP-8 When Doing an Import With a too Small (Default) Buffer Size [ID 146319.1]



  117. Applies to:

  118. Oracle Server - Enterprise Edition - Version: 8.0.5.0 to 11.2.0.2 - Release: 8.0.5 to 11.2
  119. Information in this document applies to any platform.
  120. Symptoms

  121. You are doing an import with parameter SHOW=Y option and receive the following errors:

  122. #> imp test/test file=test.dmp full=y show=y

  123. Import: Release 11.1.0.7.0 - Production on Thu Feb 26 16:43:24 2009

  124. Copyright (c) 1982, 2007, Oracle. All rights reserved.
  125. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
  126. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  127. Export file created by EXPORT:V11.01.00 via conventional path
  128. import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
  129. . importing TEST's objects into TEST
  130. IMP-00032: SQL statement exceeded buffer length
  131. IMP-00032: SQL statement exceeded buffer length
  132. IMP-00008: unrecognized statement in the export file:
  133. R2(4000) NOT NULL ENABLE, "COL000000000000000000000000945" VARCHAR2(4000) NOT
  134. NULL ENABLE, "COL000000000000000000000000946" VARCHAR2(4000) NOT NULL ENABLE, "C
  135. OL000000000000000000000000947" VARCHAR2(4000) NOT NULL ENABLE, "COL0000000000000
  136. 00000000000948"...
  137. IMP-00032: SQL statement exceeded buffer length

  138. Cause

  139. Even with the SHOW=Y option used, the import utility verifies the syntax of all the SQL DDL statements in the dump file. Import uses default buffer size of 64K.

  140. If the SQL statement in dump file exceeds the default buffer size, then the buffer size needs to be increased to accommodate this, otherwise the imp utility won't be able to load the full SQL statement into the buffer and raise IMP-32 and IMP-8.

  141. Solution

  142. Increase the buffer size, other than the default (64K):

  143. #> imp test/test file=test.dmp full=y show=y buffer=1000000
复制代码

回复 只看该作者 道具 举报

11#
发表于 2012-1-13 20:00:45
Cause:  The buffer was too small for the SQL statement being read in

buffer  过小会导致 imp时的SQL 语句无法读入

The length of the DDL statement is in this case 67270 bytes, what exeeds the default BUFFER length (30720 bytes ~ 32 KB).
Solution

默认的 Buffer length 是 32KB

你的情况 Length(Dbms_Metadata.Get_Ddl('TABLE', 'T_LARGESQL_TEST'))查看了下是34000

34000 > 32KB = 32 *1024= 32768

回复 只看该作者 道具 举报

12#
发表于 2012-1-13 21:10:27
怎么你演示的有2个长度啊?
前面:The internal BUFFER (default 32 KB, if not specified in imp command line)
后面:Even with the SHOW=Y option used, the import utility verifies the syntax of all the SQL DDL statements in the dump file. Import uses default buffer size of 64K.
是说在show=y的情况下是64k的吗?

回复 只看该作者 道具 举报

13#
发表于 2012-1-13 21:26:01
BUFFER   

Default: operating system-dependent. See your Oracle operating system-specific documentation to determine the default value for this parameter.


buffer 的默认值是  由操作系统平台决定的。

[oracle@vrh2 ~]$ imp

Import: Release 11.2.0.3.0 - Production on Sat Jan 14 00:21:52 2012

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username: system
Password:

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes

Import data only (yes/no): no >

Import file: expdat.dmp >

Enter insert buffer size (minimum is 8192) 30720>


Linux 上默认是 30720  ,手头暂时没有其他操作系统 可供测试

回复 只看该作者 道具 举报

14#
发表于 2012-1-13 23:36:25
buffer 的默认值是  由操作系统平台决定的--这个我上面也说到了。
我想问的是你提供的资料后面的当中的一句话:
  1. Even with the SHOW=Y option used, the import utility verifies the syntax of all the SQL DDL statements in the dump file. Import uses default buffer size of 64K.

  2. If the SQL statement in dump file exceeds the default buffer size, then the buffer size needs to be increased to accommodate this, otherwise the imp utility won't be able to load the full SQL statement into the buffer and raise IMP-32 and IMP-8.

  3. Solution

  4. Increase the buffer size, other than the default (64K)
复制代码


这个64K似乎是不同的选项的说法?

回复 只看该作者 道具 举报

15#
发表于 2012-1-13 23:44:39

回复 14# 的帖子

我不这样认为  

可能在少数平台上  BUFSIZE 默认是64K

但目前没有环境可供测试 , 当然这只是我的猜测

回复 只看该作者 道具 举报

16#
发表于 2012-1-14 09:26:37
ok,了解了,不过开贴之前还算是被我蒙对了处理问题的方向和原因,嘿嘿

回复 只看该作者 道具 举报

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

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-11-15 01:44 , Processed in 0.067058 second(s), 25 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569