lob欄位的ora-1555處理方案
從系統中匯出兩個含有lob欄位的表,連續兩次都因ora-1555錯誤而終止
[oracle@db-8 ~]$ expdp justin/***** tables=temp_justin, justin_description parallel=8 directory=pump dumpfile=new_lobs_20111008_%U.dmp
Export: Release 10.2.0.5.0 - 64bit justinion on Saturday, 08 October, 2011 17:05:38
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit justinion
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "justin"."SYS_EXPORT_TABLE_02": justin/******** tables=temp_justin, justin_description parallel=8 directory=pump dumpfile=new_lobs_20111008_%U.dmp
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
ORA-31693: Table data object "justin"."TEMP_justin" failed to load/unload and is being skipped due to error:
ORA-02354: error in exporting/importing data
ORA-01555: snapshot too old: rollback segment number with name "" too small
ORA-22924: snapshot too old
. . exported "justin"."justin_DESCRIPTION" 6.961 GB 628170 rows
Master table "justin"."SYS_EXPORT_TABLE_02" successfully loaded/unloaded
******************************************************************************
Dump file set for justin.SYS_EXPORT_TABLE_02 is:
/data/oracle/pump/new_lobs_20111008_01.dmp
/data/oracle/pump/new_lobs_20111008_02.dmp
/data/oracle/pump/new_lobs_20111008_03.dmp
/data/oracle/pump/new_lobs_20111008_04.dmp
Job "justin"."SYS_EXPORT_TABLE_02" completed with 1 error(s) at 19:13:55
從ORA-22924可以看出是lob欄位的問題
而目前的retention只有900秒,且pctversion為null
SQL> select column_name, pctversion, retention from user_lobs where table_name = 'JUSTIN';
COLUMN_NAME PCTVERSION RETENTION
------------------------------ ---------- ----------
DESCRIPTION 900
SKILL 900
另外,可以用sysdba賬戶查詢這兩個lob欄位是使用pctversion還是retention
SQL> select decode(bitand(flags, 32), 32, 'Retention', 'Pctversion') ||
2 ' policy used'
3 from lob$
4 where lobj# in (select object_id
5 from dba_objects
6 where object_name in
7 (select segment_name
8 from dba_lobs
9 where table_name in ('TEMP_JUSTIN') and wner ='JUSTIN'));
DECODE(BITAND(FLAGS,32
----------------------
Retention policy used
Retention policy used
目前解決辦法有兩個,加大retention或者使用pctversion
1、加大retention
lob欄位使用的retention與系統中的undo_retention值是一樣的,需要先調整undo_retention
SQL> alter system set undo_retention=18000;
System altered.
SQL> alter table JUSTIN modify lob(SKILL)(retention);
Table altered.
SQL> select column_name, pctversion, retention from user_lobs where table_name = 'JUSTIN';
COLUMN_NAME PCTVERSION RETENTION
------------------------------ ---------- ----------
DESCRIPTION 900
SKILL 18000
SQL> alter table JUSTIN modify lob(DESCRIPTION)(retention);
Table altered.
SQL> select column_name, pctversion, retention from user_lobs where table_name = 'JUSTIN';
COLUMN_NAME PCTVERSION RETENTION
------------------------------ ---------- ----------
DESCRIPTION 18000
SKILL 18000
2、使用pctversion
從結果中可以看到,當顯示指定pctversion的時候,retention引數會失效
SQL> alter table JUSTIN modify lob(DESCRIPTION) (pctversion 10);
Table altered.
SQL> select column_name, pctversion, retention from user_lobs where table_name = 'JUSTIN';
COLUMN_NAME PCTVERSION RETENTION
------------------------------ ---------- ----------
DESCRIPTION 10
SKILL 18000
此時再執行指令碼,已經多出一條Pctversion policy used
SQL> select decode(bitand(flags, 32), 32, 'Retention', 'Pctversion') ||
2 ' policy used'
3 from lob$
4 where lobj# in (select object_id
5 from dba_objects
6 where object_name in
7 (select segment_name
8 from dba_lobs
9 where table_name in ('JUSTIN') and wner ='JUSTIN'));
DECODE(BITAND(FLAGS,32
----------------------
Retention policy used
Pctversion policy used
另外,對於使用MSSM表空間表,只有pctverion可用,lob retention不可用
ORA-1555 - UNDO_RETENTION is silently ignored if the LOB resides in a MSSM tablespace [ID 800386.1]
Applies to:
Oracle Server - Enterprise Edition - Version: 9.0.1.0 to 11.2.0.0
This problem can occur on any platform.
Symptoms
- ORA-1555/ORA-22924 may occur when accessing LOB columns, even when the LOB RETENTION seems to be sufficient.
This may occur when LOB column resides in a MSSM (Manual Segment Space Management) tablespace.
-- Verify Segment Management
select tablespace_name, extent_management, segment_space_management
from dba_tablespaces
where tablespace_name in
(select tablespace_name from dba_segments
where wner='TEST' and segment_name='TAB1');
TABLESPACE_NAME EXTENT_MAN SEGMEN
------------------------------ ---------- ------
TESTCASE LOCAL MANUAL <==
-
To check whether tablespace is using Manual verify whether PCTVERSION or RETENTION is used, execute:
-- Verify LOB retention parameter
select column_name, pctversion, retention
from dba_lobs
where wner = 'TEST' and table_name ='TAB1';
COLUMN_NAME PCTVERSION RETENTION
------------- ---------- ----------
DATA 86400 <==
Changes
LOB column is stored on MSSM tablespace.
Cause
The LOB RETENTION parameter has *no* effect if the LOB resides in a tablespace using MANUAL space management (MSSM). In order for LOB RETENTION to honour the UNDO_RETENTION period Automatic Segment Space Managemetn (ASSM) should be used.
The RETENTION parameter is silently ignored if the LOB resides in an MSSM tablespace.
This is currently not documented in any RDBMS documentation of releases 9.x / 10.x / 11.1
Oracle® Database SecureFiles and Large Objects Developer's Guide
11g Release 2 (11.2)
ASSM is required for LOB RETENTION to be in effect for BASICFILE LOBs. The RETENTION parameter of the SQL (in the STORE AS clause) is silently ignored if the BASICFILE LOB resides in an MSSM tablespace.
Solution
- If you want to use LOB retention for LOB columns to avoid ORA-1555, you must use ASSM (Automatic Segment Space Management) tablespace.
The segment space management mode, which was specified at tablespace creation time, applies to all segments which will be created in the tablespace.
You cannot change the segment space management mode of a tablespace. If your LOB column is store on MSSM tablespace and you would like to use the ASSM option, you'd have to create a new tablespace using 'segment space management auto' followed by moving the objects to the new tablespace which was created to use Automatic Segment Space Management.
create tablespace assm_ts datafile
...
autoextend on
extent management local
segment space management auto; <==
alter tablemove tablespace ;
- If you can't move to ASSM and you need to store your LOB data on MSSM tablespace, you'd have to use PCTVERSION instead of RETENTION.
-- Example: Setting PCTVERSION to 20 percent
SQL> alter tablemodify lob( ) (pctversion 20);
PCTVERSION is the percent of used LOB data blocks that is available
for versioning old LOB data.
Segment Space Management | use |
---|---|
AUTO | RETENTION or PCTVERSION |
MANUAL | PCTVERSION |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15480802/viewspace-708843/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 一次PLSQL處理LOB欄位的優化SQL優化
- 可以處理LOB欄位的常用字元函式字元函式
- oracle中lob欄位Oracle
- LOB欄位EMPTY_LOB和NULL的區別Null
- 【LOB】使用資料泵時 LOB 欄位存放位置
- ORACLE LOB大欄位維護Oracle
- 帶有LOB欄位的表遷移
- JDBC處理包含CLOB欄位JDBC
- BLOB及CLOB欄位處理
- LOB欄位資料清理 - 更新為null後move lobNull
- Oracle 帶LOB欄位的表的遷移Oracle
- lob欄位表空間遷移
- 釋放大資料量的lob欄位空間大資料
- PL/SQL 插入clob欄位處理SQL
- Oracle 建表時LOB欄位語法Oracle
- sql 統計多個欄位的和(如果欄位中含有 null 的處理)SQLNull
- 資料處理之欄位合併
- 小議lob欄位結構和儲存
- MySQL和Oracle的新增欄位的處理差別MySqlOracle
- 《轉》ORACLE LOB 大物件處理Oracle物件
- Oracle LOB資料型別的處理Oracle資料型別
- Oracle中Blob欄位的寫入處理(一) (轉)Oracle
- Oracle lob載入bfile資料到blob欄位中Oracle
- 如何處理sql server中的image型別的欄位?SQLServer型別
- 如果新增欄位是外來鍵,如何處理?
- springboot~mybatis統一處理公有欄位Spring BootMyBatis
- innodb引擎對自增欄位(auto_increment)的處理REM
- 欄位處理rtrim去掉結尾的特殊字元和空格字元
- 多型關聯自定義的型別欄位的處理多型型別
- DatabaseLink不支援merge和lob欄位查詢Database
- lob欄位型別轉換ora-22858型別
- exp,imp 不同表空間大欄位處理方法
- [重慶思莊每日技術分享]-重建LOB欄位上的IndexIndex
- MybatisPlus經典示例:使用Wrapper查詢指定欄位並新增欄位函式處理MyBatisAPP函式
- 實戰SpringCloud通用請求欄位攔截處理SpringGCCloud
- Oracle10g Logminer處理BLOB欄位錯誤Oracle
- php讀取xml資料庫欄位超長處理PHPXML資料庫
- 使用 Eloquent ORM 使用 with 模型關聯查詢,如何處理select不同模型的欄位(欄位名可能相同)ORM模型