Tablespace Autoextend
Hi
In our R/3 landscape, the status of some of the tablespaces is "autoextend On" and some are "autoextend off" mode. We would like to turn the autoextnd mode OFF from ON.
What is the best way to turn the autoextend mode OFF. As per my understanding, if we turn off all the datafiles of the tablespace using SQLPLUS , it will automatically change the status of the autoextend mode from ON to OFF.
Pls confirm or suggest any other method to turn tablespace autoextend mode OFF.
Regards
Amar
Hi,
Use SQL. Don't know any other tool thats used for changing the mode.
Cheers,
Kedar
Similar Messages
-
Is it necessary to set all tablespace autoextend?
Hello Everyone,
I am noticing some PeopleSoft tablespace is full after a period. For now, I just set those tablespace autoextend but it is not a solution for future. I am wondering if I can set all tablespace autoextend in one time? Is there a potential risk for this?
Thanks,
BobOn Oracle db, you cannot set all datafiles in autoextend mode in one shot, it should be done per datafiles.
The risk to put the datafiles in autoextend unlimited is to fulfill your filesystem. Most of the shop consider better to set alert through OEM when tablespace is 80% full, for instance, and add manually files when needed. You also can spread off the datafiles across different mount points.
Nicolas. -
Tablespace autoextend on multiple datafiles
There is a tablespace with 3 data files, one of them having AUTOEXTEND option ON. I am trying to understand why space is not allocated on datafile with AUTOEXEND option ON.
Thanks in advance..Please also have a look at those scripts. They may help you;
select a.TABLESPACE_NAME, round(total,1) Total_M, round(free) Free_M, round(100*(1-free/total),1) Usage
from (select TABLESPACE_NAME,sum(BYTES)/(1024*1024) total from dba_data_files group by TABLESPACE_NAME) a
,(select TABLESPACE_NAME,sum(BYTES)/(1024*1024) free from dba_free_space group by TABLESPACE_NAME) b
where a.TABLESPACE_NAME=b.TABLESPACE_NAME(+) order by 4 DESC;
select df.tablespace_name ,
df.file_name ,
df.file_id ,
df.totalspace,
fs.freespace from
(select
tablespace_name,
file_name,
file_id,
round(sum(bytes)/1024/1024,2) as totalspace
from dba_data_files
group by tablespace_name,file_name,file_id) df,
(select
tablespace_name,
file_id,
round(sum(bytes)/1024/1024,2) as freespace
from dba_free_space
group by tablespace_name,file_id) fs
where df.file_id=fs.file_id
order by 5 desc; -
Undo Tablespace and Temporary Tablespace - autoextend ?
- In general, should I allow the Undo Tablespace to grow (autoextend)?
- In general, should I allow the Temporary Tablespace to grow (autoextend)?The size of undo tablespace should always keeps in mind otherwiase you eill get ORA-1555 or out of space errors.
This paper is to help DBA’s in calculating the size of UNDO tablespace by using a simple formula.
It is tough to know about the number of transactions and subsequently number of rows changed per second.
So I suggest having a “big undo tablespace” to start with and based on load, after doing some calculations and resize your UNDO tablespace.
In my case one of the applications was going to production (live), and I had no idea that how many transactions will happen against this database. All what I was told that there will be optimum (transactional) activity on this database.
So I started with UNDO tablespace with size of 3GB and datafiles with autoextend “on” .
Note:
In production, you must be very careful in using this (autoextend on) as the space may grow to inifinity very fast. So my advice is either dont use this option, or use with "maxsize" or continuously monitor space (which is tough).
I month later, I noticed the activity from V$undostat.
Here is the step by step approach:
Step 1: Longest running query.
SQL> select max(maxquerylen) from v$undostat;
MAX(MAXQUERYLEN)
1793
This gives you ideal value for UNDO_RETENTION. To be on the safer size you should add few more seconds to get the right value. So in my case, the size of undo retention should be say 2000 secs.
Step 2: Size of UNDO tablespace.
Size of UNDO needed = UNDO_RETENTION x [UNDO block Generation per sec x DB_BLOCK_SIZE] + Overhead(30xDB_BLOCK_SIZE)
Out of these we know UNDO_RETENTION and DB_BLOCK_SIZE
All we need is to find out “UNDO Blocks per second”
Which can be easily fetched from v$undostat
SQL> SELECT (SUM(undoblks))/ SUM ((end_time - begin_time) * 24*60*60) "UPS"
2 FROM v$undostat;
UPS
8.11985583
V$undostat stores data for every 10 mins and begin/end times are start/end time of those intervals. We multiplied it with 24*60*60 because the difference between two dates will be in days and to get to seconds, we need it to multiply with 24hrs*60mins*60secs
So now we have all the values needed.
Undo size needed = [8.12 x 2000 x 8192] + [30 x 8192] = 133283840 bytes = 127.11 MB -
Hello expert
we are using oracle 10.2.0.4 on HP-UX for SAP ECC6.0.
currently SAP Tablespace auto extend is ON but we want to OFF this coz when we try to backup Full+offline backup sometimes
its terminated unsuccessfully due to auto extend property & some times we felt slow response coz of this.
could you plz suggest me how can i OFF this autoextend, or in future how can i add DATAFILE on tablespace, how can i extend tablespace size or last what precaution should we have to make on DR server.
kindly help me, I am not DBA person and facing so much problem due to this.
plz could you suggest me any document to over come my oracle knowledge.
Best Regards
Deepak SinghHello Deepak,
You can turned off autoextend on all data files for more control of space.
But make sure to keep eye on the growth.
You can use the Oracle command:
alter tablespace ... autoextend off
SQL : you need to do this for all datafiles of the tablespace one by one which are auto extendable.
alter database datafile '/oracle/PRD/sapdata11/sr_11/data11.dbf' autoextend off
Or
Brtools
Space Mangement - Alter Data File - Alter Data File Action
Turn off autoextend
When adding datafile, you can use brtools
brtools -> space management -> extend tablespace -> enter the tablespace name.... etc
If you adding , new datafile to the primary server, make sure to set the DR or SB parameter to AUTO
STANDBY_FILE_MANAGEMENT = AUTO
Genus Power wrote:
> when we try to backup Full+offline backup sometimes its terminated unsuccessfully due to auto extend property
You may increase the extending amount, depending on the growth
If its a small value then, it may trying to extend in shorter periods. So after considering the workload , select a value to auto extend.
how you says , that backup fails due to auto-extending property. Whats the logs implies
regards,
Zerandib -
Hi,
I have created a tablespace to import a dumpfile
I created tablespace as
CREATE TABLESPACE DEV1 LOGGING DATAFILE
'/opt/oracle/oradata11g/DEV/DEVDATA01.dbf' SIZE 1G AUTOEXTEND ON MAXSIZE UNLIMITED,
'/opt/oracle/oradata11g/DEV/DEVDATA02.dbf' SIZE 1G AUTOEXTEND ON MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO;
My question is
Since I have given AUTOEXTEND ON MAXSIZE UNLIMITED for the datafile 'DEVDATA01.dbf'
When I start importing the dumpfile, Would two datafiles "DEVDATA01.dbf" & "DEVDATA02.dbf" get utilized
or only datafile "DEVDATA01.dbf" get utilized for restoring all the tables.
Please suggest me.
Thanks
KSGFrom documentation
The number of datafiles comprising a tablespace, and ultimately the database, can have an impact upon performance.
Oracle allows more datafiles in the database than the operating system defined limit. Oracle's DBWn processes can open all online datafiles. Oracle is capable of treating open file descriptors as a cache, automatically closing files when the number of open file descriptors reaches the operating system-defined limit. This can have a negative performance impact. When possible, adjust the operating system limit on open file descriptors so that it is larger than the number of online datafiles in the database.
Thanks,
NEerav -
Hi,
I got an Error like this
"ORA-01630 max # extents (string) reached in temp segment in tablespace string
Cause: A temporary segment tried to extend past MAXEXTENTS."
Is it possible to alter table space to Auto Extend in Oracle 8i With out Shutting down the
Database. What Exact Commands for this? Is this effect the performance of the database?
Please reply
With thanks Naseeruser13098327 wrote:
Hi,
I got an Error like this
"ORA-01630 max # extents (string) reached in temp segment in tablespace string
Cause: A temporary segment tried to extend past MAXEXTENTS."
Is it possible to alter table space to Auto Extend in Oracle 8i With out Shutting down the
Database. What Exact Commands for this? Is this effect the performance of the database?
Please reply
With thanks NaseerThe error you hit and your request is something different:
ORA-01630 - limitation of extents per object or per tablespace.
Tablespace autoextend - May be you mean datafile autoextend option.
Pls, specify. -
Oracle 11.2.0 (11g) - Windows Server 2008
We have our first system based on Oracle database.
We are loading data to this database month by month and after each month loaded I check the size of the tablespaces in Enterprise Manager.
We need to load 24 months, but after having loaded the third month I already see a problem.
The performance is very good, but the tablespace reserved for the indexes is raising very fast.
This tablespace (TS_IDX_01) has only 1 file (DF_SATH_IDX_01.dbf).
After loading the third month the used space was in 93 %.
I executed a rebuild in this index tablespace, and then an analyze for the statistics.
After these routines, the used space is in 73%.
The size of this idx tablespace now is 1.151 GBs and it has 847MBs of used space.
These sizes were specified by the consultant who installed the system 3 months ago.
I've been reading a lot of material about this subject and sometimes it seems that the more information I have the more confused I get.
I'd like to have the opinion of someone with more experience because it's not just a matter of creating new tablespaces following the structure created by our consultant, but also a matter of future performance.
So I have 2 questions :
1) It seems to be possible to change the size of the tablespace in EM. Is it common to do so ? Can I have technical or performance problems during this modification ?
2) Based on the situation I described, could you give me some suggestions about size for this index tablespace and its files ?
Thanks in advance,
EduardoHi,
Usually with the latest versions of Oracle it is common to let the tablespace 'autoextend'
This means it will grown when full / necessary.
Our databases have Index tablespaces of e.g. 80Gb or 200Gb, so the size outlined by the structure of the consultant is in your case way to small.
The consultant was probably an application consultant and not an Oracle DBA. So it is doubtfull if he understands the sizes of the objects of his application very well
To change your tablespace to autoextend use the following syntax
select name from v$datafile where ts#=(select ts# from v$tablespace where name = 'TS_IDX_01');With this name found:
alter database datafile 'name' autoextend on next 100m maxsize 10G;If the tablespace exists of more than one file, do this for all the files
This enables the tablespace to extend itself when needed with chunks of 100Mb until it reached the 10Gb size. Then the usual 'can not extend tablespace ...' messages will appear
HTH
FJFranken -
Dear all,
We are getting red alert message on Database administration in EWA report ,
Kindly check below logs :
We checked your system for tablespaces that may overflow in the near future.
10.2.1 Tablespaces - Autoextend Limit
Tablespace Size (KB) Free (KB) Avg. Chg/Week (KB) %-Used AutoExt %-Used after AutoExt
PSAPSR3 200028160 316992 5557700 99 204.800.000 98
PSAPSR3700 72826880 3591936 8429 95 174.080.000 40
SYSAUX 430080 31616 12596 92 10.240.000 4
You have set the 'autoextend' option for some tablespaces to a limited value. More than 95% of the limited size is already used.
Recommendation: Increase the values for the limits as soon as possible, or use SAPDBA to add new data files to the tablespaces of the table above.
Implementation: To determine the size required, consider the tablespaces' history of storage usage. Once you have added a data file, back up the extended tablespace. This ensures that the new state of the database can be recovered.
Kindly advise to resovle the above issues ..Dear Shroff,
Pls check the show table space details through BRtools
BR1001I BRSPACE 7.00 (49)
BR1002I Start of BRSPACE processing: seerdask.dbw 2010-11-29 11.30.06
BR0101I Parameters
Name Value
oracle_sid IRP
oracle_home /oracle/IRP/102_64
oracle_profile /oracle/IRP/102_64/dbs/initIRP.ora
sapdata_home /oracle/IRP
sap_profile /oracle/IRP/102_64/dbs/initIRP.sap
space_function dbshow
space_copy_dir /oracle/IRP/sapreorg
scroll_lines 20
system_info orairp/orairp PRODORADB AIX 3 5 00018B6AD400
oracle_info IRP 10.2.0.4.0 8192 51738 758307642 PRODORADB
sap_info 700 SAPSR3 0002LK0003IRP0011D11604089540015Mainte
nance_ORA
make_info rs6000_64 OCI_102 Aug 2 2010
command_line /usr/sap/IRP/SYS/exe/run/brspace -p initIRP.sap -
s 20 -l E -U -f dbshow -c tsinfo
BR0280I BRSPACE time stamp: 2010-11-29 11.30.11
BR1009I Name of database instance: IRP
BR1010I BRSPACE action ID: seerdask
BR1011I BRSPACE function ID: dbw
BR1012I BRSPACE function: dbshow
BR1036I Class of information to be shown: tsinfo
BR0280I BRSPACE time stamp: 2010-11-29 11.30.14
BR0659I List menu 259 + you can select one or more entries
List of database tablespaces
Pos. Tablespace Type Status ExtMan. SegMan. Backup Files/AuExt.
Total[KB] Used[%] Free[KB] MaxSize[KB] ExtSize[KB] FreeExt. Lar
gest[KB]
1 - PSAPSR3 DATA ONLINE LOCAL AUTO NO 20/20
200192000 99.84 327168 204800000 4608000 21 79
8720:655360:614400:593920:593920+
2 - PSAPSR3700 DATA ONLINE LOCAL AUTO NO 17/17
72826880 95.07 3591936 174080000 101253120 17 612
3520:6123520:6103040:6082560:6082560+
3 - PSAPSR3USR DATA ONLINE LOCAL AUTO NO 1/1
20480 90.00 2048 10240000 10219520 1 1021
9520+:2048:0:0:0
4 - PSAPTEMP TEMP ONLINE LOCAL MANUAL NO 1/1
4362240 0.00 4362240 10240000 5877760 0 587
7760+:0:0:0:0
5 - PSAPUNDO UNDO ONLINE LOCAL MANUAL NO 1/1
10240000 0.16 10223552 10240000 0 585 280
1664:1372160:1024128:851968:474112
6 - SYSAUX DATA ONLINE LOCAL AUTO NO 1/1
430080 94.23 24832 10240000 9809920 22 980
9920+:17344:1728:704:576
7 - SYSTEM DATA ONLINE LOCAL MANUAL NO 1/1
901120 99.38 5568 10240000 9338880 3 933
8880+:5056:448:64:0
Standard keys: c - cont, b - back, s - stop, r - refr, h - help
BR0662I Enter your selection:
Kindly advise for resolving the above issue . -
(10gR2)Full UNDO tablespace
(10gR2)Full UNDO tablespace
============================
PURPOSE
10gR2 에서 UNDO tablespace 을 NO AUTOEXTEND로 생성한 경우 ,
transaction 이 실행중인 database 에서는 UNDO tablespace 가
FULL인 현상을 보게 됩니다.
이는 10gR2 에서 max retention 을 보장하는 undo retention 의
메카니즘이 소개되어 autoextend off 인 경우의 UNDO tablespace
에서 나타나는 현상입니다.
dba_undo_extents 에서 많은 UNEXPIRED undo segment 가 보이는 것이
확인되고 UNDO tablespace 가 100% full 인것처럼 나타나는 현상을 볼 수
있으며 그럼에도 불구하고 ORA-1555 나 ORA-30036 에러는 발생하지 않습니다.
Explanation
다음과 같이 많은 UNEXPIRED undo segment 가 조회됩니다.
SQL> select count(status) from dba_undo_extents where status = 'UNEXPIRED';
COUNT(STATUS)
463
SQL> select count(status) from dba_undo_extents where status = 'EXPIRED';
COUNT(STATUS)
20
SQL> select count(status) from dba_undo_extents where status = 'ACTIVE';
COUNT(STATUS)
21
dba_free_space 을 조회 결과 UNDO tablespace 의 free space 가 존재합니다.
SUM(BYTES)/(1024*1024) TABLESPACE_NAME
3 UNDOTBS1
58.4375 SYSAUX
3 USERS3
4.3125 SYSTEM
103.9375 USERS04
Transaction 이 실행되면 UNDO tablespace 에 free space 가 조회되지 않는
FULL 인것처럼 보입니다.
SUM(BYTES)/(1024*1024) TABLESPACE_NAME
58.25 SYSAUX
98 USERS3
4.3125 SYSTEM
87.9375 USERS04
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
다음은 AUM 에서의 Undo Block 할당 알고리즘은 다음과 같습니다.
1. current extent 에 free block 이 있으면 다음 free block 이
할당됩니다.
2. 그러나, free block 이 없으면, next extent 가 expired 되었다면 next extent 을
warp 한후 그 next extent 의 처음 block 을 return 합니다.
3. 만약 next extent 가 expired 되지 않았다면 UNDO tablespace 로부터 먼저
space 을 찾습니다. 이때 free extent 가 존재한다면 이를 transaction table 에
할당하고 해당 next extent 의 첫번째 block 을 return 합니다.
4. 만약 UNDO tablespace 에 free extent 가 없다면 offline 된 transaction table
에서 steal 합니다.
offline 된 transaction table 에서 extent 을 deallocate 한후 이를
current transaction table 에 add한후 그 add 한 extent 의 첫번째 free block 을
return 합니다.
5. offline 된 transaction table 에서 찾을수 없으면 , online 되어 있는
transaction table 에서 steal 합니다. offline 된 transaction table 에서 extent 을
deallocate 한후 이를 current transaction table 에 add한후 , 그 add 한 extent 의
첫번째 free block 을 return 합니다.
6. 1번~5번 까지 하여도 free block 을 얻지 못하면 이제 UNDO tablespace 의 file 을
extend 합니다.
file 이 extend 된다면 이후 current transaction table 에 extent 을 add 한후 ,
그 extent 의 첫번째 free block 을 return 합니다.
7. 6번 에서 UNDO tablespace 의 file 을 extend 하지 못했다면 , 자기의 transaction table
에서 unexpired 된 extent 을 재사용합니다. 그런데 이때 모든 extent 가 busy 하다면
즉 모두 uncommitted 된 정보라면 8번으로 갑니다. 아니라면 wrap 하여 unexpired 된
extent 을 사용합니다.
8. offline 된 transaction table 에서 unexpired 된 extent 을 steal 합니다. 이것이
실패한다면 online 된 transaction table 에서 unexpired 된 extent 을 steal 합니다.
9. 8 번까지 수행하고도 free block 을 얻지 못하면 이때서야 오라클에서는
"ORA-30036 unable to extend segment by %s in undo tablespace '%s' " 에러를
뿌리며 실패합니다.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fixed size UNDO tablespace 라 함은 autoextend 가 off 라 datafile 을 자동으로
더 이상 확장할 수 없음을 말합니다.
autoextend 가 off 인 경우 10.2 부터는 max retention 이 36 시간 입니다.
undo_retention 을 900 초(15 분) 으로 설정을 한다고 해도 10gR2 에서는
max retention 이 36 시간이라 이에 해당하는 undo extent 을 UNEXPIRED 으로 만듭니다.
그러나 이것이 가용한 undo extent 가 없다는 것이 아니고 , transaction 이 실행되게 되면
UNEXPIRED undo segment 을 재사용하게 됩니다.
References
< Note 413732.1 - Full UNDO Tablespace In 10gR2 >A undo tablespace almost full is not necessarily a problem with Oracle 10g ... unless you have some ORA-XXXX errors in the database instance alert.log or in client programs connected to the instance. Is this the case ?
You should also have a look to V$UNDOSTAT which stores undo statistics for the last 7 days.
This view has also 2 interesting columns about possible errors related to undo space:
SOLDERRCNT NUMBER Identifies the number of times the error ORA-01555 occurred. You can use this statistic to decide whether or not the UNDO_RETENTION initialization parameter is set properly given the size of the undo tablespace. Increasing the value of UNDO_RETENTION can reduce the occurrence of this error.
NOSPACEERRCNT NUMBER Identifies the number of times space was requested in the undo tablespace and there was no free space available. That is, all of the space in the undo tablespace was in use by active transactions. The corrective action is to add more space to the undo tablespace. -
hi experts,
I would like to know what is the best tablespace "autoextend on next" size for the performance of the db?
oracle 11gR2 on redhat
users.dbf (is the only tablespace for tables) size is 330 gb
daily db growth is between 1 gb and 2 gb
tablespace ddl is:
CREATE BIGFILE TABLESPACE "USERS" DATAFILE
'path/users01.dbf' SIZE 268435456000
AUTOEXTEND ON NEXT 1310720 MAXSIZE 33554431M
LOGGING ONLINE PERMANENT BLOCKSIZE 8192
EXTENT MANAGEMENT LOCAL AUTOALLOCATE DEFAULT NOCOMPRESS SEGMENT SPACE MANAGEM
ENT AUTO
ALTER DATABASE DATAFILE
'path/users01.dbf' RESIZE 351655690240
do I undestand it right that the unit of "AUTOEXTEND ON NEXT 1310720" is byte?
this meand that the minimum autoextend size is 1,25 mb.
what is the maximum autoextend size per 1 autoextend operation? I havent found any info on this in the documentation.
how often should the autoextend operation happen for the good performance in the db with much DML ?
thanks in advance!920748 wrote:
1) there is a SYSTEM EVENT trigger available for extent allocation ?No.
2) the next (maybe increasing) extent size is predictable for segments in LM tablespaces with ALLOCATION_TYPE=SYSTEM ?Yes, it is predictable. The algorithm isn't published and potentially changes in different versions of Oracle. You can easily enough, though, create a test table, fill it with tons of data, and see the sizes of the extents. However, at the point that you want to do this, you're probably at a point where you shouldn't be using automatic extent allocation. If you want to be able to predict the size of the next extent, use uniform extents.
Here's an example from askTom that discusses the algorithm in Oracle 9.2.
3) Oracle will allocate smaller extents if the requested size is not available continuously?No.
I would like to check remaining tablespace after every extent allocationIt seems highly unlikely that you really want to do this sort of thing every time a new extent is allocated. Presumably, you know roughly how quickly your application's tables are supposed to grow. So, presumably, it's not terribly hard to ensure that you have, say, a month's worth of growth allocated as free space in the tablespace. If you keep a reasonable amount of free space around in general, you can then monitor the free space on a periodic basis (daily maybe even hourly) via a scheduled job and then add more free space at a convenient time whenever your free space drops below whatever threshold you set (in this example, a month). That should give you plenty of time between the threshold being tripped and the system actually running short of space and give you plenty of buffer in case you get swamped by a legitimate increase in activity.
Justin -
Auto Extend is on , but maximum file size is 3276MB
Dear Experts,
small Doubt , Auto Extend is on in my DB . it is automaticaly extending the table space when datafile is full , increment size is 10240 KB. but my doubt is what is maximum file size it is showing 3276MB . what happend if we reach there?
ArunYour datafile max size is set to 3276 mb (3.19GB).
Once your datafile reaches the specified limit, you need to add more space to tablespace by adding additional datafiles.
In your case you can set maxsize to unlimited by altering(For 8k block max size of datafile could be around 32 gb)
SQL> create tablespace autoextend datafile '+TEST' size 50m autoextend on maxsize 1g;
Tablespace created.
Created tablespace with datafile autoextend on and maxsize 1G;
SQL> select file_name,file_id from dba_data_files where tablespace_name='AUTOEXTEND';
FILE_NAME
FILE_ID
+TEST/clonev/datafile/autoextend.1346.790792253
139
SQL> select autoextensible,maxbytes/1024/1024/1024 "G" from dba_data_files where tablespace_name='AUTOEXTEND';
AUT Gb
YES 1
SQL> alter database datafile 139 autoextend on maxsize 2g;
Database altered.
SQL> select autoextensible,maxbytes/1024/1024/1024 "G" from dba_data_files where tablespace_name='AUTOEXTEND';
AUT G
YES 2
We changed maxsize from 1G to 2G
SQL> alter database datafile 139 autoextend on maxsize unlimited;
Database altered.
SQL> select autoextensible,maxbytes/1024/1024/1024 "G" from dba_data_files where tablespace_name='AUTOEXTEND';
AUT G
YES 31.9999847
You could see maxsize limit of 32GB,
you can check following note
What is The Maximum Datafile Size Limit In Oracle Database 10gR2 [ID 804733.1] -
(10g) 자동화된 UNDO RETENTION 튜닝
제품 : ORACLE SERVER
작성날짜 : 2004-05-17
PURPOSE
이 문서는 Oracle 10g 에서 자동화된 UNDO RETENTION 기능에 대하여
소개하는 자료이다.
Explanation
- Automatic tuning of undo retention in 10g.
Oracle 9i 에서는 ORA-1555 error가 가끔 발생하여 DBA가 이에 대한
조정을 해줄 필요가 있었다. 그러나, Oracle 10g 부터는 UNDO_RETENTION
에 대한 자동 튜닝 기능을 제공하게 되었다. 따라서, ORA-1555 에러가
발생하지 않도록 자동으로 UNDO RETENTION을 튜닝한다.
- Mandatory setting
1) UNDO_RETENTION=0 (10g: 이 파라미터 값을 0으로 해야 자동 활성화됨)
2) 반드시 SMU(System Managed Undo)를 사용해야 함.
- 자동 튜닝의 방식
UNDO_RETENTION을 0으로 셋팅하면 UNDO_RETENTION의 최소값은 900초가 된다.
즉 15분이다. MMON process가 매 30초마다 query duration을 계산한다.
MAXQUERYLEN 이라는 값을 계산하는데 이 값에 따라서 MMON은
TUNED_UNDORETENTION 이라는 수치를 결정한다. 이것은 새로운 UNDO
RETENTION 값이 TUNED_UNDORETENTION 로 셋팅이 됨을 의미한다.
계산 공식은 다음과 같다.
TUNED_UNDORETENTION = MAXQUERYLEN + 300 Sec.
Example
테스트를 위한 작업 순서는 다음과 같다.
1. 다음 SQL을 이용하여 TB1과 TB2 라는 두 개의 테이블을 생성한다.
create table tb1
(col1 number not null,
col2 number,
col3 number,
col4 number,
col5 char(10),
col6 date,
col7 char,
col8 real,
col9 float,
col10 float(10))
tablespace test1;
begin
for i in 1..250 loop
insert into tb1 values (6,1,3,1,'afdfaa','10-SEP-91','g',11.11,10.11,.11);
insert into tb1 values (7,34,1,23,'faaaa','12-AUG-91','h',11.1,1.11,1.1);
insert into tb1 values (8,91,17,1,'alkaa','10-AUG-87','i',6.11,31.11,0);
insert into tb1 values (9,0,8,1,'adfda','12-AUG-91','j',11.11,11.11,11.11);
insert into tb1 values (10,5,1,1,'advfaa','17-AUG-91','k',1.11,1.11,1111);
insert into tb1 values (11,5,67,1,'acva','13-AUG-91','l',1.11,13.11,13.11);
insert into tb1 values (12,7,1,3,'aadfa','14-AUG-90','m',11.11,11.11,11.11);
insert into tb1 values (13,9,4,1,'ajhka','10-AUG-55','n',11.11,11.41,31.11);
insert into tb1 values (14,1,1,3,'sdda','10-AUG-91','o',11.11,11.11,11.11);
insert into tb1 values (15,6,1,3,'sdd332','10-AUG-91','o',11.11,11.11,11.11);
end loop;
end;
create table tb2
(col1 number not null,
col2 number,
col3 number,
col4 number,
col5 char(10),
col6 date,
col7 char,
col8 real,
col9 float,
col10 float(10))
tablespace test2;
begin
for i in 1..250 loop
insert into tb2 values (16,100,100,100,'aaaa','10-AUG-95','a',111.11,11.11,11.11);
insert into tb2 values (27,200,200,200,'bb','11-AUG-95','b',221.22,22.22,22.22);
insert into tb2 values (38,300,300,300,'ccccccc','12-AUG-99','c',31.333,333.33,3333.3);
insert into tb2 values (40,400,400,400,'dddddddd','12-AUG-99','d',111.11,11.11,11.11);
insert into tb2 values (50,33,10000,1000,'aaa','10-AUG-94','f',11.11,111.11,321.11);
insert into tb2 values (60,1000,3000,10000,'afdfaa','10-SEP-97','g',111.11,144.11,.11);
insert into tb2 values (70,341,10,2310,'fghfgaaaa','12-AUG-98','h',11.1,11.11,1.1);
insert into tb2 values (80,0910000,1780,100,'aallkaa','10-AUG-89','i',611.11,311.11,0);
insert into tb2 values (90,0,80,1000,'adfda','12-AUG-96','j',11.11,11.11,111.11);
insert into tb2 values (100,51,10,1000000,'advfaa','17-AUG-97','k',11.11,11.11,1111);
end loop;
end;
2. 같은 test schema에서 다른 세션을 open한다.
3. test schema에게 DBA 권한을 부여한다.
4. 첫번 째 SESSION에서 다음 SELECT 문장을 수행한다.
SELECT TB1.*, TB2.*
FROM TB1, TB2
WHERE TB1.COL1 > TB2.COL1;
5. 두번 째 SESSION에서 위 4단계 수행후 2~5초 정도 후에 다음 명령을 수행한다.
alter system set "_smu_debug_mode" = 45;
set transaction use rollback segment "_SYSSMU3$";
set echo on;
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
set transaction use rollback segment "_SYSSMU3$";
update tb1 set col1 = col1;
commit;
6. "_SYSSMU3$" 의 사용량을 보기 위해 세번 째 SESSION을 OPEN한다.
7. 세번 째 SESSION에서 다음 query를 수행한다.
select tuned_undoretention, maxquerylen, maxqueryid from v$undostat;
결과는 다음과 같은 형태일 것이다.
===================================
TUNED_UNDORETENTION MAXQUERYLEN MAXQUERYID
2300 2000 gpxxh7pysj4fs
900 1 25z699hs9r3wy
900 1 2syxvjbg8d6s4
900 44 5scq3kj3rm7tz
MAXQUERYLEN 값과 계산된 TUNED_UNDORETENTION 값을 살펴보아야 한다.
(참고) 만약 관련된 query 문을 조회하려고 한다면 다음 SELECT 문을
수행하면 된다.
SQL> Select sql_text from v$sqltext
where sql_id = 'gpxxh7pysj4fs' /* MAXQUERYID value */
8. 다음 SQL 문을 이용하여 SMU 의 증가량을 확인한다.
SQL> select USN, RSSIZE, HWMSIZE, OPTSIZE, SHRINKS, segment_name
from v$rollstat, dba_rollback_segs
where usn=segment_id and segment_name like '%SMU3$';
USN RSSIZE HWMSIZE OPTSIZE SHRINKS SEGMENT_NAME
3 260096 522240 6 _SYSSMU3$
9. Step 5 아래에 있는 script를 반복해서 수행하고, step 8 의 SQL을
다시 반복 수행하면 SMU3 의 증가량을 확인할 수 있을 것이다.
(참고) 이와 같은 Automatic Undo Retention의 튜닝은 ORA-1555 ERROR
발생을 예방해준다. 그러나 undo tablespace가 autoextend off 이면
DML 수행 시 UNDO SPACE 부족과 같은 상황에 처할 수 있다.
UNDO tablespace의 사이즈가 부족하면 UNDO RETENTION 값이 줄어들 수 있다.
어떤 UNDO RETENTION을 가능하게 하기 위해서는 그 만큼의 UNDO 공간이
필요하다. Oracle 9i에서는 DBA가 직접 해주어야 했던 이런 고려를
Oracle Database 10g에서는 Oracle 서버가 대신 해준다.
Reference Documents
<Note:240746.1>Flashback Drop uses recycle bin...
make sure:
- you didn't create table on SYSTEM + SYSAUX tablespaces.
- You didn't use "purge" when you drop table " drop table xxx purge"
Example:
SQL> show parameter undo_retention
NAME TYPE VALUE
undo_retention integer 0
SQL> select table_name,tablespace_name from user_tables where table_name='TT';
TABLE_NAME TABLESPACE_NAME
TT USERS
SQL> drop table TT;
Table dropped.
SQL> desc TT
ERROR:
ORA-04043: object TT does not exist
SQL> FLASHBACK TABLE TT TO BEFORE DROP;
Flashback complete.
SQL> desc TT
Name Null? Type
OWNER NOT NULL VARCHAR2(30)
OBJECT_NAME NOT NULL VARCHAR2(30)
SUBOBJECT_NAME VARCHAR2(30)
Edited by: Surachart Opun (HunterX) on Aug 3, 2009 12:56 PM -
How to autoextend tablespace in Oracle 9i
Dear All,
I have currenctly a tablespace ABC. Database is failing to writing. I want to alter tablespace ABC and want to make its AUTOEXTEND ON. Could any body please suggest the SQL Query how to do this.
Regards,Hi,
It depends on what you really want to do .... Lets suppose that I want to enable autoextend feature on my datafile 4 below that belongs to tablespace ABC. I have some options:
SYS> select file_id,file_name from dba_data_files where tablespace_name='ABC';
FILE_ID FILE_NAME
4 C:\ORACLE\ORADATA\DB01\ABC01.DBF
SYS> alter database datafile 4 autoextend on maxsize unlimited;
Banco de dados alterado.
or
SYS> alter database datafile 'C:\ORACLE\ORADATA\DB01\ABC01.DBF' autoextend on next 5m maxsize 900m;
Banco de dados alterado.For more detailed information, you can take a look at documentation
Cheers
Legatti -
How to autoextend just one file from existing tablespace?
Hi,
I discover some of the tablespaces did not have autoexent feature, i.e. none of the datafiles have been autoextend features
so I need to autoextend it, hopefully the data file which has the most free space. So it would be good if I can come up with a query to find out which datafile belonging to a tablespace which currently has the highest free space could be selected for extend features,
To get me on the right track,
which dynamic views/data dictionary do I need to look up?
v$datafile/v_$datafile
dba_free_space
v$tablespace
when should I use v$datafile? when should I use v_$datafile.
thanks a lot!There seems to be some basic confusion.
AUTOEXTEND is not going to reuse the space within a data file; it is going acquire more space for the same file on the disk.
You can lookup dba_data_files.autoextensible column to check if your file is autoextensible or not.
when should I use v$datafile? when should I use v_$datafile.v$datafile is just a synonym for v_$datafile.
Maybe you are looking for
-
How to fix yahoo mail going to trash folder and not inbox?
Incoming email to my yahoo account (through Rogers) ends up in my trash folder and not my inbox. I do not have the same problem with my gmail account and email addressed there goes to the gmail inbox. Any advice on how to fix this problem? Thanks
-
Hi Everyone, When I downloaded the new iPhone iOS update, I lost most of the apps from my iphone screen. How do I add them back to my iPhone display? I plan to upgrade to the newer phone later this year. Thank you!
-
Cannot get VPN to work on 10.6
let me start by saying that whilst I have a computer background, and I can follow a simple set of "technical" instructions I am not hugely computer savvy when it comes to networking issues.. I have successfully used a connection to a VPN service, usi
-
Hi Experts, Is it standard behavior for VL10A to show two records when a Sales Document has been blocked? Their only difference is the field Delivery Block. In VL10A, the first record has a delivery block of BLANK, the second has 99. Here's how to re
-
Dear Nokia Support Team, I recently got my Lumia 710's screen repaired frm a NCC in India. After that the screen takes some time to show up after I press the on/off button. I am also sure that they have changed my phone's body bcoz my phone was in co