473,386 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Regarding tablespace issues

Hi ,
I am deleting the large amount of data in table using the delete statements .After that I have checked tablespace, there is no change in tablespace memory. But when using truncate statements,I do see change in tablespaces.
My steps are below
1)CREATE TABLE CSA_BANK_RESPONSE
(
BANK_KEY NUMBER(9) NOT NULL,
BANK_ID VARCHAR2(30 BYTE) NOT NULL,
BANK_PSH_SUFFIX VARCHAR2(3 BYTE) NOT NULL,
RESPONSE_XML_BANK CLOB
)
TABLESPACE CSA_BANK_RESPONSE_TBS;


ALTER TABLE CSA_BANK_RESPONSE ADD (
CONSTRAINT CSA_BANK_RESPONSE
PRIMARY KEY
(BANK_KEY)
USING INDEX
TABLESPACE CSA_BANK_RESPONSE_NDX);

2) inserted large amount of data.

3) select sum(bytes)/1024/1024
from user_segments
where tablespace_name= CSA_BANK_RESPONSE_NDX;

The size is 345.654 MB.

4) deleted data what we inserted.

Delete from CSA_BANK_RESPONSE;
Commit;

After that I am checking tablespace,it shows a like

select sum(bytes)/1024/1024
from user_segments
where tablespace_name= CSA_BANK_RESPONSE ';

The size is 345.654 MB.
5) once again,I am inserting large amount of data into ' CSA_BANK_RESPONSE '.
Now size is

select sum(bytes)/1024/1024
from user_segments
where tablespace_name=' CSA_BANK_RESPONSE’;

the size is 645.456MB.

What I expect is, similar to truncate statements if delete statements are used then there should be a decrease in tablespace.

How can we resolve this issue?
Jun 16 '08 #1
2 4722
debasisdas
8,127 Expert 4TB
What I expect is, similar to truncate statements if delete statements are used then there should be a decrease in tablespace.

How can we resolve this issue?
what you expect is against structure of oracle.

That is not an issue at all.
Jun 17 '08 #2
Dave44
153 100+
One solution is to have the table in a bigfile tablespace. this way you can enable row movement on the table and perform a shrink space against it as follows
Expand|Select|Wrap|Line Numbers
  1. [115]ers_core@DEV01> create table t (col1 int, col2 int);
  2.  
  3. Table created.
  4.  
  5. Elapsed: 00:00:00.07
  6. > select bytes,blocks from user_segments where segment_name = 'T';
  7.  
  8.      BYTES     BLOCKS
  9. ---------- ----------
  10.      65536          8
  11.  
  12. Elapsed: 00:00:00.09
  13. > insert into t select level,level*3 from dual connect by level <= 3000;
  14.  
  15. 3000 rows created.
  16.  
  17. Elapsed: 00:00:00.06
  18. > select bytes,blocks from user_segments where segment_name = 'T';
  19.  
  20.      BYTES     BLOCKS
  21. ---------- ----------
  22.     131072         16
  23.  
  24. Elapsed: 00:00:00.07
  25. > delete from t;
  26.  
  27. 3000 rows deleted.
  28.  
  29. Elapsed: 00:00:00.11
  30. > select bytes,blocks from user_segments where segment_name = 'T';
  31.  
  32.      BYTES     BLOCKS
  33. ---------- ----------
  34.     131072         16
  35.  
  36. Elapsed: 00:00:00.09
  37. > alter table t enable row movement;
  38.  
  39. Table altered.
  40.  
  41. Elapsed: 00:00:00.17
  42. > alter table t shrink space;
  43.  
  44. Table altered.
  45.  
  46. Elapsed: 00:00:00.15
  47. > select bytes,blocks from user_segments where segment_name = 'T';
  48.  
  49.      BYTES     BLOCKS
  50. ---------- ----------
  51.      65536          8
  52.  
  53. Elapsed: 00:00:00.09
  54.  
Jun 19 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Joachim Klassen | last post by:
Hi all, I'm currently investigating the use of MDC Tables for large data warehouse tables. My scenario: A fact table with 1000 Million Rows distributed on 12 Partitions (3 physical hosts...
4
by: Joachim Klassen | last post by:
DB2 V8.2 FP10 on Windows I tested the following HADR scenario: - a new tablespace on a new filesytem is created on the primary System - the replay on standby fails because of lacking permissions...
2
by: Raghava | last post by:
hi all, i was working on DB2 and came across an issue. i.e. can a tablespace be rollforwarded to POINT-IN-TIME? the scenario is as follows: i created a data base and a tablespace in it. i have...
0
by: sat | last post by:
Hi All, I have a question here regarding the partitioning feature. Now i have a dbpartition group and in that i have one node.The database is spread across 3 nodes.And i have a tablespace inside...
0
by: wugon.net | last post by:
Env: DB2 LUW V8 + FP14 AIX 5.3 Problem Description: Our production database create one big temporary tablespace to do off- line reorg, after reorg complete, we drop this tablespace online...
1
by: NewbieDB2DBA | last post by:
I'm running DB2 UDB v8.2 on Windows 2003 SP2. How do I get a tablespace out of Roll Forward in Progress state?! I've tried everything I can think of, but I'm extremely new to DB2 (more...
1
by: Ravi Padmakar | last post by:
Hello, In the process of making my database work (I started with not being able to insert records because of tablespace issues) , I dropped the tablespace for it. Now I am not able to access the...
3
by: BD | last post by:
Hi, folks. Sorry about this - I have been R'ing all TFM's I can find, but am just getting more frustrated. Background: db2 UDB 8.1 on Windows. I'm quite new to db2, but have several...
3
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.