Removing Tablespace fragmentation in 10g
i have a problem with a tablespace space that is highly fragmented . It's locally managed with PCT_INCREASE set to 0. How can i reduce the fragmentation in this tablepsace
Free/Used Space Report :
Tablespace Used MB Free MB Total MB Pct. Free
FRP_I01 158556 44625 203181 22
select PCT_INCREASE,EXTENT_MANAGEMENT,SEGMENT_SPACE_MANAGEMENT from dba_tablespaces where TABLESPACE_NAME='FRP_I01';
PCT_INCREASE EXTENT_MAN SEGMEN
0 LOCAL AUTO
fragmentation report :
select
2 tablespace_name,
3 count(*) free_chunks,
decode(
4 5 round((max(bytes) / 1024000),2),
6 null,0,
7 round((max(bytes) / 1024000),2)) largest_chunk,
8 nvl(round(sqrt(max(blocks)/sum(blocks))*(100/sqrt(sqrt(count(blocks)) )),2),
9 0) fragmentation_index
10 from
11 sys.dba_free_space
12 group by tablespace_name
13 having tablespace_name='FRP_I01'
14 order by
15 2 desc, 1;
TABLESPACE_NAME FREE_CHUNKS LARGEST_CHUNK FRAGMENTATION_INDEX
FRP_I01 201 11904 13.56
SELECT dfsc.tablespace_name tablespace_name,
2 DECODE (
3 dfsc.percent_extents_coalesced,
100,
4 5 (DECODE (
6 GREATEST ((SELECT COUNT (1)
7 FROM dba_free_space dfs
8 WHERE dfs.tablespace_name = dfsc.tablespace_name), 1),
9 1,
10 'No Frag',
11 'Bubble Frag'
12 )
13 ),
14 'Possible Honey Comb Frag'
15 )
16 fragmentation_status
17 FROM dba_free_space_coalesced dfsc
18 where dfsc.tablespace_name='FRP_I01'
19 ORDER BY dfsc.tablespace_name;
TABLESPACE_NAME FRAGMENTATION_STATUS
FRP_I01 Bubble Frag
yes, i know that. But as per my script this particular tablespace is fragmented and i want to know if some1 can help me out how to defragment it ?
A 100% score indicates no fragmentation at all. Lesser scores verify the presence of fragmentation.The free chunks count column will tell you how many segments of free space are scattered throughout the tablespace.
thanks in advance
Similar Messages
-
What is the use of SYSAUX Tablespace in Oracle 10G
Dear Experts,
Please Tell me What is the use of SYSAUX Tablespace in Oracle 10G Because
during Web Load Testing It is going to increase countinuosly.Although i am not using this with any tables.
How Can I find out the what is gong on in this.
Can I Remove this tablesspace and other non using Schemas like FLOWS_020100,MDSYS,OUTLN,DIP and TSMSYS etc.What is SYSAUX?
The SYSAUX tablespace provides storage of non-sys-related tables and indexes that traditionally were placed in the SYSTEM tablespace. For example, the tables and indexes that were previously owned by the system user can now be specified for a SYSAUX tablespace. Unfortunately, Oracle still places the SCOTT schema and the other demonstration schemas in the SYSTEM tablespace. Go figure.
The SYSAUX tablespace is specified with the CREATE DATABASE command. This is demonstrated in the example database creation script in Figure 1.1.
CREATE DATABASE test
MAXINSTANCES 1
MAXLOGHISTORY 1
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/usr/oracle/OraHome1/oradata/aultdb1/test/system01.dbf' SIZE 300M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/usr/oracle/OraHome1/oradata/aultdb1/test/sysaux01.dbf' SIZE 120M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/usr/oracle/OraHome1/oradata/aultdb1/test/temp01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL
UNDO TABLESPACE "UNDOTBS1" DATAFILE '/usr/oracle/OraHome1/oradata/aultdb1/test/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
CHARACTER SET WE8ISO8859P1
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/usr/oracle/OraHome1/oradata/aultdb1/test/redo01.log') SIZE 10240K,
GROUP 2 ('/usr/oracle/OraHome1/oradata/aultdb1/test/redo02.log') SIZE 10240K,
GROUP 3 ('/usr/oracle/OraHome1/oradata/aultdb1/test/redo03.log') SIZE 10240K
USER SYS IDENTIFIED BY "password" USER SYSTEM IDENTIFIED BY "password";
Oracle10g sysaux
With the new SYSAUX tablespace, Oracle comes closer to providing all the needed tablespaces for a truly OFA-compliant database right out of the box. With just one CREATE DATABASE command we can specify the SYSTEM tablespace, the TEMPORARY tablespace, the AUXSYS tablespace, the default UNDO tablespace, and the redo logs.
Of course, with the Oracle Managed Files option you can create an entire database with a single command, but the database created is not suitable for production use and is not OFA-compliant.
The SYSAUX tablespace is required in all new 10g databases. Only the SYSAUX tablespace datafile location is specified. Oracle specifies the remainder of the tablespace properties including:
online
permanent
read write
extent managment local
segment space management auto
If a datafile is specified for the SYSTEM tablespace, then one must be specified for the SYSAUX tablespace as well. If one is not specified, then the CREATE DATABASE command will fail. The only exception is for an Oracle Managed File system.
During any update of a database to Oracle Database 10g, a SYSAUX tablespace must be created or the upgrade will fail. The SYSAUX tablespace has the same security profile as the SYSTEM tablespace. However, loss of the SYSAUX tablespace will not result in a database crash, only the functional loss of the schemas it contains.
Can I drop SysAux?
DROP DATAFILE
Read this... -
How we find tablespace fragmentation and resolve this problem
Hi,
How we find tablespace fragmentation and resolve this in 10 G (R2) windows XP.
Regards
FaheemHi,
>>Are you using Dictionary Managed or Locally Managed Tablespaces...??
In fact, there is no way to create a DMT if SYSTEM tablespace is LMT. So, what I said in my previous post "Unless the OP is using DMT ..." is impossible in Oracle 10g ...
SQL> create tablespace tbs_test
2 datafile '/u01/oradata/BDRPS/test01.dbf' size 5m
3 extent management dictionary;
create tablespace tbs_test
ERROR at line 1:
ORA-12913: Cannot create dictionary managed tablespace
SQL> select extent_management from dba_tablespaces
2 where tablespace_name='SYSTEM';
EXTENT_MAN
LOCALCheers
Legatti -
Can I import a tablespace into Oracle 10g Express Edition
I am very new to Oracle 10g Express Edition. We have a server running Oracle Enterprise Edition and we have been creating a transportable tablespace to be imported into a few servers. This works fine for us. I would like to find out if I can import the tablespace into Oracle 10g Express Edition. Someone told me that I should be able to do that but I have no clue to how to do it. If this is possible, can someone tell where to find the information how to do this.
Thanks,
RJI finally tried it and I got the following errors:
IMP-00017: following statement failed with ORACLE error 721:
"BEGIN sys.dbms_plugts.checkCompType('COMPATSG','10.2.0.2.0'); END;"
IMP-00003: ORACLE error 721 encountered
ORA-00721: changes by release 10.2.0.2.0 cannot be used by release 10.2.0.1.0
ORA-06512: at "SYS.DBMS_PLUGTS", line 2004
ORA-06512: at line 1
IMP-00000: Import terminated unsuccessfully
Am I right that the server that I exported the tablespace is using Oracle 10.2.0.2.0 while Oracle Express is 10.2.0.1.0? I looked around and I did not see Oracle Express version 10.2.0.2.0 that I can download. Is there a patch or something to upgrade it?
Thanks,
RJ -
Temporary tablespaces in Oracle 10g
Hi,
I have created temporary tablespaces in Oracle 10g from the SQL prompt,but when i list the corresponding datafiles from v$datafile there tempfiles are not listed there,why is it so?
Regards,
CherryHi,
Take a look in
1 - DBA_TEMP_FILES :http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch2398.htm
2 - V$TEMPFILE: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch3225.htm
Cheers,
Marcello M. -
Best Practices - Removing table fragmentations.
What is the best practices for removing the fragmentation in the tables. Does this process be used after every week month or every day.
Hi Chunm,
What is the best practices for removing the fragmentation in the tables.I monitor chained rows (table fetch continued rows), reorg with dbms_redefinition (or move to larger blocksize), and ALWAYS adjust PCTFREE to prevent future fragmentation. Read this:
http://www.dba-oracle.com/t_identify_chained_rows.htm
http://www.dba-oracle.com/oracle_tips_fetch_cont_rws.htm
Hope this helps. . .
Don Burleson
Oracle Press author -
Hi All,
How can I identify the tablespace is fragmented or not?
If fragmented how can I resolve the issue while production database is up & running.
Thanks in advance...REM This script measures the fragmentation of free space
REM in all of the tablespaces in the database and scores them
REM according to an arbitrary index for comparison
REM
REM largest extent 100
REM FSFI = 100 * sqrt(------------------) * (-------------------------------)
REM sum of all extents sqrt(sqrt((number of extents)))
REM
REM FSFI - Free Space Fragmentation index
REM The largest possible FSFI (for an ideal single-file tablespace) is 100
REM As the number of extents increases, the FSFI rating drops slowly. As the size of
REM the largest extent drops, however, the FSFI rating drops rapidly.
select tablespace_name
, file_id
, sqrt(max(blocks)/sum(blocks)) *
(100/sqrt(sqrt(count(blocks)))) fsfi
from dba_free_space
group by tablespace_name, file_id
order by 1,2;
You can move object to another tablespace and rebuild the associated indexes for tablespace fragmentation.
Drop the old tablespace.
Also you can go for export/import.
Regards
Asif Kabir -
Is it possible to create Dictionary Tablespace creation in 10g database?
Dear All,
Is it possible to create Dictionary Tablespace creation in 10g database?
regards,
DB.Check this
How To create dictionary managed system tablespace in 10g R2 -
Remove database fragmentation in Essbase
Hi,
Somebody guide me which is best option to remove database fragmentation in essbase at Production server.
I see Average clustering ratio is -> 0.5 which i think should be higher.
Option which i know:-
export data (all) > clear database > load data again.
Regards
KumarEither a full restructure or export,clear,import data should remove the fragmentation.
Personally I prefer to export/import.
Cheers
John
http://john-goodwin.blogspot.com/ -
What is tablespace fragmentation?
hello all,
please,give me more detail about tablespace fragmentation .i want to know when tablespace fragmentation occur? thanks all in advance for response.first thanks u and all for give me response and this wonderful link but i have a doubt which i want to ask ,when table is dropped,or truncated or raw of table is deleted then free extents is available for another request, if a request is made for an extent allocation that cannot be found in one free contiguous extent even though the total free space in the tablespace may be significantly larger than the requested size. is this a fragmentation problem?
-
Checking Tablespace Fragmentation...
Folks,
Can someone share a high-end script for Checking Tablespace Fragmentation that shows exact numbers/values?
The one I have shows only yes or no..
Pasting my script below:
Prompt Fragmentation Level in the db
Prompt
TTitle left "*** Fragmentation Level in the db (As of:"xdate ") from mtdb" skip2
SELECT dfsc.tablespace_name tablespace_name,
DECODE (
dfsc.percent_extents_coalesced,
100,
(DECODE (
GREATEST ((SELECT COUNT (1)
FROM dba_free_space dfs
WHERE dfs.tablespace_name = dfsc.tablespace_name),
1),
1,
'No Frag',
'Fragmented'
'Possible Honey Comb Frag'
fragmentation_status
FROM dba_free_space_coalesced dfsc
ORDER BY dfsc.tablespace_name
ttitle off
results:
TABLESPACE_NAME FRAGMENTATION_STATUS
IIS_TABS1 No Frag
IIS_TABS2 No Frag
IIS_TABS3 Fragmented
IIS_TABS4 No Frag
IIS_TABS5 No Frag
regards,
LilyCan you explain what, exactly, you mean by "tablespace fragmentation"? Assuming you are on a recent version of Oracle and using locally managed tablespaces (LMT's), fragmentation in the sense of having a chunk of space on disk that cannot be reused because it is too small is all but impossible. Technically, it is still possible in a LMT with automatic rather than uniform extent allocation, but it is exceptionally difficult in practice to come up with such a scenario.
Tablespace fragmentation was a potential problem in long-ago days when there were dictionary-managed tablespaces (DMT's) when individual objects could have different extent allocation policies and PCTINCREASE could be specified. The solution back then was to set INITIAL = NEXT = <<some reasonable constant>> and PCTINCREASE = 0 and simulate the uniform extent allocation option of LMTs.
Justin -
Best way to correct Tablespace fragmentation?
Dear DBAs,
The following query returns tablespace fragmentation:
select
tablespace_name,
count(*) free_chunks,
decode(
round((max(bytes) / 1024000),2),
null,0,
round((max(bytes) / 1024000),2)) largest_chunk,
nvl(round(sqrt(max(blocks)/sum(blocks))*(100/sqrt(sqrt(count(blocks)) )),2),
0) fragmentation_index
from
sys.dba_free_space
group by
tablespace_name
order by
2 desc, 1;
I have 3 tablespaces that are Locally Managed and suffer heavyt fragmentation. I just received the task of tuning this database and from what I could tell the fragmentation originated from a number of bad practices from past DBAs and also, some bizarre structures in certain tables.
My question is: what would be the best way to correct tablespace fragmentation LMT? I'm thinking export - drop - import to reorganize all blocks within the tablespace?Alvaro wrote:
Dear DBAs,
The following query returns tablespace fragmentation:
select
tablespace_name,
count(*) free_chunks,
decode(
round((max(bytes) / 1024000),2),
null,0,
round((max(bytes) / 1024000),2)) largest_chunk,
nvl(round(sqrt(max(blocks)/sum(blocks))*(100/sqrt(sqrt(count(blocks)) )),2),
0) fragmentation_index
from
sys.dba_free_space
group by
tablespace_name
order by
2 desc, 1;
I have 3 tablespaces that are Locally Managed and suffer heavyt fragmentation. I just received the task of tuning this database and from what I could tell the fragmentation originated from a number of bad practices from past DBAs and also, some bizarre structures in certain tables.
My question is: what would be the best way to correct tablespace fragmentation LMT? I'm thinking export - drop - import to reorganize all blocks within the tablespace?In addition to what everyone else notes is the unlikelihood of fragmentation, there may be implicit compaction and skew in your data distribution that could be impacted by export/import. For better or worse.
What bad practices are you referring to? Sometimes practices are inappropriate, sometimes useless, sometimes perfectly understandable. If you don't know about the fragmentation issue, I wonder how well you judge practices. And yes, there are some really bad practices floating about. -
What is the difference between Table & Tablespace Fragmentation
What is the difference between Table Fragmentation & Tablespace Fragmentation.
What causes Table Fragmentation and what cause Tablespace Fragmentation.
How can we avoid Table Fragmentation & Tablespace Fragmentation.
How can we fix already Fragmented Tables & Fragmented Tablespaces
Thanks
NaveenUnless you are using an exceptionally old version of Oracle or are still using dictionary managed tablespaces or are using some interesting definitions of "fragmentation", fragmentation is practically impossible in Oracle.
Justin -
Shrinking BLOB tablespace in Oracle 10g
Hello,
I have table created with 32 GB in Oracle 10g with BLOB field containing images. after that I have deleted some of the images from the table but when I'm checking free space, it is show full 32 GB. But when I'm looking at Toad it shows me out of 32 GB 17 GB is free.
my question is how to shrink/resize blob tablespace/table having BLOB field in oracle 10g 2rel ?Hello urgent,
Tablespace management is not really an Oracle Spatial topic, I suppose these are georaster images?. You probably want to search and post in the more general database forums.
The quick answer is that it is not easy. Oracle tablespaces may only be "shrunk" if the free space is at the end of the datafile at the "high water" mark. If by some wild coincidence the images you removed were indeed at the back of the datafile, then you could alter the datafile with a RESIZE command. But the odds of that being the case are incredibly low. If you really, really MUST recover that space then about the only thing to do is export the data, delete it from the tablespace, shrink the tablespace and then import the data back in. Another approach if you have the space is just move the data into another empty tablespace and then drop the original tablespace. I would guess that the salary expended for you to take everything offline and do this would be more than just buying another cheap disk. Considering that in doing your daily work you may well indeed be in this position again in a few weeks, then it makes even less sense.
Now having said all that I have been in the situation where I MUST recover that space without taking everything offline.
One thing you can try is to "pop" the last items off the datafile (moving them to another tablespace) identified using the query below. But this is an exercise in futility unless your resources happen to be nicely "chunked" together near the highwater mark. Oracle tends to stripe resources across the available space in the datafile. So you might find you need to move half the contents before recovering any significant amount of space.
Cheers,
Paul
SELECT '
a.owner, '
a.segment_name, '
a.segment_type, '
a.block_id, '
a.tablespace_name '
FROM '
dba_extents a '
WHERE '
a.file_id = ( '
SELECT '
b.file_id '
FROM '
dba_data_files b '
WHERE '
b.file_name = :p1 '
ORDER BY '
a.block_id DESC -
Tablespace Fragmentation. specially in SYSTEM tablesapce.
Hi,
I am working on Oracle 11gR2 DB and AIX OS.
An database is having many tablespaces which are allocated to specific schemas. These schemas are functional from a long time. Data comes and goes all the time. The size of the tablespace has gone very high(than expected). We have removed(truncated) most of the unwanted tables and data from the schema and trying to resize the datafile, but we are not able to do it.
while checking with the below query :-
SELECT df.tablespace_name "Tablespace",
df.bytes / (1024 * 1024) "Size (MB)",
SUM(fs.bytes) / (1024 * 1024) "Free (MB)",
Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free",
Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used"
FROM dba_free_space fs,
(SELECT tablespace_name,SUM(bytes) bytes
FROM dba_data_files
GROUP BY tablespace_name) df
WHERE fs.tablespace_name (+) = df.tablespace_name
GROUP BY df.tablespace_name,df.bytes
UNION ALL
SELECT df.tablespace_name tspace,
fs.bytes / (1024 * 1024),
SUM(df.bytes_free) / (1024 * 1024),
Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 / fs.bytes), 1),
Round((SUM(fs.bytes) - df.bytes_free) * 100 / fs.bytes)
FROM dba_temp_files fs,
(SELECT tablespace_name,bytes_free,bytes_used
FROM v$temp_space_header
GROUP BY tablespace_name,bytes_free,bytes_used) df
WHERE fs.tablespace_name (+) = df.tablespace_name
GROUP BY df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_used
ORDER BY 4 DESC;
The output is :-
tablespace name size_MB free_space_MB %free %used
SYSTEM 34256 28941.375 84 16
SMD 7975 2991.1875 38 62
.................N many other Here if i try to resize the SMD tablespace datafile to (7975-2991.1875) 4983 MB it does not allow me to do it.
Also the SYSTEM tablespace has gone so big but used space is very less.
I suspect that fragmentation is the problem here._
Please guide me what could i do in these case to reduce the space taken by the datafiles.
Thanks in advance.Thanks for notifying......I have a misconception about it...both the queries giving almost same result.
but first query give you result at datafile level.
SQL> column tablespace_name format a10
SQL> column file_name format a32
SQL> column file_mb format 9999990
SQL> column hwm_mb format 9999990
SQL> column used_mb format 9999990
SQL> column shrnk_mb format 9999990
SQL>
SQL> break on report
SQL> compute sum of file_mb on report
SQL> compute sum of hwm_mb on report
SQL> compute sum of used_mb on report
SQL> compute sum of shrnk_mb on report
SQL>
SQL> select a.*
2 , file_mb-hwm_mb shrnk_mb
3 from (
4 select /*+ rule */
5 a.tablespace_name,
6 a.file_name,
7 a.bytes/1024/1024 file_mb,
8 b.hwm*d.block_size/1024/1024 hwm_mb,
9 b.used*d.block_size/1024/1024 used_mb
10 from
11 dba_data_files a,
12 (select file_id,max(block_id+blocks-1) hwm,sum(blocks) used
13 from dba_extents
14 group by file_id) b,
15 dba_tablespaces d
16 where a.file_id = b.file_id
17 and a.tablespace_name = d.tablespace_name
18 ) a
19 order by a.tablespace_name,a.file_name;
TABLESPACE FILE_NAME FILE_MB HWM_MB USED_MB SHRNK_MB
SYSAUX C:\ORACLEXE\APP\ORACLE\ORADATA\X 710 673 672 37
E\UNDOTBS1.DBF
SYSTEM C:\ORACLEXE\APP\ORACLE\ORADATA\X 360 353 352 7
E\SYSTEM.DBF
UNDOTBS1 C:\ORACLEXE\APP\ORACLE\ORADATA\X 260 258 257 2
E\SYSAUX.DBF
USERS C:\ORACLEXE\APP\ORACLE\ORADATA\X 6340 6017 6016 323
E\USERS.DBF
TABLESPACE FILE_NAME FILE_MB HWM_MB USED_MB SHRNK_MB
sum 7670 7301 7296 369
SQL> SELECT /* + RULE */ df.tablespace_name "Tablespace",
2 df.bytes / (1024 * 1024) "Size (MB)",
3 SUM(fs.bytes) / (1024 * 1024) "Free (MB)",
4 Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free",
5 Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used"
6 FROM dba_free_space fs,
7 (SELECT tablespace_name,SUM(bytes) bytes
8 FROM dba_data_files
9 GROUP BY tablespace_name) df
10 WHERE fs.tablespace_name (+) = df.tablespace_name
11 GROUP BY df.tablespace_name,df.bytes
12 UNION ALL
13 SELECT /* + RULE */ df.tablespace_name tspace,
14 fs.bytes / (1024 * 1024),
15 SUM(df.bytes_free) / (1024 * 1024),
16 Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 / fs.bytes), 1),
17 Round((SUM(fs.bytes) - df.bytes_free) * 100 / fs.bytes)
18 FROM dba_temp_files fs,
19 (SELECT tablespace_name,bytes_free,bytes_used
20 FROM v$temp_space_header
21 GROUP BY tablespace_name,bytes_free,bytes_used) df
22 WHERE fs.tablespace_name (+) = df.tablespace_name
23 GROUP BY df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_used
24 ORDER BY 4 DESC;
Tablespace Size (MB) Free (MB) % Free % Used
TEMP 20 17 85 15
USERS 6340 323.3125 5 95
SYSAUX 710 37.25 5 95
SYSTEM 360 7.3125 2 98
UNDOTBS1 260 1.8125 1 99
SQL>
Maybe you are looking for
-
Creative MediaSource Organizer Alternati
Ok, so I have a Zen Vision M, and I can't figure out a way to listen to the songs that are on my mp3 player through my computer. The only way I've seen that even offers me the ability to do this is through MediaSource Organizer, and that quite frankl
-
Dear Gurus; I am working on a scenario where, the PRT (equipment) used in production has to under go Usage Decision, after EVERY 2000 produced units. If usage decision is Yes; system should automatically create maintenance (refurbishment) order for t
-
How do I delete all my data from my mini iPad?
I will return my wifi iPad mini to obtain a wifi cellular mini. I want to remove my data before returning.
-
This morning an alarm sound accompanied by a flashing thin light happened when I turned on my macbook pro. Now the pulser light is not coming on at all and there is a steady thin light to the left of the pulser that stays on when I close my laptop.
-
Ipad is disable. please help
i try to connect it to itunes but it says device is unrecognised please help