472,355 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,355 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 4657
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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

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.