Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 07:25 AM
Guy Taylor
 
Posts: n/a
Default UNDO Tablespace, and how NOT to use

I have a situation where our UNDO TABLESPACE is filling up with data.
Our application creates a temporary table. It then creates several
indexes and runs dozens, if not hundreds of selects against the table.
The table is then dropped. The entire process may take an hour or two.

I am not an Oracle DBA, so I may get some of the terms wrong. I also
find this fascinating because it is very counterintuitive.

Our DBA tells me that the UNDO TABLESPACE has filled, or is close to
filling up. He can tell me what SQL has run recently, or has an active
or recent footprint in the UNDO TABLESPACE, but he cannot tell me how
much space each statement, or even each transaction is consuming. It
seems to be that this information should be available. If the
TABLESPACE is filling up, one would think the database system would
provide an interface to clean it up. Is this correct?

Secondly, the bulk of these queries are select statements. Why does a
select statement need UNDO space? If Oracle is using the UNDO space to
maintain a snapshot of the table for the query so that it has a
consistent view of the table (as opposed to locking it), then why
would the information remain in the UNDO TABLESPACE for hours? Once a
query (or transaction) is committed, wouldn't the database release its
resources from the UNDO TABLESPACE?

Thirdly, assuming that the database maintains information in the UNDO
TABLESPACE (so it can rollback select statements, I guess), and I run
up against the limit of the UNDO TABLESPACE size, is there any way, at
the beginning of a transaction or select statement that I can ask the
database to not use the UNDO TABLESPACE? In other words, the
application is constructed in such a way that the selected from table
is guaranteed not to change. Thus, there is no need to worry about
consistency or the data changing underneath me. How do I tell the
database to punt on the rollback infrastructure?

Thanks for any advice and I look forward to a discussion about how
this works.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 07:25 AM
hpuxrac
 
Posts: n/a
Default Re: UNDO Tablespace, and how NOT to use

On Aug 2, 8:25 pm, Guy Taylor <twopotsa...@gmail.com> wrote:
> I have a situation where our UNDO TABLESPACE is filling up with data.
> Our application creates a temporary table. It then creates several
> indexes and runs dozens, if not hundreds of selects against the table.
> The table is then dropped. The entire process may take an hour or two.
>
> I am not an Oracle DBA, so I may get some of the terms wrong. I also
> find this fascinating because it is very counterintuitive.
>
> Our DBA tells me that the UNDO TABLESPACE has filled, or is close to
> filling up. He can tell me what SQL has run recently, or has an active
> or recent footprint in the UNDO TABLESPACE, but he cannot tell me how
> much space each statement, or even each transaction is consuming. It
> seems to be that this information should be available. If the
> TABLESPACE is filling up, one would think the database system would
> provide an interface to clean it up. Is this correct?
>
> Secondly, the bulk of these queries are select statements. Why does a
> select statement need UNDO space? If Oracle is using the UNDO space to
> maintain a snapshot of the table for the query so that it has a
> consistent view of the table (as opposed to locking it), then why
> would the information remain in the UNDO TABLESPACE for hours? Once a
> query (or transaction) is committed, wouldn't the database release its
> resources from the UNDO TABLESPACE?
>
> Thirdly, assuming that the database maintains information in the UNDO
> TABLESPACE (so it can rollback select statements, I guess), and I run
> up against the limit of the UNDO TABLESPACE size, is there any way, at
> the beginning of a transaction or select statement that I can ask the
> database to not use the UNDO TABLESPACE? In other words, the
> application is constructed in such a way that the selected from table
> is guaranteed not to change. Thus, there is no need to worry about
> consistency or the data changing underneath me. How do I tell the
> database to punt on the rollback infrastructure?
>
> Thanks for any advice and I look forward to a discussion about how
> this works.


You might want to purchase and read Tom Kyte's latest book. It has a
thorough discussion of UNDO tablespaces.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-26-2008, 07:25 AM
DA Morgan
 
Posts: n/a
Default Re: UNDO Tablespace, and how NOT to use

Guy Taylor wrote:
> I have a situation where our UNDO TABLESPACE is filling up with data.


Determined by what means and how/why is that an issue?

> Our application creates a temporary table.


Do you mean a global temporary table or an imitation of a SQL Server
trick that kills performance and scalability?

> It then creates several
> indexes and runs dozens, if not hundreds of selects against the table.
> The table is then dropped. The entire process may take an hour or two.


You mean a SQL Server type temporary ... stop it. This is Oracle not
SQL Server and what you are doing is both unnecessary and bad practice.
Likely you need no intermediary table at all but should you need one
then you should use a global temporary table which is a permanent table
in which the data is temporary.

