Shrinking a Locally Managed Temporary Tablespace

So, even thoguh the documentation is pretty clear about how to use this feature, I cannot get it to do what I expect it to do for me.
And that would be shrinking the tempfile ;)
Now lets face it, I have a large tempfile and want to resize it without restarting the database:
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Di Nov 20 05:49:59 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
SQL> select file_name
, ceil(bytes / 1024 / 1024) "size MB"
from dba_temp_files
FILE_NAME size MB
R:\MXVC01\TEMP01.DBF 31,231
SQL> select su.username
, ses.sid
, ses.serial#
, su.tablespace
, ceil((su.blocks * dt.block_size) / 1048576) MB
from v$sort_usage su
, dba_tablespaces dt
, v$session ses
where su.tablespace = dt.tablespace_name
and su.session_addr = ses.saddr
USERNAME SID SERIAL# TABLESPACE MB
VPXADMIN 15 15 TEMP 14
VPXADMIN 17 5 TEMP 1,203
VPXADMIN 17 5 TEMP 1
VPXADMIN 18 3 TEMP 7
VPXADMIN 19 3 TEMP 1
VPXADMIN 144 3 TEMP 1
VUMADMIN 156 2597 TEMP 1
7 rows selected.
Or this one:
SQL> select tablespace_size/1024/1024 "tablespace_size mb"
, allocated_space/1024/1024 "allocated_space mb"
, free_space/1024/1024 "free_space mb"
from dba_temp_free_space
tablespace_size mb allocated_space mb free_space mb
31230,9922 1228,99219 30002
Documetation from here: http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces007.htm#ADMIN12353
+"Shrinking a Locally Managed Temporary Tablespace+
+Large sort operations performed by the database may result in a temporary tablespace growing and occupying a considerable amount of disk space. After the sort operation completes, the extra space is not released; it is just marked as free and available for reuse. Therefore, a single large sort operation might result in a large amount of allocated temporary space that remains unused after the sort operation is complete. For this reason, the database enables you to shrink locally managed temporary tablespaces and release unused space.+
+You use the SHRINK SPACE clause of the ALTER TABLESPACE statement to shrink a temporary tablespace, or the SHRINK TEMPFILE clause of the ALTER TABLESPACE statement to shrink a specific tempfile of a temporary tablespace. Shrinking frees as much space as possible while maintaining the other attributes of the tablespace or tempfile. The optional KEEP clause defines a minimum size for the tablespace or tempfile.+
+Shrinking is an online operation, which means that user sessions can continue to allocate sort extents if needed, and already-running queries are not affected.+
+The following example shrinks the locally managed temporary tablespace lmtmp1 to a size of 20M.+
+ALTER TABLESPACE lmtemp1 SHRINK SPACE KEEP 20M;+
+The following example shrinks the tempfile lmtemp02.dbf of the locally managed temporary tablespace lmtmp2. Because the KEEP clause is omitted, the database attempts to shrink the tempfile to the minimum possible size.+
+ALTER TABLESPACE lmtemp2 SHRINK TEMPFILE '/u02/oracle/data/lmtemp02.dbf';"+
OK, lets do it:
SQL> alter tablespace temp shrink tempfile 'R:\MXVC01\TEMP01.DBF';
alter tablespace temp shrink tempfile 'R:\MXVC01\TEMP01.DBF'
ERROR at line 1:
ORA-03214: File Size specified is smaller than minimum required
It seems there is a bug? Should I report it, or is it the expected behaviour?
Now lets try this one:
SQL> alter tablespace temp shrink tempfile 'R:\MXVC01\TEMP01.DBF' keep 2048M;
Tablespace altered.
SQL> select file_name
, ceil(bytes / 1024 / 1024) "size MB"
from dba_temp_files
FILE_NAME size MB
R:\MXVC01\TEMP01.DBF 31,231
So .... this lasts about *10 minutes*, and nothing changes?
It seems there is a bug? Should I report it, or is it the expected behaviour?
Could someone enlighten me, what this SHRINK is actually doing?
Is it worth to report this as bug, if not a software bug it is at least a documentation bug because it doesn't mention under which conditions it is working?
P.S.: OMG the posting looks terrible, who's the one to blame for this forum software where it is not possible to use fixed size fonts, or format paragraphs as code, or what about the fact that the forum software is using default SQLPlus output as META for some graphical lines?
Isn't this the forum for Oracle Database users?
Edited by: Gerrit Haase on 20.11.2012 13:44

So, you are kidding with me? No? Who are you?
How can I block users here? Is there a moderator present at this forum?
Maybe you read my initial post again?
I didn't look at the wrong place.
I reported you for general abuse.
SQL> define
DEFINE _DATE           = "20.11.12" (CHAR)
DEFINE CONNECTIDENTIFIER = "MXVC01" (CHAR)
DEFINE _USER           = "SYS" (CHAR)
DEFINE _PRIVILEGE      = "AS SYSDBA" (CHAR)
DEFINE SQLPLUSRELEASE = "1102000200" (CHAR)
DEFINE _EDITOR         = "Notepad" (CHAR)
DEFINE OVERSION = "Oracle Database 11g Release 11.2.0.2.0 - 64bit Production" (CHAR)
DEFINE ORELEASE = "1102000200" (CHAR)
SQL> SELECT * FROM dba_temp_free_space;
TABLESPACE_NAME TABLESPACE_SIZE ALLOCATED_SPACE FREE_SPACE
TEMP 3,2748E+10 1306517504 3,1443E+10
SQL> select TABLESPACE_SIZE/power(2,20), ALLOCATED_SPACE/power(2,20), FREE_SPACE/power(2,20) from dba_temp_free_space ;
TABLESPACE_SIZE/POWER(2,20) ALLOCATED_SPACE/POWER(2,20) FREE_SPACE/POWER(2,20)
31230,9922 1245,99219 29986
SQL> ALTER TABLESPACE temp SHRINK SPACE;
Tablespace altered.
SQL> select TABLESPACE_SIZE/power(2,20), ALLOCATED_SPACE/power(2,20), FREE_SPACE/power(2,20) from dba_temp_free_space ;
TABLESPACE_SIZE/POWER(2,20) ALLOCATED_SPACE/POWER(2,20) FREE_SPACE/POWER(2,20)
31230,9922 1244,99219 *29986*
R:\mxvc01>dir temp
Volume in drive R is Disk_R
Volume Serial Number is 248B-61D4
Directory of R:\mxvc01
20.11.2012 08:09 32.748.077.056 TEMP01.DBF
1 File(s) 32.748.077.056 bytes
0 Dir(s) 8.259.297.280 bytes free
SQL> alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF';
alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF'
ERROR at line 1:
ORA-03214: File Size specified is smaller than minimum required
*It clearly says that there is 29986 MB Space FREE and the above shrink space changes nothing and so does shrink tempfile:*
SQL> alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF';
alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF'
ERROR at line 1:
ORA-03214: File Size specified is smaller than minimum required
SQL> alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF' KEEP 20M;
Tablespace altered.
R:\mxvc01>dir temp
Volume in drive R is Disk_R
Volume Serial Number is 248B-61D4
Directory of R:\mxvc01
20.11.2012 08:24 32.748.077.056 TEMP01.DBF
1 File(s) 32.748.077.056 bytes
0 Dir(s) 8.259.280.896 bytes free
*... nothing changes, the tempfile isn't smaller now ...*

