Oracle VPD and truncate table command

I can still use the truncate table SQL command when you are connected to an Oracle VPD. I wonder how Oracle related where clause for a truncate table command.

Thanks in advance,
Alexandre Bailly

You can truncate the table or you may not.
It is not possible to truncate only part of the picture.

VPD political work by adding the predicate for the policy of the DML.
You cannot add a predicate to truncate - DDL.

And I do not expect truncated to the error just because EVP is enabled.
Your results are so as I expect--political VPD are applied, if necessary, but if you have privilege to truncate the table, truncated happen.
(Same as DROP TABLE - he would just let it go in the table)

If you want to delete lines in a VPD piolicy, then use the command DELETE policy that includes this type of statement.

Published by: dombrooks on October 7, 2009 15:45

Tags: Database

Similar Questions

  • Interruption of TRUNCATE TABLE command

    Hello

    I made very dangerous mistake today: TRUNCATE TABLE on the production database. :-(

    But in a few seconds (2 or 3), I managed to break the operation (before the end of the run).
    It was quite a large table, now (after the accident), there is more records then 32 million.

    We need to know, are all deleted records?

    We have no proper backup, to compare the records with her.
    And I couldn't find any detailed description of the works to TRUNCATE.

    Can you please:
    1. say, on any method to check if there are deleted records?
    2. relationship to any resource, where I can read in detail, on the operation of TRUNCATE TABLE .

    Thank you, in advance, to help

    I know that the table TRUNCATE TABLE statement is atomic. It fails or succeeds. Don't truncate all the lines or none at all. So if you interrupt a statement TRUNCATE TABLE your table must remain in its original state.

    This can be illustrated below:

    SQL > CREATE TABLE TEST AS SELECT * FROM ALL_OBJECTS;
    
    Table created.
    
    SQL > INSERT INTO TEST SELECT * FROM TEST;
    
    12421 rows created.
    
    SQL > INSERT INTO TEST SELECT * FROM TEST;
    
    24842 rows created.
    
    SQL > INSERT INTO TEST SELECT * FROM TEST;
    
    49684 rows created.
    
    SQL > INSERT INTO TEST SELECT * FROM TEST;
    
    99368 rows created.
    
    SQL > INSERT INTO TEST SELECT * FROM TEST;
    
    198736 rows created.
    
    SQL > INSERT INTO TEST SELECT * FROM TEST;
    
    397472 rows created.
    
    SQL > INSERT INTO TEST SELECT * FROM TEST;
    
    794944 rows created.
    
    SQL > INSERT INTO TEST SELECT * FROM TEST;
    
    1589888 rows created.
    
    SQL > SELECT COUNT(*) FROM TEST;
    
      COUNT(*)
    ----------
       3179776
    
    SQL > TRUNCATE TABLE TEST;
    ^C
    H:\>sqlplus /@testdb
    
    SQL*Plus: Release 10.2.0.4.0 - Production on Mon Aug 3 08:20:11 2009
    
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    
    Enter password:
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL > SELECT COUNT(*) FROM TEST;
    
      COUNT(*)
    ----------
       3179776
    

    HTH!

  • Oracle VPD and multiple users

    Hi all

    I'm currently implementing VPD on our database, but I found a problem that I don't understand.

    We have 4 users on the same database

    -sysadmin_vpd (admin vpd packages)

    -owner_usr (owner of the schema)

    -org_1 and org_2 (access owner_usr tables using synonyms)

    All tables have been created on the owner_usr schema has the same column (nrorg) I want to use to filter the data automatically with the user who is logged on the database (org_1 or org_2)

    That's what I did:

    sysadmin_vpd/password login

    CONTEXT to CREATE or REPLACE nrorg_ctx USING nrorg_ctx_pkg;

    CREATE OR REPLACE PACKAGE nrorg_ctx_pkg

    PROCEDURE set_nrorg (number NRORG);

    END;

    CREATE OR REPLACE PACKAGE BODY nrorg_ctx_pkg

    PROCEDURE set_nrorg (number NRORG)

    AS

    BEGIN

    DBMS_SESSION. SET_CONTEXT ('nrorg_ctx', 'nrorg', NRORG);

    END set_nrorg;

    END;

    CREATE OR REPLACE TRIGGER set_nrorg_trg

    AFTER LOGON ON DATABASE

    BEGIN

    IF SUBSTR(USER,1,4) = "ORG_" THEN

    sysadmin_vpd.nrorg_ctx_pkg.set_nrorg (TO_NUMBER (substr (User, 5, 10)));

    END IF;

    END;

    Here, I can test the trigger and the context variable:

    owner_usr/password login

    SELECT SYS_CONTEXT ('nrorg_ctx', 'nrorg') AS NRORG FROM DUAL;

    NRORG

    ------------------------------------------------


    org_1/password login

    SELECT SYS_CONTEXT ('nrorg_ctx', 'nrorg') AS NRORG FROM DUAL;

    NRORG

    ------------------------------------------------

    1


    org_2/password login

    SELECT SYS_CONTEXT ('nrorg_ctx', 'nrorg') AS NRORG FROM DUAL;

    NRORG

    ------------------------------------------------

    2


    Back to the sysadmin_vpd user, I created the function to return the predicate.


    (Get_nrorg_pred) CREATE or REPLACE FUNCTION

    schema_p IN VARCHAR2,

    table_p IN VARCHAR2)

    RETURN VARCHAR2

    AS

    nrorg_pred VARCHAR2 (400) value default NULL;

    BEGIN

    IF SUBSTR(USER,1,4) = "ORG_" THEN

    nrorg_pred: = ' NRORG = ("nrorg_ctx", "nrorg") SYS_CONTEXT';

    END IF;

    RETURN nrorg_pred;

    END;


    owner_usr/password login

    SELECT FROM DUAL PRED sysadmin_vpd.get_nrorg_pred (NULL, NULL);

    PRED

    --------------------------------------------------


    org_1/password login

    SELECT FROM DUAL PRED sysadmin_vpd.get_nrorg_pred (NULL, NULL);

    PRED

    --------------------------------------------------

    NRORG = SYS_CONTEXT ('nrorg_ctx', 'nrorg')

    org_2/password login

    SELECT FROM DUAL PRED sysadmin_vpd.get_nrorg_pred (NULL, NULL);

    PRED

    --------------------------------------------------

    NRORG = SYS_CONTEXT ('nrorg_ctx', 'nrorg')

    If I connect to the database using owner_usr the function returns an empty predicate. Connect using org_1 or org_2 returns the predicate to filter select it as expected.


    Back to the sysadmin_vpd user, I created the policy


    BEGIN

    DBMS_RLS. () ADD_POLICY

    object_schema = > 'OWNER_USR ',.

    object_name = > "TABLE1."

    POLICY_NAME = > "NRORG_POLICY"

    function_schema = > 'SYSADMIN_VPD ',.

    policy_function = > 'GET_NRORG_PRED ',.

    statement_types = > ' select, insert, update, delete.

    policy_type = > DBMS_RLS. SHARED_CONTEXT_SENSITIVE);

    END;


    owner_usr/password login

    SELECT DISTINCT FROM TABLE1 NRORG;

    NRORG

    -----------------

    1

    2


    connect org_1 and password

    SELECT DISTINCT NRORG FROM owner_usr. TABLE1;

    NRORG

    -----------------

    1

    2


    connect org_2 and password

    SELECT DISTINCT NRORG FROM owner_usr. TABLE1;

    NRORG

    -----------------

    1

    2


    As you can see, if I connect to the database using the owner of that selection is not filtered like I wanted. But if I connect using org_1 or org_2 all data are displayed... Why?


    I also tried to create synonyms and creating policy for the synonym... No chance!


    connect org_1 and password

    CREATE A SYNONYM FOR OWNER_USR TABLE1. TABLE1;


    SELECT DISTINCT FROM TABLE1 NRORG;

    NRORG

    -----------------

    1

    2


    BEGIN

    DBMS_RLS. () ADD_POLICY

    object_schema = > 'ORG_1 ',.

    object_name = > "TABLE1."

    POLICY_NAME = > "NRORG_POLICY"

    function_schema = > 'SYSADMIN_VPD ',.

    policy_function = > 'GET_NRORG_PRED') ;

    END;


    SELECT DISTINCT FROM TABLE1 NRORG;

    NRORG

    -----------------

    1

    2


    What I am doing wrong? Can someone help me?


    Thank you!

    I just understand... The problem was in the users org_1 and org_2.

    My coleague created users of theses and gave them grants more than it should... I have everything, revoked granted only SELECT and RESOURCES and this is...

    I don't know what was the grant that substitute policy... Anyone know?

    Thanks anyway...

  • I want to know when we issue statement truncate table in oracle.

    I want to know when we issue statement truncate table in oracle. No newspaper will be write in the redo log. But we can recover data using flashback or SNA. I want to know where the actually truncate table statement log is stored in the oracle database. Please explain to me in detail step by step.

    >
    I understand your SNA. But I want to know where the truncate statement stored log. But in the redo log, no entry for truncate.but I want to go which connect there is no market value back...
    >
    If you are still wondering after getting the answer so you don't "understand".

    You have received the reply above. Archive of flashback stores data.

    See the link provided above to CREATE an ARCHIVE of FLASHBACK in the doc of SQL language
    http://docs.Oracle.com/CD/E11882_01/server.112/e26088/statements_5010.htm
    >
    TABLESPACE clause

    Specify the table space where the data archived for this flashback data archive referring to be stored. You can specify that a tablespace with this clause. However, you can then add tablespaces to archive flashback with a statement ALTER FLASHBACK ARCHIVE database.
    >
    The data is moved to storage of archives and restored from there when you query for archive flashback.

  • Using 'STORAGE of REUSE' with the command 'TRUNCATE TABLE '.

    Because ' truncate table... reuse storage "speed up the tronquantes process?

    Sometimes statements truncation takes about 30 minutes and other times just a few minutes.

    What are the backs of uinsg print 'reuse storage?

    The RE-USE of STORAGE clause is used to prevent the allocated storage of back to the pool.
    Consider this scenario for a typical daily load of an intermediate table

    1. Empty the table of yesterday's data - TRUNCATE it
    2. Load the table with today's data - INSERT 
    

    If you load a large number of records it takes time for Oracle to allocate storage for records
    When you use Oracle TRUNCATED must return the storage allocated to the pool.
    Then when you INSERT new records, that oracle has to allocate the space that he could have used, but returned to the pool.

    If you use TRUNCATE... RE-USE of STORAGE Oracle truncates the table but keep the storage and it will reuse the same storage
    When you do the INSERT instead of having to take the time to allocate new storage.

    So, there are two options to speed up ETL processes like that.
    1. use TRUNCATED... RE-USE of STORAGE and a standard INSERT query

    2. use TRUNCATE and INSERT / * + APPEND * / and make the table NOLOGGING to INSERT it. This will make a big
    load. Oracle must allocate space, but the load mass will make them more effective than a standard INSERT.

    -editing to update after reading the reference asktom
    Storage of back to the pool takes time, so REUSE STORAGE of coding may be faster. The real advantage comes with the next load of data, however if you use a standard INSERT (and not in BULK or direct load) because Oracle failed to reallocate storage.

    If RE-USE eliminates the return of storage to the pool, as well as the allocation of the new storage for the next INSERTION.

    Published by: rp0428 on February 20, 2012 11:16

  • Structure of the Table OTL (Oracle time and labor)

    Hello

    Could you let me know the structure of the tables of OTL (Oracle time and labor).
    I've been through manual eTrm, but I'll try to find the joints and the structure of the hierarchy.

    Thank you.

    931832 wrote:
    Hello

    Could you let me know the structure of the tables of OTL (Oracle time and labor).
    I've been through manual eTrm, but I'll try to find the joints and the structure of the hierarchy.

    Thank you.

    Click "diagrams and PDF files" when you access eTRM Web site - http://etrm.oracle.com/pls/et1211d9/etrm_fndnav.ls_object?c_name= *. PDF & c_type = FILE

    Thank you
    Hussein

  • How to find a table in all schemas and truncation

    Hello

    I am creating a procedure to perform the next task.

    (1) lists all create users
    (2) for each user found, look for a table called "lsw_bpd_instance_documents" on the schema of the user
    (3) if the table is found, her truncate.

    For this work, I have the following code, but it's not right :(
    Select it to found the users work well, but I don't know if I used the right method to store the result inside the CURSOR.
    I'm not sure if I use the right way to perform a "foreach" CURSOR content and on my way to build my truncated sentence... Can I just concatenate strings as I do below in the call for the IMMEDIATE DELIVERY?
    DECLARE
      CURSOR all_users IS select lower(username) as username from dba_users where user_id between 87 and 1000;
      check_table INTEGER;
    BEGIN
       FOR selected_user IN all_users LOOP
          select count(*) INTO check_table from dba_tables where owner = UPPER(selected_user.username) and table_name = 'LSW_BPD_INSTANCE_DOCUMENTS';
          --if table exists
          IF ( check_table > 0 )
          THEN
            EXECUTE IMMEDIATE 'truncate ' || selected_user.username || '.LSW_BPD_INSTANCE_DOCUMENTS';
          END IF;
       END LOOP;
    END;
    I appreciate all the help

    Really not sure why you are too complicated. This is all that is needed:

    BEGIN
       FOR r in ( select owner from dba_tables
                  where table_name = 'LSW_BPD_INSTANCE_DOCUMENTS' )
       LOOP
            EXECUTE IMMEDIATE 'truncate table ' || r.owner || '.LSW_BPD_INSTANCE_DOCUMENTS';
       END LOOP;
    END;
    /
    

    Note that I corrected the syntax error in your dynamic SQL statement. TRUNCATE is DDL, so it requires the keyword TABLE.

    Cheers, APC

  • Global Temporary Tables and truncate

    Hi all

    I have SQL script like this. Firstly, it truncates the Temp_emp and then, it will load data from big_table.
    Whenever I run this script from the SQL prompt, the data inserted into the Temp_emp are doubled. What can be the reason. Am I missing something
    concert of temporary Tables and global Truncate?

    *. SQL file starts here *.

    BEGIN
    RUN IMMEDIATELY 'TRUNCATE TABLE Temp_emp;
    END;
    /

    INSERT INTO Temp_Temp
    SELECT col1, col2, col3, col4 col5
    Of
    (SELECT col1, col2, col3, col4 col5 FROM big_table bt
    WHERE bt. ROWID IN (SELECT MAX (ROWID) FROM big_table
    GROUP BY col1, col2)
    ) ;

    /

    *. SQL file ends here *.

    Thanks in advance,
    PAL

    Please remove the "/" after the insert in your sql script. It executes the same statement insert again. Therefore, the data are doubled.

  • Oracle apex and extjs grid table

    Hello

    IM new to extjs and I was wondering if anyone can help me with this.
    I want to create a report in oracle apex and place the output in the extjs grid table
    for example, I want to display the output of select * from object in table grid

    thnx in advance
  • TRUNCATE Table - task failed

    Hi friends,

    Im making a loading SCM using R12.1.3 when running I met an error like below
    2012-08-07 15:24:07.734 TRUNCATE TABLE:OPI_OBIA_W_BOM_HEADER_DS:"Table Action: Override OPI truncate command" template has started.
    ANOMALY INFO::: Error while executing : TRUNCATE TABLE:OPI_OBIA_W_BOM_HEADER_DS:"Table Action: Override OPI truncate command" template
    MESSAGE:::com.siebel.analytics.etl.execution.exceptions.ActionFailedException: Running Custom Sql list TRUNCATE TABLE:OPI_OBIA_W_BOM_HEADER_DS:"Table Action: Override OPI truncate command" template
    Default retries for this custom SQL is 1.
    
    executing sql (Truncate OPI:EBS11i)
    TRUNCATE TABLE OPI.OPI_OBIA_W_BOM_HEADER_DS
    For the foregoing regarding the link below error, they said like to apply a path 10422612

    https://forums.Oracle.com/forums/thread.jspa?threadID=2386306 & tstart = 75_ +.

    But when I tried to download this patch to resolve the above issue, a password is required to download the file in mysupport.

    Is there an alternative link to download this patch file.

    Thank you

    Kind regards
    Saro

    Yes, you need to get the password of Oracle by SR.

    Given that you do not use these tables, you can make it inactive task force TASK_GROUP_Extract_BOM. Of course respective tasks of SDE and SIL are also inactive.
    Once you with changes assemble the business sector and build of EP.

    Hope this helps

  • truncate table another user via trigger?

    Oracle 10.2.0.4

    A user USER1 should be able to truncate a table of another user, user 2.

    I will not give drop any table, there are a lot of patterns in this PB. It must be transparent, because it happens from an application, so I can't substitute a procedure:

    exec ('table_name') drop_user2_table;

    but USER1 executes: truncate table table_name;


    Is there an any place of relaxation for this command?.

    You thought you found the solution. If so, please indicate the post as answer and correct.

  • Oracle 11g and partitions on a star model

    Hello

    I am Manager of the Business Intelligence service in a society. We use SAP BI4.1 SP3 and an Oracle 11 g server.

    We have big questions about our various requests.

    One of them is the use of "partition" and how they are used.

    Here's the situation. I have a big fact with data on the inventory table. This table is partitioned with partition 1 per day, using the foreign key 'DATE_KEY"(digital YYYYMMDD)

    I have a CIVIL dimension, whose primary key is also DATE_KEY (numeric YYYYMMDD). Other columns of attribute are like DAY (in a date format), YEAR, WEEK and so on. Very classic.

    Now, I want to execute the following queries:

    (1) to recover the 1 day stock, using the date format of my calendar dimension attribute

    Select sum (stock_quantity)

    of s FACT_STOCK

    inner join DIM_CALENDAR d

    On s.DATE_KEY = d.DATE_KEY

    where d.DAY = to_date('16/02/2016','DD/MM/YYYY')

    (2) get 1 day stock, using the primary key of my calendar dimension

    Select sum (stock_quantity)

    of s FACT_STOCK

    inner join DIM_CALENDAR d

    On s.DATE_KEY = d.DATE_KEY

    where d.DATE_KEY = 20160216

    (3) to recover the stock of 1 week, using the week of my calendar dimension attribute

    Select sum (stock_quantity)

    of s FACT_STOCK

    inner join DIM_CALENDAR d

    On s.DATE_KEY = d.DATE_KEY

    where d.WEEK = 201607

    Results of the explain plan command:

    1)

    expected: it's supposed to used 1 partition because the partition key is in the join

    true: it does not use the partition. All the table partitions are analyzed.

    2)

    expected: it is supposed to used 1 partitionas the partition key is in the filter where

    true: it uses a 1 partition.

    3)

    expected: it is supposed to use 7 partitionas the partition key is in the join

    Real: it does not use the partition. All the table partitions are scanned.

    The behavior is normal? I think that this isn't, but I'm not DBA.

    "If it's normal, partition are completely unnecessary, since I can't say my professional user: 'Please use the technical dimension instead of the calendar attribute key' or 'Please list the day of your week instead of using the attribute of the week'"

    Is it possible to implement dabase settings in order to use the partition.

    Notice the: BF0000 used for pstart and pstop, also references to the "party join filter.

    It is Oracle, creation and use of a filter of flowering of the first entry (small) to identify the partitions that need to access the second table.

    It is possible for Bloom filters identify data redundant, but to identify the partition, they seem to be very accurate.

    It seems that you should have a unique constraint on d.day for your first query, this would allow Oracle to see she had access only a single partition - and which could replace the filter of flowering with a subquery to pstart/pstop and KEY/KEY filter (possibly KEY (SQ) / KEY (SQ)) instead of: BFnnnn

    Concerning

    Jonathan Lewis

  • Truncate Table generates cancel?

    What I understand, TRUNCATE TABLE resets the high water and after some discussions and information on the web creates a small amount of cancellation. For example, http://www.orafaq.com. However, documentation of Oracle 11 g 2 to truncating Tables and Clusters makes clear that it does not generate just undo.

    Quote: A TRUNCATE statement does not generate the cancellation information and committed immediately. It is a DDL statement and cannot be cancelled.

    TRUNCATE is apparently done a COMMIT before and after he runs, which would explain why there is no ROLLBACK. And if I'm not mistaken, any DML or DDL statement must create an entry in the log again first, before you run.

    Which is correct? Does TRUNCATE really create no CANCELLATION and implicit VALIDATION is perhaps only a protection measure, or what is the real story here? I tried a few tests, playing with the employee_demo table, but I have not been able so far to know what has changed in the UNDO tablespace. Unfortunately, I'm not a great expert on PL/SQL and do not use it much. Is there a way to simply to query or compare the cancellation of table before and after a truncate table operation to see the difference? By comparing the size is not.

    Thank you!

    Summary/Conclusion:

    The answer, in other words, is that TRUNCATE TABLE Undo. This cancellation information cannot be used by the user to RESTORE a TRUNCATE TABLE, which also applies to the other DDL statements, but may be required by the body to perform the database crash recovery.

    Because TRUNCATE TABLE changes the metadata in the data dictionary and resets the high tide of the object, it produces much less that cancel the DML statements as DELETE. However, it would probably not be the Oracle database if everything were that easy.

    If you happen to find this interesting question and wish to know more on it again and cancel the process regarding the DDL statements, some of the responses I received the case very resourceful and provided information you many not know or will not find in the usual documentation.

    I can mark only one answer is right and just caught the first response that provided an answer to my original question. The answers that I've marked as useful are those replies which I think has provided good explanations or added interesting new aspects or information thereon.

    Thank you all for your time and your contributions!

    To check the generation of cancellation (example):

    SQL > select count (*) from t1;

    COUNT (*)

    ----------

    1000000

    1 selected line.

    SQL > select name, value of V$ mystat ms, v$ statname sn where sn.statistic # ms.statistic # and sn.name like '% cancellation' and ms.value =! = 0 ;

    NAME                                                                  VALUE

    ---------------------------------------------------------------- ----------

    cancel changes vector size 192

    1 selected line.

    SQL > truncate table t1;

    Table truncated.

    SQL > select name, value of V$ mystat ms, v$ statname sn where sn.statistic # ms.statistic # and sn.name like '% cancellation' and ms.value =! = 0 ;

    NAME                                                                  VALUE

    ---------------------------------------------------------------- ----------

    cancel the change in size of vector 31272

    1 selected line.

    The cancellation that would have been generated by a deletion would have been of the order of one hundred twenty megabytes - but you'll have to take my word for it.

    This small amount of cancellation would have been associated a few blocks management cleared space, the day and possibly put segment header some updating of the data dictionary (your changes of $ tab_stats).

    To prove that some cancel the blocks of space for the table (and its indexes) management, you would probably have to spend just before truncation, then truncation of log files, then empty the current log file to get a picture of minimum log that you could review to see which blocks had been affected by again them and the bits from the redo had correspondent (or on the contrary (, reversing) entries created in cancel it. You would then be able to see exactly what had happened to the table (and index) blocks and how this action had been protected by the cancellation.

    Bottom line - people often say that "truncate" generates no cancellation, what they really mean is that it generates no cancellation for data, although it always generates a relatively small amount of cancellation for the meta-data.

    Concerning

    Jonathan Lewis

    P.S. before everybody does point out that there are always special cases - truncation of a table in a cluster is implemented as a deletion.

  • The truncated table rows

    Hi team,

    One of my colleague ran a batch which will truncate a table and insert the final table by extracting data from different tables in backup taking the old table.

    But today before 10 minutes he missed to keep the export backup of this table and ran the batch. All the old data of the truncated table and now we need these data.

    Flashback is DISABLED in our case and Undo retention is dry 7200 and since it is a DDL so it will change the definition of the table.

    Is it possible to get the data that truncated.

    Daily HT full backup will run and we are in the process of restoring the backup but the db size is 4 TB and it will take time and then let's apply archive logs, before that got truncated.

    Until can we try something else?

    Hemant seems good to me.

    Please check the Version of Oracle where you are restoring the database and the Oracle version of the primary database that saves youi have taken.

    I'm 100% sure that there could be the difference in the release.

    We faced this problem 2 times and every time the issue is different binary or different architecture was the problem.

  • Truncate table removes the corresponding LOB segment of the table or not?

    Hi all

    I have little table with BUSINESS segments, if I pull the table truncated on the table it will purge the LOB segment as well?

    About how long will take to truncate 100 GB LOB segments.

    Thank you

    903787 wrote:
    Hello

    1 Truncate will delete the LOB segment or not?

    It will not erase the LOB segments, but it must release the majority of the allocated space.

    >

    2. If you want to recover the space, we need to run the command, below is correct?

    ALTER TABLE CHANGE LOB (LOB_COLUMN) (SHRINK SPACE);

    Should not be necessary to 11.2:

    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    
    SQL> select count(*) from user_segments;
    
      COUNT(*)
    ----------
             0
    
    SQL>
    SQL> create table t(x clob);
    
    Table created.
    
    SQL> select segment_name, segment_type, bytes
      2  from user_segments;
    
    SEGMENT_NAME                             SEGMENT_TYPE            BYTES
    ---------------------------------------- ------------------ ----------
    T                                        TABLE                   65536
    SYS_IL0000030908C00001$$                 LOBINDEX                65536
    SYS_LOB0000030908C00001$$                LOBSEGMENT              65536
    
    SQL>
    SQL> insert into t select lpad(segment_name,8192) from dba_segments;
    
    6312 rows created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL>
    SQL> select segment_name, segment_type, bytes
      2  from user_segments;
    
    SEGMENT_NAME                             SEGMENT_TYPE            BYTES
    ---------------------------------------- ------------------ ----------
    T                                        TABLE                  393216
    SYS_IL0000030908C00001$$                 LOBINDEX                65536
    SYS_LOB0000030908C00001$$                LOBSEGMENT           53477376
    
    SQL>
    SQL> truncate table t;
    
    Table truncated.
    
    SQL>
    SQL> select segment_name, segment_type, bytes
      2  from user_segments;
    
    SEGMENT_NAME                             SEGMENT_TYPE            BYTES
    ---------------------------------------- ------------------ ----------
    T                                        TABLE                   65536
    SYS_IL0000030908C00001$$                 LOBINDEX                65536
    SYS_LOB0000030908C00001$$                LOBSEGMENT              65536
    
    SQL>
    SQL> alter table t modify lob(x) (shrink space);
    
    Table altered.
    
    SQL>
    SQL> select segment_name, segment_type, bytes
      2  from user_segments;
    
    SEGMENT_NAME                             SEGMENT_TYPE            BYTES
    ---------------------------------------- ------------------ ----------
    T                                        TABLE                   65536
    SYS_IL0000030908C00001$$                 LOBINDEX                65536
    SYS_LOB0000030908C00001$$                LOBSEGMENT              65536
    
    SQL>
    

Maybe you are looking for