To stop duplicating SQL Server methodology get copies of Tom Kyte's
books and read the sections that relate to temporary tables and general
concepts and architecture.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 07:25 AM
Martin T.
 
Posts: n/a
Default Re: UNDO Tablespace, and how NOT to use

Guy Taylor wrote:
> I have a situation where our UNDO TABLESPACE is filling up with data.
> (...)
> Thanks for any advice and I look forward to a discussion about how
> this works.
>


That mysterious book they are referring to would be:
Thomas Kyte, Expert Oracle Database Architecture ... he does have a
chapter dedicated to Redo and Undo.

You might also like to check asktom.oracle.com, as I am pretty sure he
may have answered related questions there.

Welcome to the friendly world of Oracle.
br,
Martin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-26-2008, 07:25 AM
Helma
 
Posts: n/a
Default Re: UNDO Tablespace, and how NOT to use

"I have a situation where our UNDO TABLESPACE is filling up with
data."

Tell us how that is a problem.

For the rest of your post: your questions can't be answered without
getting
into the concepts of oracle. If you would really want to know, do
yourself
a favor and buy the mentioned book by Thomas Kyte. This outstanding
book
is aimed at bridging the gap between the DBA and the programmers.

H.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-26-2008, 07:26 AM
Guy Taylor
 
Posts: n/a
Default Re: UNDO Tablespace, and how NOT to use

I bought the book this AM.

I know the UNDO tablespace filling up is a problem because the Oracle
DBA insists it is. If there is no downside to this tablespace filling
up, then I have been mislead. Perhaps my terminology is wrong
regarding the "temporary" table. I create a table in the schema's
tablespace, run queries against it, and then drop it when I am done.
Thus, perhaps it is not a "temporary table" as defined in the
literature.

Regardless, I hope the chapter about the UNDO tablespace in the book
can illustrate how to construct queries, or form transactions, that do
not leverage the UNDO tablespace. This should keep my DBA from adding
gigs and gigs of space to the tablespace.

Also, thanks for all the responses. They were very helpful.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-26-2008, 07:26 AM
Cristian Cudizio
 
Posts: n/a
Default Re: UNDO Tablespace, and how NOT to use

Guy Taylor wrote:
> I bought the book this AM.
>
> I know the UNDO tablespace filling up is a problem because the Oracle
> DBA insists it is. If there is no downside to this tablespace filling
> up, then I have been mislead. Perhaps my terminology is wrong
> regarding the "temporary" table. I create a table in the schema's
> tablespace, run queries against it, and then drop it when I am done.
> Thus, perhaps it is not a "temporary table" as defined in the
> literature.
>
> Regardless, I hope the chapter about the UNDO tablespace in the book
> can illustrate how to construct queries, or form transactions, that do
> not leverage the UNDO tablespace. This should keep my DBA from adding
> gigs and gigs of space to the tablespace.
>
> Also, thanks for all the responses. They were very helpful.
>


Maybe that both you and your dba have to read carefully Tom's book.
Why do you say that UNDO tablespace filling up is a problem ??????
it is there for this Oracle manages UNDO space automatically (i you use
a version on this century) and that space is needed. Does it costs more
a GigaByte of disk occupied by UNDO or days of your time spent to try
not to use to much UNDO? It makes no sense, Thomas Kyte explains all
very well in his book, so please read carefully his book and make your
DBA read it and only after that came here to say us that UNDO tablespace
filling up is a problem

regards
--
Cristian Cudizio

http://oracledb.wordpress.com
http://cristiancudizio.wordpress.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-26-2008, 07:26 AM
DA Morgan
 
Posts: n/a
Default Re: UNDO Tablespace, and how NOT to use

Guy Taylor wrote:
> I bought the book this AM.
>
> I know the UNDO tablespace filling up is a problem because the Oracle
> DBA insists it is.


I wouldn't be so sure. <g>

> If there is no downside to this tablespace filling
> up, then I have been mislead.


Quite possibly.

> Perhaps my terminology is wrong
> regarding the "temporary" table. I create a table in the schema's
> tablespace, run queries against it, and then drop it when I am done.


That is what we understood and NEVER ... EVER ... do that in Oracle. It
is completely unnecessary under all conditions and kills scalability and
performance.

You do that in SQL Server as a work around for poorly designed locking
and transaction handling going back to its roots in Sybase and Ingres:
But not here.

> Thus, perhaps it is not a "temporary table" as defined in the
> literature.


Not in Oracle. It is a permanent table being built on-the-fly and it is
painful. It contains no indexes, the optimizer knows nothing about it,
and the overhead of creating and dropping it beyond your imagination.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-26-2008, 07:26 AM
Brian Peasland
 