Similar Messages

  • Local Management of Tablespace - Help

    We are using oracle 8i std edition on solaris. We want to create a locally
    managed tablespace for a particular schema. The objects of this schema
    will be imported every day from the same schema on another same database server.
    The existing schema tablespace is locally managed with system allocation type.
    1.We want to know what are the points to be kept in mind while creating a locally
    managed tablespace in the new db.
    2. Should the tablespace have a single datafile or more than one(The existing one has
    3 datafiles)? Which one is better? (There will be no activity on this new db as it is
    for standby only. If the existing one fails, this db will be used.
    4. Since we are going to export from the existing one and import into the new db schema
    every day ( the schema in the new db will be dropped and recreated daily before import),
    will there be any problems that we will encounter by doing so?
    Please let me know all the information so that we do not face any problem after
    implementing this.
    Note: Currently the failover schema tablespace is dictionary managed and we plan to
    entirely drop this tablespace and create a new one by the same name but locally managed
    this time. So what steps to be taken while dropping the tablespace and creating a new one
    by the same name? Will there be any problems because of this? Is a db restart required
    after this? Kindly enlist the points and steps.
    We appreciate your immediate help.

    93469, to answer some of your questions:
    1- You need to determine if the new tablespace should be locally managed using uniform extents or autoallocate. The answer should probably be based on how much variation exists between the current object sizes (used allocation). If you have a lot of very small tables and a few large one then autoallocate may be a better choice that uniform extents.
    2- Why use three files if one will do? You should have a file management policy about file sizes and allocations so you should follow it.
    3- The best way to answer this question is to try the import and find out. There are some imp/exp bugs in 8.1 but since your tablespace names will match you will avoid the only one that comes to mind. Tables with LOB objects imported into a db where the target tablespace does not exist so that the table defaults to the owner default tablespace will fair if the LOB segment tablespace points to a non-existing tablespace since Oracle development failed to default it also. But if you do not have LOB segments this is not an issue. Come to think of it I do not think you can import a table with a LOB table into an autoallocate tablespace in version 8.1.
    HTH -- Mark D Powell --

  • TEMPORARY TABLESPACE에서, TEMPFILE을 사용할지, DATAFILE을 사용 할지 결정에 필요한 지침

    제품 : ORACLE SERVER
    작성날짜 : 2003-02-24
    TEMPORARY TABLESPACE에서, 임시 파일을 사용할지, 데이터파일을 사용 할지 결정에 필요한 지침
    ===========================================================================================
    PURPOSE
    이 문서는, TEMPORARY TABLESPACE에서 임시 파일과 데이터파일의 차이점을
    소개하는 데 목적이 있다.
    Explanation
    | TEMPORARY | Tablespace |
    | tablespace | TEMPORARY |
    | Locally | Dictionary |
    | managed | managed |
    | Datafiles | impossible | Y |
    | Tempfiles | Y | impossible |
    ------------------------------------------+
    다른 조합은 허용되지 않는다.
    1. TEMPORARY Tablespace / Tablespace TEMPORARY 와 PERMANENT tablespace 비교
    1) Tablespace TEMPORARY는 오라클 7.3 이상 버젼에서 사용가능하다.
    => Tablespace TEMPORARY는 다음과 같은 명령을 사용하여 생성한다.
    CREATE TABLESPACE .. TEMPORARY
    이 경우 데이터파일만을 사용한다.
    2) TEMPORARY tablespac는 오라클 8i 이상 버젼에서 사용 가능하다
    => TEMPORARY tablespace는 다음과 같은 명령을 사용하여 생성한다
    CREATE TEMPORARY TABLESPACE .. TEMPFILE
    이 경우 tempfile만 사용할 수 있다.
    3) Tablespace TEMPORARY/TEMPORARY tablespace는 DBA_TABLESPACES의
    CONTENTS 값이 TEMPORARY로 나타난다.
    4) Tablespace TEMPORARY/TEMPORARY tablespace 는 PERMANENT
    tablespace와 다르며 (DBA_TABLESPACES.CONTENTS 값이 PERMANENT임)
    permanent segment를 생성 할 수 없다. 예를 들어, permanent table이나
    index, cluster, rollback segment등을 Tablespace TEMPORARY/TEMPORARY
    tablespace에 생성할 수 없다.
    5) Tablespace TEMPORARY/TEMPORARY tablespace 에서는, 단일한
    temporary segment를 제공하며, 이 세그먼트는 다음과 같은
    요구사항을 가진 모든 사용자에 의해 공유된다.
    => sort 작업에 따른 sort extents를 필요로 하는 사용자
    => GLOBAL TEMPORARY TABLE에 필요한 temporary extents
    이와 같은 고유한 temporary segment는 동시에 많은 양의 sort 작업이
    수행되거나, 여러 트랜잭션이 동일한 temporary table을 사용할 때,
    permanent tablespace에서 작업하는 overhead를 피하고, 오라클의
    공간 관리 작업의 부하를 피하는데 도움을 준다.
    6) Temporary segment는 인스턴스 구동후 사용자가 sort extent나
    sort run, 또는 global temporary table 생성등의 요청에 따라
    자동적으로 생성된다.
    7) Temporary segment는 인스턴스 shutdown시 자동적으로 drop 된다.
    8) Temporary Content를 저장하는 테이블스페이스에 대한
    세그먼트의 공간 할당/할당 해제 관련 정보는 V$SORT_SEGMENT와
    V$SORT_USAGE 뷰를 사용하여 확인해 볼 수 있으며, sort segment
    등에 현재 sort를 진행하는 사용 정보를 보여준다.
    9) 위와 같은 작업을 수행하는데 PERMANENT tablespace 보다는
    tablespace TEMPORARY를 사용하는 것이 유리한 점은 <Bulletin No:
    11938>에 자세히 기술되어 있따.
    10) 오라클 8i에서는, 사용자별 default temporary tablespace가 어떤
    종류라도 상관이 없으나, PERMANENT locally managed 방식의 테이블
    스페이스는 지정할 수 없다. 다음은 PERMANENT locally managed 방식의
    테이블스페이스를 default temporary tablespace로 지정하여 발생하는
    에러이다.
    SQL> alter user x temporary tablespace PERM_LOCAL;
    User altered.
    SQL> select * from dba_tables order by 3,2,6,4,7,9,1,5;
    select * from dba_tables order by 3,2,6,4,7,9,1,5
    ERROR at line 1:
    ORA-03212: Temporary Segment cannot be created in locally-managed tablespace
    오라클 9i에서는 사용자별 default temporary tablespace가
    어떤 TEMPORARY 타입이라도 무방하다.
    => TEMPORARY tablespace locally managed
    => tablespace TEMPORARY dictionary managed
    PERMANENT locally-managed 타입의 테이블스페이스를 사용자의
    TEMPORARY tablespace으로 지정할 때 다음과 같은 에러가 발생한다.
    SQL> alter user x temporary tablespace PERM_LOCAL;
    alter user x temporary tablespace PERM_LOCAL
    ERROR at line 1:
    ORA-12911: permanent tablespace cannot be temporary tablespace
    2. TEMPORARY Tablespace/Tempfiles 대비 Tablespace TEMPORARY/Datafile
    1) 공간관리
    공간 관리는, locally managed tablespace에서 훨씬 단순하고, 또
    효율적이기 때문에, TEMPORARY tablespace를 사용하는 것이
    바람직하다. Local managedment 방식에서 사용 가능한 유일한
    방식이 temporary tablespace 방식이다.
    SQL> create tablespace temp1
    2 DATAFILE '/ora/ora817/32/oradata/V817/temp1.dbf' size 100M
    3 TEMPORARY
    4 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;
    create tablespace temp1
    ERROR at line 1:
    ORA-25144: invalid option for CREATE TABLESPACE with TEMPORARY contents
    Dictionary-managed tablespace 대비 locally-managed tableapce의 장점은
    <Bulletin No: 18261>에 자세히 기술되어 있다.
    오라클 8i에서는, sort segment가 locally managed permanent tablespace에
    생성될 수 없으므로, locally managed TEMPORARY tablespace를 사용하여야
    한다.
    Locally managed temporary tablespace는 tempfile을 사용하며, temporary
    tablespace 바깥 데이터에 전혀 영향을 주지 않으면서, temporary tablespace
    관련 데이터에 대한 redo정보가 생성되지 않는다.
    이 테이블스페이스는, standby database나 read-only database에서도
    사용 가능하다.
    2) View
    TEMPORARY tablespace 와 연관된 파일 목록은 V$TEMPFILE 과
    DBA_TEMP_FILES 뷰를 통해 확인할 수 있다.
    SQL> select * from dba_tablespaces;
    TABLESPACE_NAME CONTENTS EXTENT_MAN
    TEMP_TEMPFILE_LOCAL TEMPORARY LOCAL
    TEMP_DATAFILE_DICT TEMPORARY DICTIONARY
    SQL> select STATUS, ENABLED, NAME from v$tempfile;
    STATUS ENABLED NAME
    ONLINE READ WRITE /tcase/oradata/V901/temp_temp01.dbf
    SQL> select FILE_NAME, TABLESPACE_NAME from dba_temp_files;
    FILE_NAME TABLESPACE_NAME
    /tcase/oradata/V901/temp_temp01.dbf TEMP_TEMPFILE_LOCAL
    위 내용은 tablespace TEMPORARY 환경에서 V$DATAFILE 와
    DBA_DATA_FILES를 사용하는 것에 비길 수 있다.
    SQL> select STATUS, ENABLED, NAME from v$datafile;
    STATUS ENABLED NAME
    ONLINE READ WRITE /tcase/oradata/V901/temp_data01.dbf
    SQL> select FILE_NAME, TABLESPACE_NAME from dba_data_files;
    FILE_NAME TABLESPACE_NAME
    /tcase/oradata/V901/temp_data01.dbf TEMP_DATAFILE_DICT
    3) 권한
    Temporary tablespace 또는 tablespace temporary 생성을 위해서는
    CREATE TABLESPACE system privilege가 필요하다.
    4) TEMPORARY Tablespace 생성
    SQL> create TEMPORARY tablespace temp_tempfile_local
    2 TEMPFILE '/ora/V817/temp_temp.dbf' size 100M
    3 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;
    참고: 일부 OS에서는 tempfile block이 실제 액세스 되기
    전 까지 tempfile이 실제로 생성되지 않는다. 이와 같은
    파일 생성 작업이 지체되어 처리 되는 것은, tempfile의
    생성과 크기 조정이 신속하게 처리되는데 도움이 된다.
    그러나, tempfile이 나중에 생성되더라도, 생성 가능한
    충분한 디스크 공간이 있어야 하겠다.
    사용중인 O/S에서 tempfile이 실제 생성되는 시점은
    플랫폼별 매뉴얼에 기술되어 있다.
    Tablespace TEMPORARY의 생성
    SQL> create tablespace TEMP_DATAFILE_DICT
    2 datafile '/tcase/oradata/V901/temp_data.dbf' size 100M
    3 TEMPORARY;
    Tablespace created.
    5) Tempfile/Datafile 제거
    a. 테이블스페이스를 drop 하기 전까지 테이블스페이스의 datafile을
    제거할 수 없다.
    참고: 오라클 9i에서 DROP TABLESPACE 명령에 추가된
    INCLUDING CONTENTS AND DATAFILES 절을 사용하면, OS로 부터
    관련 데이터파일도 삭제하는 작업을 자동화 할 수 있다.
    b. Temporary tablespace로 부터 tempfile을 삭제하고, 논리 구조를
    비어 있는 상태로 유지할 수 있다.
    => 오라클 8i:
    SQL> alter tablespace TEMP_TEMPFILE_LOCAL
    2 add tempfile '/oradata/V817/temp_temp01.dbf';
    Tablespace altered.
    SQL> alter database tempfile '/oradata/V817/temp_temp01.dbf'
    2 drop;
    Database altered.
    SQL> !ls /oradata/V817/temp_temp01.dbf
    /oradata/V817/temp_temp01.dbf
    위 명령을 수행 한 후, tempfile을 시스템으로 부터 삭제하고,
    나중에 다시 추가 시킬 수 있다.
    SQL> alter tablespace TEMP_TEMPFILE_LOCAL
    2 add tempfile '/oradata/V817/temp_temp01.dbf';
    Tablespace altered.
    => 오라클 9i: OS 파일을 삭제 하기 위해 INCLUDING DATAFILES
    절을 사용할 수 있다.
    SQL> alter database tempfile '/oradata/V901/temp_temp01.dbf'
    2 drop including datafiles;
    Database altered.
    SQL> !ls /oradata/V901/temp_temp01.dbf
    /oradata/V901/temp_temp01.dbf not found
    Temporary tablespace로 부터 모든 tempfile을 삭제하면,
    다음과 같은 에러가 발생할 수 있다.
    SQL> alter table olap.test add primary key (c);
    alter table olap.test add primary key (c)
    ERROR at line 1:
    ORA-25153: Temporary Tablespace is Empty
    ORA-25153
    25153, 00000, "Temporary Tablespace is Empty"
    // *Cause: An attempt was made to use space in a temporary tablespace with
    // no files.
    // *Action: Add files to the tablespace using ADD TEMPFILE command.
    이 에러 메시지는 동시 작업 수행시 디스크를 실제 액세스 하여야
    할 경우 발생하게 된다.
    Example
    Reference Documents
    <Note:132663.1> ORA-03296 Resizing Temporary Locally Managed Tablespace
    <Note:131769.1> ORA-03212 at Instance Startup
    <Note:102339.1> Temporary Segments: What Happens When a Sort Occurs
    <Note:160426.1> TEMPORARY Tablespaces : Tempfiles or Datafiles

  • Temporary Tablespace Sizing and SNOTE 164925

    Hi All,
    I am facing a dilemma when I look into the temporary tablespace setting.
    I have gone thru the SNOTE 164925, for the sizing parameters of PSAPTEMP.
    There is a calculation on the note for selecting initial extent next extent etc.....
    My PSAPTEMP is locally managed and having default initial extent value of 1 MB but as per the calculation given on SNOTE 164925 solution section.
    But the point is in the How Can I check the specified value section on the same note it says....
    "As of Oracle 8i, SAP recommends using the assignment of locally managed
    temporary tablespaces (see Notes 659946 and 662900). This means that when
    problems with a 'dictionary managed' temporary tablespace occur, you should
    change to a 'locally managed' temporary tablespace instead of optimizing
    the settings of the 'dictionary managed' temporary tablespace."
    Now my question is whther I should still go with the default value or with the new values as per the formula given in the same note.
    I am using Oracle 10g behind SAPR3 4.6D
    Regards,
    Soumen

    Hello Soumen,
    to be honest - i don't really understand your question / problem.
    Just use locally managed temporary tablespace and set an uniform size.
    The values initial, next and pctincrease doesn't matter in this case. Set the uniform size to 1 - 5 MB.
    As you told us you are using oracle 10g .. just check the documenation:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7003.htm#CJAIDDDB
    Specify LOCAL if you want the tablespace to be locally managed. Locally managed tablespaces have some part of the tablespace set aside for a bitmap. This is the default for permanent tablespaces. Temporary tablespaces are always automatically created with locally managed extents.
    AUTOALLOCATE specifies that the tablespace is system managed. Users cannot specify an extent size. You cannot specify AUTOALLOCATE for a temporary tablespace.
    UNIFORM specifies that the tablespace is managed with uniform extents of SIZE bytes.The default SIZE is 1 megabyte. All extents of temporary tablespaces are of uniform size, so this keyword is optional for a temporary tablespace. However, you must specify UNIFORM in order to specify SIZE. You cannot specify UNIFORM for an undo tablespace.
    Restriction on Dictionary-managed Tablespaces
    You cannot specify DICTIONARY if the SYSTEM tablespace of the database is locally managed or if you have specified the temporary_tablespace_clause.
    Regards
    Stefan

  • Default storage for locally managed tablespaces

    the documentation says you cannot have a default storage parameter for locally managed tablespaces. Does this mean that we cannot specify
    INITIAL
    NEXT
    PCTINCREASE
    MINEXTENTS
    MAXEXTENTS for such tablespaces, or is there another way we can, without using default storage?
    thanks

    I amnot sure where you read that part that the default storage clause can't be given.Please see here,
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tspaces.htm#sthref1149
    From the doc,
    Creating a Locally Managed Tablespace
    If the CREATE TABLESPACE statement includes a DEFAULT storage clause, then the database considers the following:
    If you specified the MINIMUM EXTENT clause, the database evaluates whether the values of MINIMUM EXTENT, INITIAL, and NEXT are equal and the value of PCTINCREASE is 0. If so, the database creates a locally managed uniform tablespace with extent size = INITIAL. If the MINIMUM EXTENT, INITIAL, and NEXT parameters are not equal, or if PCTINCREASE is not 0, the database ignores any extent storage parameters you may specify and creates a locally managed, autoallocated tablespace.
    If you did not specify MINIMUM EXTENT clause, the database evaluates only whether the storage values of INITIAL and NEXT are equal and PCTINCREASE is 0. If so, the tablespace is locally managed and uniform. Otherwise, the tablespace is locally managed and autoallocated.
    HTH
    Aman....

  • Resizing temporary tablespace in oracle 8i

    Please,
    I some questions on oracle 8i.
    1. how do I know on oracle 8i if the tablespace X is the temporary tablespace?
    2. I have someone that increase the size of the temporary tablespace, so I have to decrease it to its normal size, my question is when I do the following command.
    alter database tempfile '/u02/oradata/TESTDB/temp01.dbf' resize 250M;
    alter database tempfile '/u02/oradata/TESTDB/temp01.dbf' resize 250M
    ERROR at line 1:
    ORA-03297: file contains used data beyond requested RESIZE value
    Does someone show me how to solve this issue?
    Thanks

    you can use the below sqls
    sql>SELECT tablespace_name, extent_size, total_extents, used_extents,
    free_extents, max_used_size FROM v$sort_segment;
    From the output of the v$sort_segment query:
    extent_size      : size of one extent, in number of Oracle blocks
    total_extents     : total number of extents in the segment (free or in use)
    used_extents      : total number of extents currently in use
    free_extents      : total number of extents currently marked as free
    max_used_size: maximum number of extents ever needed by an operation (like a sort):
    sql> SELECT s.username, u.tablespace, u.contents, u.extents, u.blocks FROM v$session s,
    v$sort_usage u WHERE s.saddr=u.session_addr;
    SQL> select s.username, s.sid, u.tablespace, u.contents, u.segtype,
    round(u.blocks*8192/1024/1024,2) MB
    from v$session s, v$sort_usage u
    where s.saddr = u.session_addr
    and u.contents = 'TEMPORARY'
    order by MB DESC ;
    reference
    ### search MetaLink on: resize tempfile
    Note 273276.1 How to Shrink the datafile of Temporary Tablespace
    Note 274283.1 How to resize Tempfiles if receive an ORA-03297 error Gen RDBMS.
    RD-9014 :
    Note 132663.1 ORA-03296 Resizing Temporary Locally Managed Tablespace
    Note 180578.1 Cannot Resize Tempfiles in Bitmapped Temporary Tablespaces
    Note 161103.1 Space For a Tempfile Not Allocated In The Filesystem

  • Bigfile Temporary Tablespace?

    Hi,
    --------------------------Oracle 11G Release 11.1.0.6.0, Windows XP 32------------------------------------
    I've tried to find out but not successful. Can I create BIGFILE TEMPORARY TABLESPACE like I've created normal BIGFILE TABLESPACE.
    Secondly, If it is not possible then will creating multiple temporary files will effect performance will doing the sorting?
    ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
    select inst_id, tablespace_name, total_blocks, used_blocks, free_blocks
          from gv$sort_segment;
       INST_ID TABLESPACE_NAME                 TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS
             1 TEMP                                12582144           0    12582144
    I've created 3 temp files of 30G each and get above error i.e unable to extend. adding a temp file will solve this issue, but I was thinking to create one bigfiel temporary file instead of adding files, that might decrease lot of performance.
    Thanks
    Regards

    kam555 wrote:
    Hi,
    --------------------------Oracle 11G Release 11.1.0.6.0, Windows XP 32------------------------------------
    I've tried to find out but not successful. Can I create BIGFILE TEMPORARY TABLESPACE like I've created normal BIGFILE TABLESPACE.
    Secondly, If it is not possible then will creating multiple temporary files will effect performance will doing the sorting?
    ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
    select inst_id, tablespace_name, total_blocks, used_blocks, free_blocks
    from gv$sort_segment;
    INST_ID TABLESPACE_NAME                 TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS
    1 TEMP                                12582144           0    12582144I've created 3 temp files of 30G each and get above error i.e unable to extend. adding a temp file will solve this issue, but I was thinking to create one bigfiel temporary file instead of adding files, that might decrease lot of performance.
    Thanks
    RegardsBigfile tablespaces are supported only for locally managed tablespaces with automatic segment space management, with three exceptions: locally managed undo tablespaces, temporary tablespaces, and the SYSTEM tablespace.
    There is no performance overhead if you have multiple datafiles in a tablespace. That is structure of Oracle: Tablespace may consist of multiple datafiles.

  • TEMPORARY TABLESPACE에서 TEMPFILE 과 DATAFILE의 차이점 (8.1.X ~ 9I)

    제품 : ORACLE SERVER
    작성날짜 : 2003-11-27
    PURPOSE
    이 문서에서는 Oracle 7.3부터 사용되어 오던 create tablespace ... temporary
    형태와, 8i부터 사용되는 create temporary tablespace... 의 차이점을 정리해
    본다.
    tablespace의 temporay type과 permanent type에 대한 비교는 <Bulletin#: 11938>
    를 참조하도록 하고 여기에서는 permanent에 대해서는 논외로 한다.
    Explanation
    temporary segment가 생성 가능한 tablespace의 type과 temporary tablesapce에서
    datafile과 tempfile의 차이점을 설명한다.
    1. temporary segment를 생성가능한 tablespace type 정리
    temporary tablespace의 tempfile과 datafile을 비교하기 전에, tablespace의
    type들을 확인해 보고, 이 중 temporary segment가 생성될 수 있는 tablespace
    type을 version별로 정리해본다.
    tablespace는 7.2까지는 permanent type으로 dictionary managed방식으로
    space를 할당/해제하던 방식만이 존재했다. db user의 temporary tablespace로
    임의의 tablespace를 지정가능하였고, 해당 db user의 sort operation은
    지정된 tablespace에서 발생하며, 다른 tablespace와 특별히 구분되는 것은
    없었다.
    이후, 7.3에 temporary type이 추가되고, 8i에서 locally managed type과 일반
    datafile이 아닌 tempfile이 소개되면서 8i를 기준으로 기본적으로 다음과 같이
    4가지 형태의 tablespace 형태가 가능하다.
    이중 (1) ~ (3)번까지는 일반 datafile형태이고, (4)번의 경우는 이 문서에서
    자세히 살펴볼 tempfile이다.
    (locally managed와 dictionary managed의 차이점 및 사용 방법은
    <Bulletin #: 18261>과 <Bulletin #: 11860> 참조)
    (1) permanent-dictionary managed
    (2) permanent-locally managed
    (3) temporary-dictionary managed
    (4) tempfile-locally managed
    [주의] 위의 종류에 temporary datafile에 locally managed 형태의 tablespace는
    없는것에 주의한다.
    그리고 만약 system tablespace가 locally managed로 이미 생성된 경우에는
    이후 모든 tablespace는 locally managed로 생성이 가능하고, dictionary
    managed 형태는 생성하면 ORA-12913 (Cannot create dictionary managed
    tablespace) 오류가 발생하게 된다.
    이러한 여러가지 type의 tablespace중 temporary segment를 생성할 수 있는
    tablespace에 제약이 존재한다.
    - 8i: 어떠한 형태의 tablespace라도 db user의 temporary tablespace로 지정
    가능하다. 단, permanent-locally managed 형태의 tablespace에 sort가
    발생하게 되면 ORA-3212 (Temporary Segment cannot be created in
    locally-managed tablespace) 오류가 발생하게 된다.
    SQL> alter user scott temporary tablespace PERM_LOCAL;
    User altered.
    connect scott/tiger
    SQL> select * from dept order by 1;
    ORA-03212: Temporary Segment cannot be created in locally-managed
    tablespace
    - 9i: db user의 default temporary tablespace 지정 자체가 다음 두 가지
    type만이 가능한다.
    -temporary-dictionary managed
    -tempile-locally managed
    만약 permanent type의 tablespace를 db user의 tempoary tablespace로
    지정하면, ORA-12911 (permanent tablespace cannot be temporary tablespace)
    오류가 발생한다.
    2. tempfile과 datafile의 비교
    아래에서 tablespace지정시 tempfile과 datafile형태를 비교하게 되는데,
    단, datafile형태의 경우 permanent type에 대해서는 언급하지 않는다.
    (1) tempile의 특징
    Oracle7.3에서 tablespace에 생성시 temporary option을 이용하여 생성되는
    tablespace를 구성하는 화일은 datafile이다. 단지 이것이 기존의 permanent
    type과 구별되는것은 이 tablespace에 생성되는 segment들이 매번 sort
    operation마다 별도로 생성되는 대신, 하나의 segment로 만들어지면서
    다른 session에서의 sort operation이 같은 segment를 공유하는 것이다.
    (자세한 것은 <Bulletin#: 11938> 참조)
    Oracle8.1부터 추가된 tempfile형태의 중요한 특징은 tempfile에 발생하는
    변경사항은 redo log file에 기록되지 않는다는 것이다. tempfile에
    checkpoint정보도 기록하지 않고 이에 따라 datafile recovery시에도
    tempfile에 대해서는 recovery가 필요없게 된다.
    이와 같은 이유로 standby database에서 read-only mode로 open하고
    조회시 sort가 발생하여 tempfile이 변경되는것은 문제가 되지 않아
    사용이 가능하다.
    그리고 이미 앞에서 설명한 것과 같이 tempfile은 항상 locally managed
    type으로만 생성이 되며, datafile형태의 temporary tablespace는 다음과
    같이 locally managed type으로 생성 자체가 불가능하다.
    SQL> create tablespace temp_datafile_local
    2 DATAFILE '/ora/oradata/V920/temp_data.dbf' size 100M
    3 TEMPORARY
    4 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;
    ORA-25144: invalid option for CREATE TABLESPACE with TEMPORARY contents
    (2) temporary tablespace 생성 방법 비교
    - tempfile형태의 경우
    tempfile로 temporary tablespace를 생성하는 경우는 다음과 같이
    생성하여야 하며, 반드시 locally managed 형태로만 생성 가능하다.
    SQL> create TEMPORARY tablespace temp_tempfile_local
    2 TEMPFILE '/ora/V920/temp_temp.dbf' size 100M
    3 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;
    아래 명령어에서 3번 line을 제거하고 생성하여도 default로 locally
    managed로 생성이 되며, dictionary managed 형태로 생성하고자
    3번 line대신 storage option을 추가하면
    ORA-2180 (invalid option for CREATE TABLESPACE) 오류가 발생한다.
    - datafile형태의 경우
    다음과 같은 형태로 생성하게 되면, dictionary managed type의
    temporary datafile형태로 tablespace가 만들어진다. 단, 9i의 경우
    이미 앞에서 언급한대로 system tablespace가 locally managed인 경우에는
    이와 같은 dictionary managed tablespace 생성은 ORA-12913이 발생하면서
    불가능하게 된다.
    SQL> create tablespace temp_datafile_dict
    2 datafile '/ora/oradata/V920/temp_data.dbf' size 100M
    3 TEMPORARY;
    (3) dictionary view 의 차이
    먼저 dba_tablespaces를 통해
    SQL> select tablespace_name, contents, extent_management,
    allocation_type from dba_tablespaces;
    TABLESPACE_NAME CONTENTS EXTENT_MAN ALLOCATIO
    TEMP_TEMPFILE_LOCAL TEMPORARY LOCAL UNIFORM
    TEMP_DATAFILE_DICT TEMPORARY DICTIONARY
    - tempfile의 경우
    SQL> select STATUS, ENABLED, NAME from v$tempfile;
    STATUS ENABLED NAME
    ONLINE READ WRITE /ora/V920/temp_temp.dbf
    SQL> select FILE_NAME, TABLESPACE_NAME from dba_temp_files;
    FILE_NAME TABLESPACE_NAME
    /ora/V920/temp_temp.dbf TEMP_TEMPFILE_LOCAL
    - datafile 형태의 경우
    다음과 같이 v$datafile과 dba_data_files를 통해 조회한다.
    SQL> select STATUS, ENABLED, NAME from v$datafile;
    STATUS ENABLED NAME
    ONLINE READ WRITE /ora/oradata/V920/temp_data.dbf
    SQL> select FILE_NAME, TABLESPACE_NAME from dba_data_files;
    FILE_NAME TABLESPACE_NAME
    /ora/oradata/V920/temp_data.dbf TEMP_DATAFILE_DICT
    (4) tempfile의 삭제에 대해서
    datafile의 경우 tablespace를 삭제하지 않고 datafile만 삭제하는 방법은
    존재하지 않는다. 물론 alter database datafile 'filename' offline drop;
    과 같은 command가 있지만 이것도 datafile을 데이타베이스에서 지워주는
    것이 아니며 이렇게 offline drop된 datafile을 포함하는 tablespace는
    recovery가 불가능한 경우라면 tablespace자체를 삭제해야 한다.
    그런데 tempfile의 경우는 temporary tablespace는 그대로 유지한 채,
    tempfile만 삭제하는 것이 가능하다.
    SQL> alter database tempfile '/oradata/V817/temp_temp01.dbf'
    2 drop;
    8i의 경우라면 이와 같은 명령어 후 실제 directory로 이동하여 직접
    tmep_temp01.dbf를 삭제하여야 한다.
    9i에서는 drop뒤에 including datafiles 라는 option을 추가하여 tempfile의
    drop시 바로 os상에서도 삭제되도록 할 수 있다.
    SQL> alter database tempfile '/oradata/V817/temp_temp01.dbf'
    2 drop including contents;
    만약 이러한 방법으로, tempfile을 해당 temporary tablespace에서 모두
    삭제한 경우, 실제 해당 tablespace에 disk sort가 필요하게 되면,
    그때는 ORA-25153 (Temporary Tablespace is Empty) 오류가 발생하게 된다.
    이때는 다음과 같이 임의의 tempfile을 다시 추가할 수 있다.
    SQL> alter tablespace TEMP_TEMPFILE_LOCAL
    2 add tempfile '/oradata/V817/temp_temp02.dbf';
    Reference Documents
    <Note:160426.1> TEMPORARY Tablespaces : Tempfiles or Datafiles ?

    제품 : ORACLE SERVER
    작성날짜 : 2003-11-27
    PURPOSE
    이 문서에서는 Oracle 7.3부터 사용되어 오던 create tablespace ... temporary
    형태와, 8i부터 사용되는 create temporary tablespace... 의 차이점을 정리해
    본다.
    tablespace의 temporay type과 permanent type에 대한 비교는 <Bulletin#: 11938>
    를 참조하도록 하고 여기에서는 permanent에 대해서는 논외로 한다.
    Explanation
    temporary segment가 생성 가능한 tablespace의 type과 temporary tablesapce에서
    datafile과 tempfile의 차이점을 설명한다.
    1. temporary segment를 생성가능한 tablespace type 정리
    temporary tablespace의 tempfile과 datafile을 비교하기 전에, tablespace의
    type들을 확인해 보고, 이 중 temporary segment가 생성될 수 있는 tablespace
    type을 version별로 정리해본다.
    tablespace는 7.2까지는 permanent type으로 dictionary managed방식으로
    space를 할당/해제하던 방식만이 존재했다. db user의 temporary tablespace로
    임의의 tablespace를 지정가능하였고, 해당 db user의 sort operation은
    지정된 tablespace에서 발생하며, 다른 tablespace와 특별히 구분되는 것은
    없었다.
    이후, 7.3에 temporary type이 추가되고, 8i에서 locally managed type과 일반
    datafile이 아닌 tempfile이 소개되면서 8i를 기준으로 기본적으로 다음과 같이
    4가지 형태의 tablespace 형태가 가능하다.
    이중 (1) ~ (3)번까지는 일반 datafile형태이고, (4)번의 경우는 이 문서에서
    자세히 살펴볼 tempfile이다.
    (locally managed와 dictionary managed의 차이점 및 사용 방법은
    <Bulletin #: 18261>과 <Bulletin #: 11860> 참조)
    (1) permanent-dictionary managed
    (2) permanent-locally managed
    (3) temporary-dictionary managed
    (4) tempfile-locally managed
    [주의] 위의 종류에 temporary datafile에 locally managed 형태의 tablespace는
    없는것에 주의한다.
    그리고 만약 system tablespace가 locally managed로 이미 생성된 경우에는
    이후 모든 tablespace는 locally managed로 생성이 가능하고, dictionary
    managed 형태는 생성하면 ORA-12913 (Cannot create dictionary managed
    tablespace) 오류가 발생하게 된다.
    이러한 여러가지 type의 tablespace중 temporary segment를 생성할 수 있는
    tablespace에 제약이 존재한다.
    - 8i: 어떠한 형태의 tablespace라도 db user의 temporary tablespace로 지정
    가능하다. 단, permanent-locally managed 형태의 tablespace에 sort가
    발생하게 되면 ORA-3212 (Temporary Segment cannot be created in
    locally-managed tablespace) 오류가 발생하게 된다.
    SQL> alter user scott temporary tablespace PERM_LOCAL;
    User altered.
    connect scott/tiger
    SQL> select * from dept order by 1;
    ORA-03212: Temporary Segment cannot be created in locally-managed
    tablespace
    - 9i: db user의 default temporary tablespace 지정 자체가 다음 두 가지
    type만이 가능한다.
    -temporary-dictionary managed
    -tempile-locally managed
    만약 permanent type의 tablespace를 db user의 tempoary tablespace로
    지정하면, ORA-12911 (permanent tablespace cannot be temporary tablespace)
    오류가 발생한다.
    2. tempfile과 datafile의 비교
    아래에서 tablespace지정시 tempfile과 datafile형태를 비교하게 되는데,
    단, datafile형태의 경우 permanent type에 대해서는 언급하지 않는다.
    (1) tempile의 특징
    Oracle7.3에서 tablespace에 생성시 temporary option을 이용하여 생성되는
    tablespace를 구성하는 화일은 datafile이다. 단지 이것이 기존의 permanent
    type과 구별되는것은 이 tablespace에 생성되는 segment들이 매번 sort
    operation마다 별도로 생성되는 대신, 하나의 segment로 만들어지면서
    다른 session에서의 sort operation이 같은 segment를 공유하는 것이다.
    (자세한 것은 <Bulletin#: 11938> 참조)
    Oracle8.1부터 추가된 tempfile형태의 중요한 특징은 tempfile에 발생하는
    변경사항은 redo log file에 기록되지 않는다는 것이다. tempfile에
    checkpoint정보도 기록하지 않고 이에 따라 datafile recovery시에도
    tempfile에 대해서는 recovery가 필요없게 된다.
    이와 같은 이유로 standby database에서 read-only mode로 open하고
    조회시 sort가 발생하여 tempfile이 변경되는것은 문제가 되지 않아
    사용이 가능하다.
    그리고 이미 앞에서 설명한 것과 같이 tempfile은 항상 locally managed
    type으로만 생성이 되며, datafile형태의 temporary tablespace는 다음과
    같이 locally managed type으로 생성 자체가 불가능하다.
    SQL> create tablespace temp_datafile_local
    2 DATAFILE '/ora/oradata/V920/temp_data.dbf' size 100M
    3 TEMPORARY
    4 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;
    ORA-25144: invalid option for CREATE TABLESPACE with TEMPORARY contents
    (2) temporary tablespace 생성 방법 비교
    - tempfile형태의 경우
    tempfile로 temporary tablespace를 생성하는 경우는 다음과 같이
    생성하여야 하며, 반드시 locally managed 형태로만 생성 가능하다.
    SQL> create TEMPORARY tablespace temp_tempfile_local
    2 TEMPFILE '/ora/V920/temp_temp.dbf' size 100M
    3 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;
    아래 명령어에서 3번 line을 제거하고 생성하여도 default로 locally
    managed로 생성이 되며, dictionary managed 형태로 생성하고자
    3번 line대신 storage option을 추가하면
    ORA-2180 (invalid option for CREATE TABLESPACE) 오류가 발생한다.
    - datafile형태의 경우
    다음과 같은 형태로 생성하게 되면, dictionary managed type의
    temporary datafile형태로 tablespace가 만들어진다. 단, 9i의 경우
    이미 앞에서 언급한대로 system tablespace가 locally managed인 경우에는
    이와 같은 dictionary managed tablespace 생성은 ORA-12913이 발생하면서
    불가능하게 된다.
    SQL> create tablespace temp_datafile_dict
    2 datafile '/ora/oradata/V920/temp_data.dbf' size 100M
    3 TEMPORARY;
    (3) dictionary view 의 차이
    먼저 dba_tablespaces를 통해
    SQL> select tablespace_name, contents, extent_management,
    allocation_type from dba_tablespaces;
    TABLESPACE_NAME CONTENTS EXTENT_MAN ALLOCATIO
    TEMP_TEMPFILE_LOCAL TEMPORARY LOCAL UNIFORM
    TEMP_DATAFILE_DICT TEMPORARY DICTIONARY
    - tempfile의 경우
    SQL> select STATUS, ENABLED, NAME from v$tempfile;
    STATUS ENABLED NAME
    ONLINE READ WRITE /ora/V920/temp_temp.dbf
    SQL> select FILE_NAME, TABLESPACE_NAME from dba_temp_files;
    FILE_NAME TABLESPACE_NAME
    /ora/V920/temp_temp.dbf TEMP_TEMPFILE_LOCAL
    - datafile 형태의 경우
    다음과 같이 v$datafile과 dba_data_files를 통해 조회한다.
    SQL> select STATUS, ENABLED, NAME from v$datafile;
    STATUS ENABLED NAME
    ONLINE READ WRITE /ora/oradata/V920/temp_data.dbf
    SQL> select FILE_NAME, TABLESPACE_NAME from dba_data_files;
    FILE_NAME TABLESPACE_NAME
    /ora/oradata/V920/temp_data.dbf TEMP_DATAFILE_DICT
    (4) tempfile의 삭제에 대해서
    datafile의 경우 tablespace를 삭제하지 않고 datafile만 삭제하는 방법은
    존재하지 않는다. 물론 alter database datafile 'filename' offline drop;
    과 같은 command가 있지만 이것도 datafile을 데이타베이스에서 지워주는
    것이 아니며 이렇게 offline drop된 datafile을 포함하는 tablespace는
    recovery가 불가능한 경우라면 tablespace자체를 삭제해야 한다.
    그런데 tempfile의 경우는 temporary tablespace는 그대로 유지한 채,
    tempfile만 삭제하는 것이 가능하다.
    SQL> alter database tempfile '/oradata/V817/temp_temp01.dbf'
    2 drop;
    8i의 경우라면 이와 같은 명령어 후 실제 directory로 이동하여 직접
    tmep_temp01.dbf를 삭제하여야 한다.
    9i에서는 drop뒤에 including datafiles 라는 option을 추가하여 tempfile의
    drop시 바로 os상에서도 삭제되도록 할 수 있다.
    SQL> alter database tempfile '/oradata/V817/temp_temp01.dbf'
    2 drop including contents;
    만약 이러한 방법으로, tempfile을 해당 temporary tablespace에서 모두
    삭제한 경우, 실제 해당 tablespace에 disk sort가 필요하게 되면,
    그때는 ORA-25153 (Temporary Tablespace is Empty) 오류가 발생하게 된다.
    이때는 다음과 같이 임의의 tempfile을 다시 추가할 수 있다.
    SQL> alter tablespace TEMP_TEMPFILE_LOCAL
    2 add tempfile '/oradata/V817/temp_temp02.dbf';
    Reference Documents
    <Note:160426.1> TEMPORARY Tablespaces : Tempfiles or Datafiles ?

  • LOCALLY-MANAGED TEMPFILE 의 RENAME 방법

    제품 : ORACLE SERVER
    작성날짜 : 2002-12-13
    LOCALLY-MANAGED TEMPFILE 의 RENAME 방법
    =======================================
    Purpose
    Locally-managed temporary file의 위치 변경 방법
    Problem Description
    Temporary tablespace 중 Dictionary managed file은 ALTER DATABASE RENAME FILE
    Command 를 이용하여 rename 이 가능하다.
    SQL> select TABLESPACE_NAME,CONTENTS,EXTENT_MANAGEMENT
    from dba_tablespaces;
    TABLESPACE_NAME CONTENTS EXTENT_MAN
    TEMP TEMPORARY DICTIONARY
    SQL> alter tablespace temp offline;
    Tablespace altered.
    SQL> alter database rename file '/V816/temp01.dbf' to '/V816/temp02.dbf';
    Database altered.
    SQL> recover tablespace temp;
    Media recovery complete.
    SQL> alter tablespace temp online;
    Tablespace altered.
    그러나 Locally-managed tempfile 은 다음과 같은 error 가 날것이다.
    SQL> select name from v$tempfile;
    NAME
    /V816/temp01.dbf
    SQL> alter database rename file '/V816/temp01.dbf' to '/V816/temp02.dbf';
    alter database rename file
    *ORA-01511: error in renaming log/data files
    ORA-01516: nonexistent log file, datafile or tempfile '/V816/temp01.dbf'
    SQL> alter tablespace user_temp_1 offline;
    alter tablespace user_temp_1 offline
    *ERROR at line 1:
    ORA-03217: invalid option for alter of TEMPORARY TABLESPACE
    Solution Description
    Solution 1
    기존의 Locally managed tablespace를 drop하고 새로운 위치의 tempfile 을 가진 tablespace 를 다시 생성.
    SQL> select file_name, tablespace_name from DBA_TEMP_FILES;
    FILE_NAME TABLESPACE_NAME
    /V816/temp01.dbf USER_TEMP_1
    SQL> drop tablespace user_temp_1;
    Tablespace dropped.
    SQL> create temporary tablespace user_temp_1
    2 tempfile '/V816/temp02.dbf' size 2M extent management local;
    Tablespace created.
    Solution 2
    Tempfile을 drop하고 기존의 tablespace 에 새로운 위치를 add 후 Os 에서 file 을 삭제
    SQL> alter database tempfile '/V90164/temp02.dbf' drop;
    Database altered.
    SQL> alter tablespace USER_TEMP_1 add tempfile '/V90164/temp03.dbf' size 2M;
    Tablespace altered.
    $ rm /V90164/temp02.dbf
    9i에서는 ,다음과 같이 한 문장으로 tempfile과 os file을 없앨수 있다.
    SQL> alter database tempfile '/V901/temp02.dbf' drop including datafiles;
    Database altered.
    SQL> alter tablespace USER_TEMP_1 add tempfile '/V90164/temp03.dbf' size 2M;
    Tablespace altered.
    Reference Documents
    Note:97458.1

    Hi,
    From the alert log what you have posted :-
    You have a restore of Existing DB from different DB to this New One
    WARNING: Default Temporary Tablespace not specified in CREATE DATABASE command
    Default Temporary Tablespace will be necessary for a locally managed database in future release
    Setting recovery target incarnation to 1
    After shutting Down completed "Fri Jul 04 21:52:33 2008"
    How come July 4th... (Could not understand this, from which place
    your are from)
    Started instance
    --Starting ORACLE instance (normal)
    After that tried to create database Once again
    then due to that File got corrupted
    ORA-00312: online log 1 thread 1: 'E:\ORACLE\ORADATA\TEST\REDO01.LOG'
    Yoy might have not created DB correctly or restored. So kindly drop everthing (DB), if it is a testing Machine, then Clear the Services First from machine Delete all files with respective DB and re-do the Job with out any mistakes.
    Thanks & Regards,
    Pavan Kumar N

  • Caclulate freespace from temporary tablespace

    i want to manage temporary tablespace.
    i want information like
    total_space,
    space_used,
    free_space from temporary tablespace

    RUN THIS
    select substr(a.tablespace_name,1,20) "TS_name", substr(a.file_name,1,35) "File_Name",
    round(sum(a.bytes)/1024/1024,2) "Size_MB",sum(NVL(b.bytes,0)) "FreeSpace" from dba_TEMP_files a,
    (select substr(tablespace_name,1,20) tablespace_name,file_id, round(sum(bytes_used)/1024/1024,2) used_sp,
    round(sum(blocks_free * 8192)/1024/1024,2) bytes from v$temp_space_header group by substr(tablespace_name,1,20),file_id ) b where
    a.tablespace_name=b.tablespace_name(+) and a.file_id=b.file_id(+) group by
    substr(a.tablespace_name,1,20), substr(a.file_name,1,35);
    thanks and regards
    kuljeet pal singh

  • Locally Managed tablespaces?

    Into the Design Editor, Admin tab: How can I define a tablespace as Locally Managed?

    Harvinder,
    Locally managed tablespaces are part of the new features of Oracle 8i. the advantages
    are when they database objects need to allocate space, they need not go through the
    data dictionary, they can find the free space
    through bitmaps in the datafile, hence the name locally managed tablespaces.
    this improves performance because recursive sql (update/insert/select of data dictionary tables) is avoided.
    temporary tablespaces are prime candidates for locally managed tablespaces.
    yes the whole database can be created with locally managed tablespaces..but with some restrictions. see oracle documentation for further details.
    Mukundan.

  • Temporary Tablespace not shrinking automatically after restarting the DB.

    I had a Database with 2GB tempfile. It gave me an error that it's unable to extend the temporary segment. I added a new tempfile of 500MB. Within a few min the new file was filled. In process of shrinking the temporary files, I shutdown the DB, and restarted it. But the Tempfiles were still filled to the max. I still don't understand why? Then I attached a new tempfile of 1GB to the Temp Tablespace, but it didn't use the new tempfile. I repeated the restart process again but still the output was same.
    1. Both datafiles were filled to the max
    2. It didn't use the new (3rd) attached tempfile.
    Finally I've created a new tablespace with new Tempfiles, and it's working now. But I'm still confused. Please suggest me with the possibilities. How can i shrink the Temporary Tablespace/Tempfiles.
    Thanks & Regards
    Vikas Verma
    Manager (IT) / Sr. DBA
    Hero Cycle Group,
    India

    It all depends from what you understand by shrinking:
    If you would like to shrink tempfile for tablespace I would suggest using following procedure:
    Find out to which size you can shrink tempfile
    select extent_size,current_users,total_extents,used_extents,free_extents
    from v$sort_segment
    where tablespace_name='TEMP';
    alter database tempfile 'XXXX' resize YYM;
    YY is the size which can be found by above query.
    But Ithink you are more interested in following procedure:
    create new
    make this new one the default temporary tablespace for the database
    drop old
    ps. Yoogesh ask you about DB version
    you can find bd version by:
    select *
    from v$version
    select *
    from product_component_version
    Best Regards
    Krystian Zieja / mob

  • Create table with storage parameters in a locally managed tablespace

    Hi,
    Can we create object with storage parameters in a locally managed tablespace.
    CREATE TABLE my_hash_table_6 (
    name VARCHAR2(30),
    value VARCHAR2(4000) )
    STORAGE (
    INITIAL 1M
    NEXT 512K
    PCTINCREASE 0
    MINEXTENTS 2
    MAXEXTENTS UNLIMITED )
    users default tablespace is locallly managed.
    Then this table's extent management will be managed as per the tablespace or as the storage parameters which
    were specified at the time of table creation.

    Why don't you try it yourself ?
    TEST@db102 > select * from dba_tablespaces
      2  where TABLESPACE_NAME='USERS';
    TABLESPACE_NAME                BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
    MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS    CONTENTS  LOGGING   FOR EXTENT_MAN
    ALLOCATIO PLU SEGMEN DEF_TAB_ RETENTION   BIG
    USERS                                8192          65536                       1
    2147483645                   65536 ONLINE    PERMANENT LOGGING   NO  LOCAL
    SYSTEM    NO  AUTO   DISABLED NOT APPLY   NO
    TEST@db102 > CREATE TABLE my_hash_table_6 (
      2  name VARCHAR2(30),
      3  value VARCHAR2(4000) )
      4  STORAGE (
      5  INITIAL 1M
      6  NEXT 512K
      7  PCTINCREASE 0
      8  MINEXTENTS 2
      9* MAXEXTENTS UNLIMITED )
    TEST@db102 > /
    Table created.
    TEST@db102 > select * from user_segments
      2  where segment_name='MY_HASH_TABLE_6';
    SEGMENT_NAME
    PARTITION_NAME                 SEGMENT_TYPE       TABLESPACE_NAME
         BYTES     BLOCKS    EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
    MAX_EXTENTS PCT_INCREASE  FREELISTS FREELIST_GROUPS BUFFER_
    MY_HASH_TABLE_6
                                   TABLE              USERS
       2097152        256          2        1572864                       1
    2147483645                                         DEFAULT
    TEST@db102 >

  • Problem shrinking a temporary tablespace

    I have a temporary tablespace in 10.1.0.3 I need to shrink. I need to shrink the database.
    1. I change all users that user that temporary tablespace to a new temporary tablespace
    2. Tried to shrink it but got
    ERROR at line 1:
    ORA-03297: file contains used data beyond requested RESIZE value
    I take this to mean there are open transactions using this temporary tablespace? How do I find who currently is using this temporary tablespace? do i need to kill those sessions?

    Hi,
    There may be one issue, if there are transactions open and the old temp tbsp is currently used (for sorting, etc), you will not be able to drop it without crashing the sessions. It will be nice if you check which user sessions are using the old temp and either gracefully abort the session (by asking them) or wait until they are done. Otherwise you may create the new temp and make it default (tablespace as well as user's temp tablespace name) so that no new user session will connect to the old temp and you can monitor it to stop its usage.
    Thanks

  • Bitmap indexes to track extents in locally managed tablespaces

    does any body have any idea that how oracle tracks free and used extents with bitmap indexes in locally managed tablespaces ?
    please reply

    There are no bitmap indexes, there is a 64k tablespace header block containing the bitmap of occupied and free extents.
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for