top of page
  • Black Facebook Icon
  • Black Twitter Icon
  • Black Instagram Icon
  • Black YouTube Icon

Oracle 10g Create Temporary Tablespace Syntax: Tips and Tricks for Optimizing Performance

  • gingferbadeticno
  • Aug 20, 2023
  • 5 min read


The Autoextend Maxsize clause will default to UNLIMITED if no value is specified. To create a locally managed tablespace specify 'EXTENT MANAGEMENT LOCAL'. If you set extent management to LOCAL UNIFORM, then you must ensure that each extent contains at least 5 database blocks. All extents of temporary tablespaces are the same size - if UNIFORM is not defined it will default to 1 MB.ExampleCREATE TEMPORARY TABLESPACE ts_temp TEMPFILE'/data/temp01.dbf' SIZE 500M,'/data/temp02.dbf' SIZE 500Mautoextend offextent management localUNIFORM SIZE 1m; There are two kinds of fool. One says, "This is old, and therefore good." And one says, "This is new, and therefore better" - John Brunner, The Shockwave Rider Related Oracle Commands: CREATE TABLESPACE DROP TABLESPACE ALTER DATABASE DEFAULT TEMPORARY TABLESPACE tablespace_name; Related Views:




oracle 10g create temporary tablespace syntax



Thank you that was helpful, I tried shrinking it never worked even after bouncing the database. I will rename the existing tablesapce to temp_old and create the new tablespace temp, that way you can keep the existing name.


Oracle 10g introduces a new data dictionary view, dba_tablespace_groups, for the temporary tablespace group. Using a tablespace with a temporary tablespace group will result in the following select statement. However, using a tablespace without a temporary tablespace group will not return the select statement below.


Although the data in a GTT is written to the temporary tablespace, the associated undo is still written to the normal undo tablespace, which is itself protected by redo, so using a GTT does not reduce undo and the redo associated with protecting the undo tablespace.


If you've read the previous section, you will already know the relationship between global temporary tables and redo. The data in a GTT is written to the temporary tablespace, which is not directly protected by redo, so using a GTT improves performance by reducing redo generation. Unfortunately, prior to Oracle 12c, all undo associated with DML against a GTT is written to the normal undo tablespace, which is itself protected by redo. As a result, using a GTT reduces the amount of redo generation, but does not eliminate it. Another why of describing this is, using a GTT removes direct redo generation, but not indirect redo generation cause by undo.


Oracle9i introduced the concept of a default temporary tablespace to prevent people accidentally using the SYSTEM tablespace for temporary segments. Oracle 10g takes this further by including a default permanent tablespace to prevent users having their default tablespace set to SYSTEM. The DEFAULT TABLESPACE clause in the CREATE DATABASE statement allows the the default tablespace to be created and named. If this parameter is not set during creation, or needs to be changed subsequently, it can be set using the following command.


If the tablespace is read-only the datafile headers are not altered to reflect the name change and a message is written to the alert log to notify you of this fact. The impact on recovery is that the tablespace will be recovered to it's old name if the controlfile is recreated and datafiles containing the old headers are used.


There is no theoretical maximum limit to the number of tablespaces in a tablespace group, but it must contain at least one. The group is implicitly dropped when the last member is removed. The last member of a group cannot be removed if the group is still assigned as the default temporary tablespace. In this example the following must be done to remove the last member from the group.


If the tablespace is smallfile, then you can't manage the underlying datafiles. To increase the tablespace size, add a new datafile. When you add a new data file, be sure that you choose the right values for AUTOEXTEND, SIZE, and MAXSIZE. These values can't be altered later. To reduce the size of the smallfile tablespace, create a new tablespace with the desired space and move all your data manually to the new tablespace.


By default, tablespaces are created with auto-extend enabled, and no maximum size. Because of these default settings, tablespaces can grow to consume all allocated storage. We recommend that you specify an appropriate maximum size on permanent and temporary tablespaces, and that you carefully monitor space usage.


To create a temporary tablespace on the instance store, use the Amazon RDS procedure rdsadmin.rdsadmin_util.create_inst_store_tmp_tblspace. The create_inst_store_tmp_tblspace procedure has the following parameters.


When you run rdsadmin_util.create_inst_store_tmp_tblspace, the newly created temporary tablespace is not automatically set as the default temporary tablespace. To set it as the default, see Setting the default temporary tablespace.


When you create a temporary tablespace on a primary DB instance, the read replica doesn't create tempfiles. Assume that an empty temporary tablespace exists on your read replica for either of the following reasons:


