Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Sachin.

Asked: August 22, 2017 - 1:23 pm UTC

Last updated: August 24, 2017 - 10:29 am UTC

Version: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit

Viewed 1000+ times

You Asked

Hello Tom,

I am trying below code to reset table pctversion to 0 from default 10. but on Oracle 12c 12.1.0.2 it won't work, but the same command works on Oracle 12c 12.2.0.1 and also works on 11gR2.

alter table ev_log modify lob (event_data)  (pctversion 0); 

SQL> select column_name, nvl(retention, 0) retention, nvl(pctversion,0) pctversion from dba_lobs where table_name = 'EV_LOG';

COLUMN_NAME   RETENTION PCTVERSION
-----------------------------------------
EVENT_DATA         0         10


SQL> alter table ev_log modify lob (event_data)  (pctversion 0);

Table altered.

SQL> select column_name, nvl(retention, 0) retention, nvl(pctversion,0) pctversion from dba_lobs where table_name = 'EV_LOG';

COLUMN_NAME   RETENTION PCTVERSION
--------------------------------------
EVENT_DATA      0         10



the only change I could see on parameters configuration is
 
-- 12.1.0.2.0
compatible                           string      12.1.0.2.0

-- 12.2.0.1.0
compatible                           string      11.2.0.0.0




Not sure if it is an bug with Oracle 12cR1 or I am missing anything and is there a way to reset pctversion to 0 as it is occupying daily 1-2gb of disk space.

Regards,
Sachin

and Chris said...

You're going to have to give us more to work with. All seems hunky-dory on 12.1.0.2 to me:

select * from v$version;

BANNER                                                                        CON_ID  
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production  0       
PL/SQL Release 12.1.0.2.0 - Production                                        0       
CORE 12.1.0.2.0 Production                                                    0       
TNS for Linux: Version 12.1.0.2.0 - Production                                0       
NLSRTL Version 12.1.0.2.0 - Production                                        0

create table t (
  x clob
);

alter table t modify lob (x) (pctversion 0); 

select column_name, nvl(retention, 0) retention, nvl(pctversion,0) pctversion 
from   dba_lobs where table_name = 'T';

COLUMN_NAME  RETENTION  PCTVERSION  
X            0          0 


What exactly is the DDL for your table that is causing this issue?

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thanks Chris for taking this on

Sachin, August 23, 2017 - 5:39 am UTC

we are facing an tablespace size growth issue due to BLOB and we resolve it with below question https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9534388300346583586#9534627800346886091 thanks to Connor

As per the solution I am seeting PCTVERSION to 0 on Oracle 12cR1 but it fail.

Below is the SQL Code

CREATE SMALLFILE TABLESPACE lobs
DATAFILE '/u02/oradata/dwh/lobs_1.dbf' SIZE 100M AUTOEXTEND OFF ,
         '/u02/oradata/dwh/lobs_2.dbf' SIZE 100M AUTOEXTEND OFF   
LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 16K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;

create table ev_log
      (    id float(63),
            event_time timestamp (6) constraint sys_c0014416 not null enable,
            event_data blob
       )
         lob (event_data) store as ev_log_lob( tablespace lobs disable storage in row )
       partition by range (event_time)
       interval(numtoyminterval(1, 'month'))
       store in (users)
     (
      partition pos_data_p1 values less than (to_date('01-01-2017', 'dd-mm-yyyy')),
      partition pos_data_p2 values less than (to_date('01-02-2017', 'dd-mm-yyyy')),
      partition pos_data_p3 values less than (to_date('01-03-2017', 'dd-mm-yyyy'))
     );

-- Data population code reapet 3-4 times

insert into ev_log
    select
      rownum,
      date '2017-02-28'-rownum/10,
      rpad('AB',4000,'AB')
    from dual
    connect by level <= 1000;
commit;

-- check tablespace size
select segment_name, segment_type, bytes from dba_segments where tablespace_name = 'LOBS';

-- Update BLOB to Empty
update ev_log set event_data = empty_blob();
commit;



I ran above data population code couple time to make sure tablespace size keep growing despite setting BLOB to empty.

we have a solution as below which was working find on 11gR2 and 12cR2 but fail on 12cR1

select column_name, nvl(retention, 0) retention, nvl(pctversion,0) pctversion from dba_lobs where table_name = 'EV_LOG';

alter table ev_log modify lob (event_data)  (pctversion 0); 

select column_name, nvl(retention, 0) retention, nvl(pctversion,0) pctversion from dba_lobs where table_name = 'EV_LOG';

Chris Saxon
August 24, 2017 - 10:27 am UTC

I think you're going to have to take this up with support. The selects at the end give me:

COLUMN_NAME  RETENTION  PCTVERSION  
EVENT_DATA   0          10          

Table EV_LOG altered.

COLUMN_NAME  RETENTION  PCTVERSION  
EVENT_DATA   0          0  


Though I don't have a DB handy supporting 16k blocksizes, so the results there are for 8k blocksize.

I am getting weired results, please check below

Sachin, August 24, 2017 - 5:01 am UTC

Hello,

I have executed sample code it gives me weired results, not sure why and how.

-- CLOB
SQL> create table t ( x clob) ;

Table created.

SQL> select column_name, nvl(retention, 0) retention, nvl(pctversion,0) pctversion from   dba_lobs where table_name = 'T';

COLUMN_NAME           RETENTION PCTVERSION
-------------------- ---------- ----------
X                             0          0

SQL> alter table t modify lob (x) (pctversion 0);

Table altered.

SQL> select column_name, nvl(retention, 0) retention, nvl(pctversion,0) pctversion from   dba_lobs where table_name = 'T';

COLUMN_NAME           RETENTION PCTVERSION
-------------------- ---------- ----------
X                             0         10


-- BLOB

SQL> drop table t;

Table dropped.

SQL> create table t (  x blob);

Table created.

SQL> select column_name, nvl(retention, 0) retention, nvl(pctversion,0) pctversion from   dba_lobs where table_name = 'T';

COLUMN_NAME           RETENTION PCTVERSION
-------------------- ---------- ----------
X                             0          0

SQL> alter table t modify lob (x) (pctversion 0);

Table altered.

SQL>  select column_name, nvl(retention, 0) retention, nvl(pctversion,0) pctversion from   dba_lobs where table_name = 'T';

COLUMN_NAME           RETENTION PCTVERSION
-------------------- ---------- ----------
X                             0         10

Chris Saxon
August 24, 2017 - 10:29 am UTC

This still only on 12.1?

I still can't reproduce. Speak with support.

More to Explore

Design

New to good database design? Check out Chris Saxon's full fundamentals class.