Posts: n/a
Default Re: UNDO Tablespace, and how NOT to use

Just to add to the other information posted in this thread...


> Our DBA tells me that the UNDO TABLESPACE has filled, or is close to
> filling up. He can tell me what SQL has run recently, or has an active
> or recent footprint in the UNDO TABLESPACE, but he cannot tell me how
> much space each statement, or even each transaction is consuming. It
> seems to be that this information should be available. If the
> TABLESPACE is filling up, one would think the database system would
> provide an interface to clean it up. Is this correct?


As has been stated, how does the DBA verify that the Undo ts has been
"filled up"? One may query DBA_SEGMENTS or DBA_FREE_SPACE and see
allocated space with no free space in the tablespace, but that does not
mean that the extents do not have free space.

Oracle will clean up any unneeded undo records automatically. There is
no interface for you to tell Oracle to clean up undo records manually.

> Secondly, the bulk of these queries are select statements. Why does a
> select statement need UNDO space? If Oracle is using the UNDO space to
> maintain a snapshot of the table for the query so that it has a
> consistent view of the table (as opposed to locking it), then why
> would the information remain in the UNDO TABLESPACE for hours? Once a
> query (or transaction) is committed, wouldn't the database release its
> resources from the UNDO TABLESPACE?


The SELECT statement does not actually create nor require undo records
to be in the UNDO tablespace. However, if DML has occurred on the block
that the SELECT statement accesses, the undo records are used to
generate a read-consistent image of the block.

The length of time that the undo records are kept in the undo tablespace
is determined by the UNDO_RETENTION initialization parameter. If the DBA
has defined this parameter to store hours of undo records, then the undo
will stick around for that amount of time. Once a transaction is
committed, the undo will still remain for UNDO_RETENTION seconds. This
is to support certain Flashback operations.

> Thirdly, assuming that the database maintains information in the UNDO
> TABLESPACE (so it can rollback select statements, I guess), and I run
> up against the limit of the UNDO TABLESPACE size, is there any way, at
> the beginning of a transaction or select statement that I can ask the
> database to not use the UNDO TABLESPACE? In other words, the
> application is constructed in such a way that the selected from table
> is guaranteed not to change. Thus, there is no need to worry about
> consistency or the data changing underneath me. How do I tell the
> database to punt on the rollback infrastructure?


If the UNDO_MANAGEMENT initialization parameter is set to AUTO, then you
cannot bypass the undo mechanism.

One thing that has not been stated is that if there is not enough space
in the Undo tablespace to store undo records for UNDO_RETENTION seconds,
then this can cause problems. If the Undo tablespace is too small, some
queries may see the Snapshot Too Old error (ORA-1555). If you are not
seeing this error, then it is highly likely that your Undo tablespace is
not too small. Things change in Oracle 10g if the DBA has defined the
Undo tablespace with RETENTION GUARANTEE in which case if the Undo ts is
too small, DML statements may not have anywhere to write undo records.
Appropriate sizing of the Undo tablespace is required.


HTH,
Brian


--
================================================== =================

Brian Peasland
dba@nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown

--
Posted via a free Usenet account from http://www.teranews.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-26-2008, 07:26 AM
Anurag Varma
 
Posts: n/a
Default Re: UNDO Tablespace, and how NOT to use

On Aug 3, 9:39 am, Guy Taylor <twopotsa...@gmail.com> wrote:
> I bought the book this AM.
>
> I know the UNDO tablespace filling up is a problem because the Oracle
> DBA insists it is. If there is no downside to this tablespace filling
> up, then I have been mislead. Perhaps my terminology is wrong
> regarding the "temporary" table. I create a table in the schema's
> tablespace, run queries against it, and then drop it when I am done.
> Thus, perhaps it is not a "temporary table" as defined in the
> literature.
>
> Regardless, I hope the chapter about the UNDO tablespace in the book
> can illustrate how to construct queries, or form transactions, that do
> not leverage the UNDO tablespace. This should keep my DBA from adding
> gigs and gigs of space to the tablespace.
>
> Also, thanks for all the responses. They were very helpful.


Ask your DBA to explain clearly why undo tablespace filling up is a
problem?
For example if you are running 10GR2 and have a fixed sized undo
tablespace,
then oracle automatically (by default setting) tries using up 85% of
space.

http://download.oracle.com/docs/cd/B...htm#sthref1484

As such, undo filling up is not usually an issue unless you are
encountering
out of space issues ... and/or ORA-1555's...

Anurag

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:02 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565