You can add a tempfile to the empty temporary tablespace, and store the tempfile in the instance store. To create a tempfile in the instance store, use the Amazon RDS procedure rdsadmin.rdsadmin_util.add_inst_store_tempfile. You can use this procedure only on a read replica. The procedure has the following parameters.


You can't drop an existing temporary tablespace on a read replica. You can change the tempfile storage on a read replica from Amazon EBS to the instance store, or from the instance store to Amazon EBS. To achieve these goals, do the following:


By default, Oracle tablespaces are created with auto-extend enabled and no maximum size. Because of these default settings, tablespaces can grow too large in some cases. We recommend that you specify an appropriate maximum size on permanent and temporary tablespaces, and that you carefully monitor space usage.


To resize the temporary space in a read replica for an Oracle DB instance, use either the rdsadmin.rdsadmin_util.resize_temp_tablespace or the rdsadmin.rdsadmin_util.resize_tempfile Amazon RDS procedure.


Viewed 10K+ times! This question is You Asked Hi Tom,Our application is using temporary table for processing intermediate results. I created temporary table for session.I created index on the temporary table.My questions are:1) Why this temporary table is created on SYSTEM table spaces with my ID as owner?2) Is the table not using temporary table space for storing data?3) The index on temporary table is created in the default tablespace of my Id. Why it is not created in temporary tablespace.4) I read in Oracle Manuals, that DML operation on temporary table will not create any redolog but the undo information (RBS) generates redolog which is required for Instance recovery.I used logminer to analyze the archived log file.I found the information of insert into temporary table and the username doing the insert operation as my Id.Why DML operations are generating redolog?I would appreciate if you can throw some light on the temporary table usage.Thanks in advance.Best Regards,Surya and Tom said...1) the temporary tablespace will allocate extents dynamically at runtime from the USERS temporary tablespace -- there is nothing in system (unless your temporary tablespace is in fact SYSTEM)Why do you think it is in system?2) it is. for example:tkyte@TKYTE816> create global temporary table foo 2 ( x int ) 3 /Table created.tkyte@TKYTE816>tkyte@TKYTE816> select table_name, tablespace_name 2 from user_tables where table_name = 'FOO';TABLE_NAME TABLESPACE_NAME------------------------------ ------------------------------FOOtkyte@TKYTE816>tkyte@TKYTE816> select temporary_tablespace 2 from dba_users 3 where username = user;TEMPORARY_TABLESPACE------------------------------TEMPtkyte@TKYTE816>tkyte@TKYTE816> insert into foo values ( 1 );1 row created.tkyte@TKYTE816> commit;Commit complete.tkyte@TKYTE816>tkyte@TKYTE816> alter tablespace temp offline;Tablespace altered.tkyte@TKYTE816>tkyte@TKYTE816> insert into foo values ( 1 );insert into foo values ( 1 )*ERROR at line 1:ORA-01542: tablespace 'TEMP' is offline, cannot allocate space in itthat shows that space is coming from my TEMP -- not system.3) it is -- why do you think its coming from system?tkyte@TKYTE816> create index foo_idx on foo(x);Index created.tkyte@TKYTE816> select index_name, tablespace_name from user_indexes where 2 index_name = 'FOO_IDX';INDEX_NAME TABLESPACE_NAME------------------------------ ------------------------------FOO_IDXtemporary stuff have no tablespace -- their extents from from the users temporary tablespace dynamically at runtime.4) they generate significantly LESS redo then real tables -- not "no redo". For example:scott@DEV816> create table t1 ( x int );Table created.scott@DEV816> create global temporary table t2 ( x int );Table created.scott@DEV816> set autotrace onscott@DEV816> insert into t1 select rownum from all_objects;23080 rows created.Statistics----------------------------------------------------------... 348116 redo size...scott@DEV816> insert into t2 select rownum from all_objects;23080 rows created.Statistics----------------------------------------------------------... 72508 redo size...The temporary table in this case geneate 1/5 the redo of the real table. Rating (20 ratings)Is this answer out of date? If it is, please let us know via a Comment Comments Comment 5 sessions of the same schema - global temporary tablesA reader, October 15, 2001 - 12:47 pm UTC 2ff7e9595c


 
 
 

Recent Posts

See All

Comentários


Contact

Representation

Commercial Agent

Magnum - Steven Macfee

Email - info@mysite.com

Tel - 123-456-7890

  • White Facebook Icon
  • White Twitter Icon
  • White Instagram Icon
  • White YouTube Icon

Manager

Bruce Robertson

Email - info@mysite.com

Tel - 123-456-7890

SF Agent

Pinnacle - Nathan Kelly

Email - info@mysite.com

Tel - 123-456-7890

© 2023 by Daniel Martinez. Proudly created with Wix.com

bottom of page