Free table space
Hi,
is there a way to free blocks of deleted record?
I mean: I have a table of 50Gb and I delete 5Gb; those 5Gb are still part of the table size looking at the dba_segment view.
And is there a way to completely free those blocks without export and import the table?
My enviroment is:
Oracle Database 11g Release 11.1.0.6.0 - 64bit Production With the Real Application Clusters option, on Redhat.
Thanks in advance,
Samuel
Hello,
When we move the table within the same tablespace, do we need more space in that tablespace or in the temp tablespace? If you move the Table within the same Tablespace it will use space in that Tablespace during the MOVE (during this step the Tablespace may extend ). Afterwards, the new Segment will use less space as the data will be reorganized. So finally space will be released to the Tablespace.
The TEMP Tablespace will be used when you REBUILD the Indexes (sort operations are done).
When we move table within the same tablespace, it tries to eliminate the fragmentation and move the table to the biggest free space chunk available and frees >the space from the end of the data file, so that we could shrink the data file by doing alter databases data file command. Is that true? With LMT the Extents size are among 64K, 1M, 8M and 64M, it depends on the size of the Table. So the first Extents (64K) may be located in any free spaces of 64K (or more) inside the Tablespace. Also, for larger Extents (1M, ...) enough contiguous free space must be found. If this contiguous free space is not available, the Tablespace will need to extend one of its Datafiles.
So, except if you have a lot of free (and contiguous) spaces inside your Tablespace, you'll likely have Extents at the end of the Datafile and you couldn't reduce its size later.
This is the reason why the safest way to reorganized a Table without extending the Datafiles of its Tablespace is to create a new Tablespace. Then you move the Table inside it and move back to its original Tablespace.
As the Table is likely to become smaller, the original Tablespace could house it without needing any extension.
But, except if this Table had originally Extents at the end of the Datafiles (which is free up by the operation), you couldn't resize your Datafiles.
In general a Table is not alone in the Tablespace. If you want to resize the Datafiles you need to move all the Segments inside the Tablespace to a new one. Then, for instance, you may DROP the old and empty Tablespace and RENAME the new Tablespace so as to give it the same name as the old one.
Depending on the size of the Tablespace it may become a heavy operation and, with LMT (and its internal Extent / Space management) it's not really useful, except if you want to reduce the total size of your database.
Hope this help.
Best regards,
Jean-Valentin
Edited by: Lubiez Jean-Valentin on Apr 10, 2010 5:16 PM
Similar Messages
-
Table space not getting cleaned after using free method (permanent delete)
Hi ,
We are using the free method of the LIB OBJ, to permanently delete the objects. As per documentation, the ContentGarbageCollectionAgent will be cleaning the database which runs in a scheduled mode. But the log of that ContentGargabageCollectionAsgent shows, all zero for objects without reference, objects cleared,etc. I.e the table space remains the same before and after deleteing all the contents in the cmsdk database. But the agent is running as per the schedule but just comes out doing nothing.
Can anbody put some light on this issue.
thanks
Raj.Hi Matt,
Thanks for replying. It's been a very long time waiting for you ;)
---"Are you running the 9.2.0.1, 9.2.0.2, or 9.2.0.3 version of the Database?"
we are using 9.2.0.1
---"If you installed the CM SDK schema in the "users" tablespace ......."
Yes we are using USERS tablespace for our Development.
I ran the query. The result is:
SYSTEM MANUAL NOT AFFECTED
USERS MANUAL NOT AFFECTED
CTXSYS_DATA MANUAL NOT AFFECTED
CMSDK1_DATA MANUAL NOT AFFECTED
(USERS belongs to develpoment cmsdk schema. And CMSDK1 for Prod CMSDK schema)
From the results I see only "Manual", but still I don't see the tablespace size being coming down. Both table space sizes (USER and CMSDK1) always grows higher and higher.
Also to let you know, We use ORACLE EM Console (Standalone) application to see the oracle databse information online. Will there be any thing to do with the tool we use to see the table space sizes. We make sure we always refresh it before making a note.
So is there anything else I can see. Once I saw the ContentGarbageCollection agent to free 1025 objects and deleted 0 objects. But I don't see any change in the table space size. I am little confused b/w freed and deleted.
thanks once again for your response Matt.
-Raj. -
Free space showing in Table space but not updated on os file system.
Hi Support,
I am using oracle 10.2.0.4.0 in ECC6.0. OS is Solaris 10 (Linux).
We deleted all xml messages from my PI/XI server. its successfully deleted even table space showing free space almost 400GB in DB02 and from brtools also. But from OS side OS file system not showing free space,
Is any body know about this issue???? do i need to reboot system or any other solution.
Thanks,
Kazi Faizan.Try to set it up as new device and restore again from the backup:
How to erase your iOS device and then set it up as a new device or restore it from backups -
Table space not reduce after delete in oracle 10g
Hi..
Based on my system, i have found that my oracle table space did not reduce after the deletion query. Why ?.. Could somebody help me. As your info, I am using oracle 10g.
Thank you,
BaharinAfter Delete the table space will not be set free. high water mark will not be reset. to regain the space you need to recognize the objects from which you deleted the data. This can be done in many ways.
1) Move the objects.
Alter table temp move --> optionally tablespace clause can be used. After this you need to rebuild table indexes.
2) With 10g table can be shrinked or reorganize to free the space.
alter table mytable enable row movement;
alter table mytable shrink space;
3) Export/Import
export the objects and drop and recreate with import. -
Information about table spaces.
Hi!
I have a requirement to create a Bex by which I can display the list of table spaces available and status of those table spaces like memory free, Used. Though we can get this information from DB02 I need to generate a report and broadcast that to users.
Can anyone help me in telling me the table name where you can get the list of table spaces and infomation or any function module which lists the table spaces name and status of them.
Regards
VenkatHello,
Could you please share more information about this? We need to do the same thing. How did you create your generic datasource? what table/Function module did you used?
Thank you
Ramona -
Table space and recollection of released space after client deletion
Dear All,
I have two questions:
1.Can any1 tell me how to determine the fastest growing table and how to reorganize table space.
2. Is there any way by which we can recollect the space released:say after client deletion. I had deleted one client two weeks back and when I saw the SAP/user drive I fow free space available remains the same.
I searched but found no relevant clue.
regards,
Ashutosh1.- You can see the largest table report in ST04 (as far as i remember)...
2.- You can reorganize your db using brtools - brspace...
Read,
http://help.sap.com/saphelp_erp2004/helpdata/en/32/0d0c888839164ba4245b3ff7969c59/frameset.htm
Regards
Juan -
How to verify reused table space in oracle 10g ?
Hi..
From my system, i have seen that the table size keep increasing event the delete query is running. Due to that, I would to check either the oracle allowed to reuse the table space or not ? if not then how could i enable it ?
Please help me..
Thank you,
BaharinYou can use dbms_space.space_usage to check the for free space.
Space reuse will depend on whether you are using MSSM or ASSM, PCT_FREE, PCT_USED, and how new data is inserted ?
You can shrink or move the table and rebuild indexes to reclaim space. -
Percentage of used table space not reduce after deletion
Hi..
This is my query to delete data from database:-
delete from $tb_data where to_char(partition_dt,'MON') = '$mm';
The $tb_data and $mm is variable and the $tb_data will be read input table name (as example backup_nx160, backup_ngn and etc) and the $mm will be capture the input month.
My question is why the percentage of used table space is not reduce after delete query was executed. Could somebody help me..
Please help me..
Thank you,
Baharinbaharin wrote:
Hi..
Is it the deleted space will be reused by the system ?Yes.
.. How could i check the real free tablespace or real usage table space ?If you have gathered statistics on the schema recently, then sum (avg_row_len*num_rows) should give you the exact number of bytes that are being consumed - assuming all tables are in a single tablespace under consideration. You can subtract this value from sum (dba_data_files.bytes) figure for the tablespace, to know exact free space. -
Unable to extend the table space
Hi Experts
When i am extending the table space i am getting this error
BR1059E Not enough free space in /oracle/SHD/sapdata3/sr3700_20 for maximum size
of file /oracle/SHD/sapdata3/sr3700_20/sr3700.data20, missing at least 491.556
MB
but when i checked the space, space is available
/dev/vg01/lvol16 41943040 34863437 6637129 84% /oracle/SHD/sapdata4
/dev/vg01/lvol15 41943040 37013805 4621160 89% /oracle/SHD/sapdata3
/dev/vg01/lvol14 41943040 31803117 9506180 77% /oracle/SHD/sapdata2
/dev/vg01/lvol13 31457280 28486427 2785176 91% /oracle/SHD/sapdata1
i am unable to extend the table space. Please help me
Thanks & Regards
VenkatHi Venkat,
Please try to disable the autoextend, in the brspace screen first you make off for autoextend then you try to extend the space.
Definetly it will work. I have faced same problem earlier.
Please let me know still if you have any problem for extending.
Thanks
Kishore -
How can free + used space tbs size, can someone explain
Hi Gurus
Can someone explain this, How can free + used space in a tablespace can be greater than size of a tablespace. What am I missing here . Thanks a lot .
I am on 10.2.0.1, HP-UX
14:38:52 SQL> select owner,sum(bytes), sum(BYTES) /1024/1024 "MB" from dba_segments where tablespace
name='USERDB1ADATA' group by owner;
OWNER SUM(BYTES) MB
USERDB1A 839680000 800.78125
1 row selected.
14:40:42 SQL> select bytes, BYTES /1024/1024 "MB" from dba_data_files where tablespace_name='USERDB1
A_DATA';
BYTES MB
3758096384 3584
1 row selected.
14:40:42 SQL> select sum(bytes) , sum(BYTES) /1024/1024 "MB"from dba_free_space where tablespace_nam
e='USERDB1A_DATA';
SUM(BYTES) MB
3067412480 2925.3125
1 row selected.
14:40:43 SQL> select 839680000 + 3067412480 "used + free space" from dual;
used + free space
3907092480
1 row selected.
New DBAGood point, Howard, about the recycle bin. So I cleaned up, recreated the table, filled it, dropped it but did not purge it, and ...
SQL> create table test.x tablespace test as select * from dba_objects where 1=2;
Table created.
SQL> insert into test.x select * from dba_objects;
12617 rows created.
SQL> commit;
Commit complete.
SQL> drop table test.x;
Table dropped.
SQL> with
2 dbf_size as (select sum(bytes) size_
3 from dba_data_files where tablespace_name='TEST'),
4 dbf_free as (select sum(bytes) free_
5 from dba_free_space where tablespace_name='TEST'),
6 dbf_used as (select sum(bytes) used_
7 from dba_segments where tablespace_name='TEST')
8 select size_, free_, used_, (size_ - free_ - used_) left_
9 from dbf_size, dbf_free, dbf_used
10 /
SIZE_ FREE_ USED_ LEFT_
5242880 5177344 2162688 -2097152
SQL>and then I played around with my SQL and came up with
WITH
dbf_size AS (SELECT SUM(bytes) size_
FROM dba_data_files
WHERE tablespace_name='TEST'),
dbf_free AS (SELECT SUM(bytes) free_
FROM dba_free_space
WHERE tablespace_name='TEST'),
dbf_used AS (SELECT SUM(bytes) used_
FROM dba_segments
WHERE tablespace_name='TEST'),
dbf_fbin AS (SELECT SUM(bytes) fbin_
FROM dba_segments
INNER JOIN
dba_recyclebin
ON (tablespace_name=ts_name
AND segment_name=object_name)
WHERE tablespace_name='TEST')
SELECT size_, -- tablespace size
free_, -- free space reported
used_, -- segment space used
fbin_, -- segment space in recycle bin
(size_ - free_ - used_ + fbin_) left_ -- 64K overhead per data file
FROM dbf_size, dbf_free, dbf_used, dbf_fbin
/which does
SQL> WITH
2 dbf_size AS (SELECT SUM(bytes) size_
3 FROM dba_data_files
4 WHERE tablespace_name='TEST'),
5 dbf_free AS (SELECT SUM(bytes) free_
6 FROM dba_free_space
7 WHERE tablespace_name='TEST'),
8 dbf_used AS (SELECT SUM(bytes) used_
9 FROM dba_segments
10 WHERE tablespace_name='TEST'),
11 dbf_fbin AS (SELECT SUM(bytes) fbin_
12 FROM dba_segments
13 INNER JOIN
14 dba_recyclebin
15 ON (tablespace_name=ts_name
16 AND segment_name=object_name)
17 WHERE tablespace_name='TEST')
18 SELECT size_,
19 free_,
20 used_,
21 fbin_,
22 (size_ - free_ - used_ + fbin_) left_
23 FROM dbf_size, dbf_free, dbf_used, dbf_fbin
24 /
SIZE_ FREE_ USED_ FBIN_ LEFT_
5242880 5177344 2162688 2162688 65536
SQL> alter tablespace test add datafile 'C:\ORACLE\ORADATA\XE\TEST2.DBF' size 5m;
Tablespace altered.
SQL> WITH
2 dbf_size AS (SELECT SUM(bytes) size_
3 FROM dba_data_files
4 WHERE tablespace_name='TEST'),
5 dbf_free AS (SELECT SUM(bytes) free_
6 FROM dba_free_space
7 WHERE tablespace_name='TEST'),
8 dbf_used AS (SELECT SUM(bytes) used_
9 FROM dba_segments
10 WHERE tablespace_name='TEST'),
11 dbf_fbin AS (SELECT SUM(bytes) fbin_
12 FROM dba_segments
13 INNER JOIN
14 dba_recyclebin
15 ON (tablespace_name=ts_name
16 AND segment_name=object_name)
17 WHERE tablespace_name='TEST')
18 SELECT size_, -- tablespace size
19 free_, -- free space reported
20 used_, -- segment space used
21 fbin_, -- segment space used in recycle bin
22 (size_ - free_ - used_ + fbin_) left_
23 FROM dbf_size, dbf_free, dbf_used, dbf_fbin
24 /
SIZE_ FREE_ USED_ FBIN_ LEFT_
10485760 10354688 2162688 2162688 131072Message was edited by:
Hans Forbrich
Cleaned up the script and tested with second data file added to verify LMT overhead. -
Hi
tablespace(PSAPHOD) is used 99%, how can i increase, there is any option for auto ext
Tablespace Size (kb) Free (kb) Used (%) Tab/ind Extents AutoExt (kb) Used (%) Status Backup
PSAPHOD 30,670,848 15,680 99 100,449 143,618 122.880.000 25 ONLINE NOT ACTIVETo add data file to the Tablspace.
1. Logon to the systems as ora<sid>
2. Execute brtools
3. Select u201C2 u2013 Space managementu201D
4. Select u201C1 u2013 Extend tablespaceu201D
5. Select u201C3 u2013 tablespace name
6. Select u201Cc u2013 Continue
7. Select u201C3 u2013 give the path for the new file to be added
8. Select u201C5 u2013 Size of the new file in MB
9. To continue select u201Ccu201D
10. Select continue and confirm the return to BRTOOLS menu.
11. Exit from the u201CSpace managementu201D menu using b (back)
12. Now it is possible to exit from BRTOOLS using option u201C9 u2013 Exit programu201D.
(a) BR*Tools main menu:
1 = Instance management
2 - Space management
3 - Segment management
4 - Backup and database copy
5 - Restore and recovery
6 - Check and verification
7 - Database statistics
8 - Additional functions
9 - Exit program
(b) BR0662I Enter your choice: 2
Database space management
1 = Extend tablespace
2 - Create tablespace
3 - Drop tablespace
4 - Alter tablespace
5 - Alter data file
6 - Move data file
7 - Additional space functions
8 - Reset program status
(c) BR0662I Enter your choice: 1
(d) BR0662I Enter your choice: 3
Give the tablespace name :
BR0662I Enter your choice: c, c
(f) BR0662I Enter your choice: 3
Select the correct path i.e. where you want to create the data file (must be in sapdata folder)
(g) BR0662I Enter your choice: 5
Select the size of the new data file.
(h) BR0662I Enter your choice: c, c, c
END----
I guess adding 4 GB to PSAPHOD table space is more than sufficient.
Regards
Vivek Hegde -
Free disk space recommendation
Hi,
I have a question about free disk space recommendation. My system now has <25% free space at ASP3, I can't see any problems until now, but I think that I can some troubles in the future depending on DB growth, it isn't?
Have you any tip about this? Are there any recommendation in IBM i5 redbooks?
Thank you!
Best Regards,
André HonmaGenerally you do not want to go much higher than 70 to 80% utilization.
This is because the system may need the free space for system operations, temporary storage and to allow for spikes in storage that may occur when processing heavy workloads, such as temporary work space or for transient files, journal receivers, system logs and spool entries (QSPL as opposed to SAP's own spooling).
Certain systems functions, such as dedicated physical file reorganizations, have specific minimum requirements with respect to the need for free space.
At this point, you are at 75% utilization which puts you right in the middle of the range where you really want to examine what is going on.
Usually when you hit 90% or above you will start to get messages from the OS about high storage.
You can free up space in several ways. Only keep journal receivers for as long as you need them. Once they are detached and saved offline (tape/remote jounals etc) they can be deleted. You need to have a strategy in place for this, however. Our shop archives a full save on a weekly basis, and all journal receivers up to that point (with a small margin retained for visibility) are deleted.
In addition, we use Datamirror's High Availability product which scrapes the journal receivers to mirror the production system on a hot backup. The receivers must remain on the system until they are replicated (this is also true for other High Availability products). This is usually near real-time, but it can be an issue if you do not manage it properly. (Given our weekly archive strategy, this is not an overriding consideration for us, but it may be important for those with a different strategy.)
SAP uses the reuse deleted records feature of DB2, but sometimes excessive amounts of deleted records build up due to spikes, especially in files like VBDATA and related files, or after purging older transaction history or deleting old clients. You can periodically reorganize physical files to reclaim deleted space.
You can also use RCLSTG (Reclaim storage) and RCLSPLSTG (Reclaim Spool Storage) to reclaim some temporary space.
However, RCLSTG should only be used if there is a specific need for it, as outlined in IBM's technical note: <a href="http://www-912.ibm.com/s_dir/slkbase.NSF/0/9373303619fb4b89862565c2007d4bcf?OpenDocument&ExpandSection=1">Overview of the RCLSTG Command</a>
Periodic IPLs will also reclaim space, including spool space as if RCLSPLSTG had been run..
If you have other libraries on your system, you can also see if they are being managed wisely using the same ideas as you would use for your SAP libraries.
Within SAP itself there are tools to manage tables that are within the scope of you various SIDs and clients. When SAP purges data, however, it only does a soft delete via DB2 SQL, and a physical file reorg as noted above may be required to reclaim space at the OS level.
As the previous respondent noted, you should keep track of the growth of your system and then take whatever steps are necessary to bring storage down or increase storage.
You may also want to consider your storage strategy. We had been using full mirroring, and we were able to increase our effective storage by going to RAID-5, and therefore put off the need to buy more disk for a time.
Good luck.
Brian
Message was edited by:
Brian Sammond -
I want to delete approx 100,000 million records and free the space
Hi,
i want to delete approx 100,000 million records and free the space.
I also want to free the space.How do i do it?
Can somebody suggest an optimized way of archiving data.user8731258 wrote:
Hi,
i want to delete approx 100,000 million records and free the space.
I also want to free the space.How do i do it?
Can somebody suggest an optimized way of archiving data.To archive, backup the database.
To delete and free up the space, truncate the table/partitions and then shrink the datafile(s) associated with the tablespace. -
Hi, I have a requirement to produce several custom free disk space reports based around groups. This will be on a 2012 R2 management group. For a given group, does anyone know the SQL tables and the joins required to produce
both the free space % and free space MB in one query?
Thanks in advance,
Stevewhat did you means of free space % and free space MB?
does it means the HD free or DB free space?
I assume that its means DB free space and you may refer to the following SQL statement
select Path, displayname,ObjectName, CounterName, avg(SampleValue) as Value, getdate() as date
from Perf.vPerfRaw pvpr
inner join vManagedEntity vme on pvpr.ManagedEntityRowId = vme.ManagedEntityRowId
inner join vPerformanceRuleInstance vpri on pvpr.PerformanceRuleInstanceRowId = vpri.PerformanceRuleInstanceRowId
inner join vPerformanceRule vpr on vpr.RuleRowId = vpri.RuleRowId
WHERE ObjectName = 'SQLServer : Database'
AND CounterName like 'DB Total Free Space%'
AND pvpr.DateTime > DATEADD(minute, -60, GETUTCDATE())
AND Path in (select DisplayName + ';MSSQLSERVER' from OperationsManager.dbo.RelationShip r with (nolock) inner join OperationsManager.dbo.basemanagedentity bme
with (nolock) on bme.BaseManagedEntityId = R.TargetEntityId
Where SourceEntityId in ( select BaseManagedEntityId from OperationsManager.dbo.basemanagedentity with (nolock) where DisplayName LIKE
'%SQL computer%') and r.IsDeleted=0)
group by Path, displayname,ObjectName, CounterName
Roger -
Does DELETE operation frees up space
Hi,
Does DELETE on some rows of a table also free up space on the tablespace.
If no, how to actually free up the tablespace occupied memory in the tablespace after a delete operation.
Thanks,
Himadri> Rows with a specific condition should be removed and the space
should be freed up. That is what i am looking for.
Oracle does not work like that. For good (performance related) reasons.
Oracle has "percentage used" and "percentage free" space parameters. These you/the DBA need to tune for the optimal balance between performance and space utilisation.
These percentages serve as low- and high-water marks. When there are data above the high water mark, the block is removed from the free list (free list = blocks with sufficient space for more rows to be added to the block).
When the data in a non-free blocks drop below the low water mark, that block is moved back to the free list.
When you delete data, the blocks affected will free space. However, if the current space used of these affected blocks does not drop below the set low water mark, these blocks will not be moved to the free list.
When dealing with large table and deleting rows, you'll often find that no space has been released. The number of rows deleted are scattered across so many disctinct blocks, that the delete did not free sufficient space in any of these blocks to result in them moving to the free list.
Maybe you are looking for
-
Can I move music from my computer to my phone?
HI everyone, Just bought a Palm Pre Plus and was wondering if it was posisble to pull MP3 files from my computer to my phone. Do I need any software installed on my phone or PC before it plug it in via USB?
-
How can I create a view of top five teams averages based on individual averages of that team?
I have created a list that groups teams by their Team name (Team column) with the individuals members (participants column) averages and their team average (total average view option). I want to only display the top five teams that have the overall
-
Length of component (DC) name
Hi, What is the allowed length of a component (DC) name? A DC Project name includes the following details: JDI track, SC, CompName, vendor name. While creating a DC project, if the name exceeds 8 char it shows a warning. What is allowed length here?
-
I'm trying to understand why Apple wouldn't have iPhone tasks. I'm on the verge of buying 2.0 but have been waiting to hear the Apple did indeed add tasks and cut/past, neither of which happened. If I ignore possible workarounds like using memos or c
-
After having read numerous responses indicating customized iTunes EQ settings are non-transferable to my iPod, I'd like to first get out of the way, this is not my question of my problem. My problem > After creating customized EQ presets on my Window