Temporary tablespace permanently occupied
I have the following problem: my temporary tablespace is 3GB big and 2.9GB are occupied permanently occupied. I don't have any queries running who are suspicious to take so much sorting space. How can I find out, which session is occupying my tempspace to kill it or how can I release my temporary tablespace?
Thanks.
Hi
Did u check ant tables are residing on the temporary tablespace. Or try to alter the tempoaray tablesspaces as temporary type if there are any permanent objects residing on the tablespace it will fail. Check also if any of the user have any quota on temp ts as default tablespace.
null
Similar Messages
-
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 -
(9I) DEFAULT TEMPORARY TABLESPACE의 개념과 사용 예제
제품 : ORACLE SERVER
작성날짜 : 2003-06-09
(9I) DEFAULT TEMPORARY TABLESPACE의 개념과 사용 예제
===================================================
PURPOSE
Space Management와 관련된 Oracle 9i의 새로운 기능 중 Default
Temporary Tablespace에 대하여 알아보기로 한다.
Explanation
데이터베이스 user를 생성할 때, 명시적으로 Temporary Tablespace를 지정하
지 않으면 기본적으로 SYSTEM 테이블스페이스가 할당되고, 모든 temporary
data는 이 SYSTEM 테이블스페이스에 저장된다. 9i에서는 데이터베이스 전체
에 걸쳐 사용될 Default Temporary Tablespace로 임의의 Temporary
Tablespace를 정의할 수 있다.
만일 별도의 Temporary Tablespace를 생성하고, 이를 Default Temporary
Tablespace로 지정하면 Temporary data를 저장할 공간으로 불필요하게
SYSTEM 테이블스페이스를 사용할 이유가 없게 된다. (데이터베이스 생성 시
정의할 수 있다.)
데이터베이스 운영 중 아래와 같이 동적으로 변경할 수 있으며, 이 경우 기
존 사용자의 Default Temporary Tablespace도 함께 변경이 된다.
SQL> ALTER DATABASE ora9i DEFAULT TEMPORARY TABLESPACE dts2;
Temporary type으로 만든 datafile은 dba_temp_files view를 보면 된다.
Restrictions on Default Temporary Tablespace
새로운 Default Temporary Tablespace가 가용하기 전에 기존 Default
Temporary Tablespace를 drop할 수 없다.
Default Temporary Tablespace를 Permanent Tablespace로 변경할 수 없다.
Default Temporary Tablespace는 SYSTEM Tablespace이거나 Temporary Type
Tablespace이어야만 한다.
Default Temporary Tablespace는 OFFLINE으로 변경될 수 없다.
Example
As SYSTEM
- 원래대로 Default Temporary Tablespace를 SYSTEM으로 복원
SQL> alter database ora9i default temporary tablespace system;
- 데이터베이스 user 생성 시 Temporary Tablespace 확인:SYSTEM tablespace
사용
SQL> create user omf_test identified by omf_test;
SQL> select username, temporary_tablespace from dba_users where
username = 'OMF_TEST'
USERNAME TEMPORARY_TABLESPACE
OMF_TEST SYSTEM
- Default Temporary Tablespace를 TEMP tablespace(temporary type)로
변경 :
기존 사용자(OMF_TEST)의 Temporary Tablespace가 SYSTEM에서 TEMP로 변경
됨을 알 수 있다.
SQL> alter database ora9i default temporary tablespace temp;
SQL> select username, temporary_tablespace from dba_users where
username = 'OMF_TEST'
USERNAME TEMPORARY_TABLESPACE
OMF_TEST TEMP
- 이제는 데이터베이스 user를 생성할 때, Temporary Tablespace가 SYSTEM이
아닌 TEMP가 됨을 확인
SQL> drop user omf_test;
SQL> create user omf_test identified by omf_test;
SQL> select username, temporary_tablespace from dba_users where
username = 'OMF_TEST'
USERNAME TEMPORARY_TABLESPACE
OMF_TEST TEMP
SQL> drop user omf_test;
Reference Documents
<Note:138212.1> -
Amount of temporary tablespace size used for index rebuild
Hi All,
I want to know approximate amount of temporary tablespace size used for index rebuild. I need this information to avoid the insufficient temporary tablespace error during the huge index rebuild.
Is there a query or procedure to find it out.
Thank you.Hi,
While creating the index, the temporary segment is created in the permanent tablespace. So permanent tablespace must have sufficient space.
http://www.oracle-base.com/articles/10g/SpaceObjectTransactionManagement10g.php
http://aprakash.wordpress.com/2010/01/05/numeric-segment-name/
Anand -
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:44So, 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 ...* -
ORA-03212 temporary tablespace
Hi all,
we run a single instance database on file system (no ASM).
The database has benn running fine for several weeks now. 2 days ago however the following error came up:
"*** MODULE NAME:(DBMS_SCHEDULER) 2012-09-02 06:00:03.470
*** ACTION NAME:(MGMT_CONFIG_JOB_1) 2012-09-02 06:00:03.470
ERROR: kfnUseConn - failure to make a connection
ORA-03212: Temporary Segment cannot be created in locally-managed tablespace".
I changed the user's (oracle_ocm) temp tablespace to "TEMPORARY LOCAL". which should avoid that error in future.
My question:
What is the appropriate temporary tablespace for system users?
We run quite a lot of databases that were created with version 7.x and migrated up to version 10 or 11. They all used to have PERMANENT tablespaces as temp tbs for the users 'SYS, SYSTEM, DIP, APPQOSSYS, CSMIG' which did not make any problems up to now.
Should I change default temporary tbs to TBLSPC_TEMP for all users including those mentioned above?
FJHPlease post output of below commands :
1. select tablespace_name from dba_data_files where tablespace_name like '%TEMP%';
If you gets any name here, it means your temp tablespace is not really a temp one, its a permanent one whose name is temp, because if you have created temp tablespace with the TEMPFILE keyword, then only its a really temp tablespace. DBA_DATA_FILES do not shows the datafiles which have been created with TEMPFILE keyword.
2.set long 999999;
SELECT DBMS_METADATA.GET_DDL('TABLESPACE','TEMP') FROM DUAL;
In above output if you don't see TEMPFILE keyword then ORA-03212 is correct and as documented.
Now, if you want your TEMPORARY tablespace to be Locally Managed then you should use the TEMPFILE clause and NOT DATAFILE while creating the TEMPORARY TABLESPACE.
create temporary tablespace temp tempfile
'/u10/oradata/cprpt/temp01.dbf' size 250M reuse,
'/u10/oradata/cprpt/temp02.dbf' size 250M reuse,
'/u10/oradata/cprpt/temp03.dbf' size 250M reuse,
'/u10/oradata/cprpt/temp04.dbf' size 250M reuse
extent management local uniform size 3M;
http://www.dbasupport.com/forums/showthread.php?t=31317
Regards
Girish Sharma -
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,
SoumenHello 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 -
Temporary Tablespace: cannot check it from V$TEMP_SPACE_HEADER
I've created the temporary tablespace but I cannot check it from V$TEMP_SPACE_HEADER, when I select the contents of it, it returns "no rows selected".
Could someone tell me why?
Besides, I would like to know how to check the contents in temporary table space.
Regards,
JimmyHi,
I think you just did not create a TEMPORARY TABLESPACE but a PERMANENT TABLESPACE with TEMPORARY OPTION..10:43:10 TEST.SQL>CREATE TABLESPACE TS
10:43:21 2 DATAFILE '/F1.dbf' SIZE 15M
10:43:40 3 TEMPORARY;
Tablespace created.
Elapsed: 00:00:02.66
10:43:44 TEST.SQL>SELECT * FROM V$TEMP_SPACE_HEADER;
TABLESPACE_NAME FILE_ID BYTES_USED BLOCKS_USED BYTES_FREE BLOCKS_FREE RELATIVE_FNO
TMP 1 2,2424E+10 2737280 3790602240 462720 1
Elapsed: 00:00:00.01
10:43:56 TEST.SQL>SELECT * FROM DBA_TABLESPACES WHERE TABLESPACE_NAME IN ('TMP','TS');
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_
TS 8192 40960 40960 1 50 0 ONLINE TEMPORARY LOGGING NO DICTIONARY USER NO
MANUAL DISABLED
TMP 8192 5242880 5242880 1 0 5242880 ONLINE TEMPORARY NOLOGGING NO LOCAL UNIFORM NO
MANUAL DISABLED As you can see from this sample, if you useCREATE TABLESPACE blablabla DATAFILE blabla TEMPORARYOracle creates a tablespace that looks to be a pure temporary tablespace but in fact is not actually. It can be used as a TEMP would be but has not all the characteristics of it. Heh, it's got a DATAFILE, not a TEMPFILE in it.
If you use CREATE TEMPORARY TABLESPACE blabla TEMPFILE blabla then Oracle will create an actual TEMPORARY TABLESPACE which will be present in all temporary related views!
You can't distinguish one from the other via standard views (DBA_TABLESPACES) once it's been created.
To check temp space usage you can use something like:SELECT
RPAD(TF.TABLESPACE_NAME,20) || ':' ||
DECODE(EXTENT_MANAGEMENT,'LOCAL','LM-','DM-') ||
SUBSTR(ALLOCATION_TYPE,1,1)||'+'||
SUBSTR(SEGMENT_SPACE_MANAGEMENT,1,1)||'@'||
SUBSTR(TS.STATUS,1,2)
TABLESPACE_NAME,
TF.FILE_NAME,
USAGE.USERNAME,
USAGE.SEGTYPE,
LPAD(USAGE.BLOCKS*TBLKS.BLOCKSIZE/1024/1024,5) || ' Mo' BLOCKS
FROM
DBA_TEMP_FILES TF,
V$TEMPSEG_USAGE USAGE,
(SELECT VALUE BLOCKSIZE FROM V$PARAMETER WHERE NAME='db_block_size') TBLKS,
DBA_TABLESPACES TS
WHERE
USAGE.TABLESPACE=TF.TABLESPACE_NAME
AND TS.TABLESPACE_NAME=TF.TABLESPACE_NAME
ORDER BY TF.TABLESPACE_NAME, TF.FILE_NAME, USAGE.USERNAME;Regards,
Yoann. -
Dropping default temporary tablespace
Hi
(regarding Oracle 9i)
I am getting two conflicting messages. The first one says you cannot drop a default temporary tablespace, and the second one says you can and that SYSTEM then becomes the default temporary tablespace. Which one is correct?
http://www.idevelopment.info/data/Oracle/DBA_tips/Tablespaces/TBS_12.shtml says: The DBA cannot drop a default temporary tablespace, but it is possible to assign a new default temporary tablespace and then drop the old one. You also cannot change a default temporary tablespace to a permanent tablespace, nor can you take a default temporary tablespace offline.
http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c04space.htm#1945 says: If you drop the default temporary tablespace, then the SYSTEM tablespace is used as the default temporary tablespace
Which one is correct?!?!
thanksselect * from database_properties where property_name='DEFAULT_TEMP_TABLESPACE';
PROPERTY_NAME
PROPERTY_VALUE
DESCRIPTION
DEFAULT_TEMP_TABLESPACE
TEMP
Name of default temporary tablespace
drop tablespace temp;
drop tablespace temp
ERROR at line 1:
ORA-12906: cannot drop default temporary tablespaceBut as your earlier quotations make clear, there is nothing stopping from creating a NEW temporary tablespace, making that the default, and then dropping TEMP, the original-but-no-longer default.
The principle is logical: a default's not much of a default if it can cease to exist. For a default to be meaningful, it has to be protected from being gotten rid of.
The other thing you hinted at: the default default temporary tablespace is still SYSTEM, because it's the only tablespace that HAS to exist from the moment a database exists (though 10g elevates SYSAUX to almost the same status). So if you choose to create your database manually, using syntax of the form 'create database XXX....', it is allowed NOT to create a temporary tablespace. And if you choose to do that, then SYSTEM will be used as the default temporary tablespace. -
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 ? -
Setting the default default tablespace and default temporary tablespace
Is there a way to set the default default tablespace and default temporary tablespace database wide? I want to assign default and temporary tablespaces other than SYSTEM to all new users without having to explicitly define the tablespace names.
Hi,
Well, I assume that OP is using 10g, but exactly what you said, in Oracle 9i, it became possible to specify the default temporary tablespace in the database. In Oracle 10g, it allows all users to set up the default permanent tablespace to set the permanent tablespace used by default. Before Oracle 10g, if the default permanent tablespace is not set up when creating the user, SYSTEM tablespace will be set up as the default permanent tablespace by default.
Cheers -
ORA-00600 Error, when Dropping one temporary tablespace
Hi,
I am using Oracle 10.1.0.2.0 on WinXPP, after I created a new temp tablespace and assigned one user to it as its temp tablespace, then trying to drop the old temp tablespace , I am getting the following Error . Can anybody pl. explain the reason.
Steps I followed as...
SYSTEM@orcl>create temporary tablespace checkup_tmp tempfile 'c:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL \CHECKUP_Tmp.dat' size 500M;
Tablespace created.
SYSTEM@orcl> alter user checkup temporary tablespace checkup_tmp;
User altered.
SYSTEM@orcl> drop tablespace CHECKUP_TEMP including contents;
drop tablespace CHECKUP_TEMP including contents
ERROR at line 1:
ORA-00600: internal error code, arguments: [krf_gen_drop_tablespace-1], [], [],
SYSTEM@orcl> drop tablespace CHECKUP_TEMP ;
drop tablespace CHECKUP_TEMP
ERROR at line 1:
ORA-00600: internal error code, arguments: [krf_gen_drop_tablespace-1], [], [],
Thanks in advancethis is the bug 3984486
consider upgrading.
the workaround seems to flashback the DB... -
How do i know if my query using SORT_AREA_SIZE or temporary tablespace ?
Good Morning Everyone !
My DB version is 10.2.0.1
I have large table exactly 3 million records.
SQL> select count(*) from tab1;
COUNT(*)
300000
SQL> select * from tab1 order by no DESC;
sorting ... in process
300000 rows selected.
in Terminal 2 : I tried to find sorting details - ( No rows selected - why ? )
SQL> select USERNAME , USER , TABLESPACE , SQL_ID from v$tempseg_usage ;
no rows selected
SQL> /
no rows selected
When i google i have seen this ;
If Oracle cannot do the sort in memory (SORT_AREA_SIZE initialisation parameter), space will be allocated in a temporary tablespace for doing the sort operation.
REF_LINK : TEMPORARY Tablespaces and TEMPFILES | Oracle FAQ
MY DOUBT QUESTION : How do i know if my query using SORT_AREA_SIZE or temporary tablespace ?
Thanks in advance.@ JohnWatson
I have seen some articles from ORA - FAQ. Good.
SQL> select USERNAME , USER , TABLESPACE , SQL_ID from v$tempseg_usage;
USERNAME USER TABLESPACE SQL_ID
SCOTT SYS TEMP fh9vqgyd6m0d1
PGA management means that sorting only 300000 rows may well occur in memory
Is this (3 million rows) - standard value for 10g version ?
Thanks JohnWatson -
INCLUDED_IN_DATABASE_BACKUP for temporary tablespace
Hi,
The query output from v$tablespace shows the INCLUDED_IN_DATABASE_BACKUP value for temp tablespace in my db is "YES". The only way to have the value "NO" is to configure rman to exclude tbs. But you can not exclude temporary tablespace. Based on the size of total full backup files, the temp tablespace does not seem to be backup by rman. Is this a bug or is there other way to set this value for temporary tablespace to "NO"? I'm using 9iR2. Thanks.>...The only way to have the value "NO" is to configure rman to exclude tbs. But you can not exclude temporary tablespace.
RMAN doesn't include the temporary tablespace in the backups.
SQL> select * from v$tablespace;
TS# NAME INC
0 SYSTEM YES
7 TEST YES
3 USERS YES
4 TEMP YES
6 UNDO YES
RMAN> list backup of tablespace TEMP;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 01/26/2006 20:04:06
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20202: tablespace not found in the recovery catalog
RMAN-06019: could not translate tablespace name "TEMP"
RMAN> list backup of tablespace UNDO summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Tag
3125 B 0 A DISK 22-JUL-05 1 1 TAG20050722T102731
3207 B 0 A DISK 24-OCT-05 1 1 TAG20051024T163622
3248 B 1 A DISK 02-NOV-05 1 1 TAG20051102T225318
3360 B F A DISK 23-JAN-06 1 1 TAG20060123T172135Aron -
Script for temporary tablespace in 8.1.7.4.0
Hi,
I am working in oracle 8.1.7.4.0 and HP-UX os.I need a shell script which is to do the following tasks,
1. create a new temporary tablespace
2.assign the new temp tablespace to the database user level
3.drop the old temp tablespace
4. then create a temp tablespace with the old name
5. then assign the new temp tablespace to the database user level
6.drop the new temp tablespace
Kindly provide me the script for oracle 8.1.7.4.0
Rgds..here is one I prepared earlier (just like a TV chef)
set echo on
-- Create a New TEMP TEMP
create temporary tablespace temp2
tempfile 'dir/temp2.dbf' size 5M
autoextend on next 1M maxsize unlimited extent management local uniform size 1M;
-- Make the TEMP2 tablespace temp
alter database default temporary tablespace temp2;
-- Drop the orginal to recreate with new size
drop tablespace temp including contents and datafiles;
CREATE TEMPORARY TABLESPACE TEMP
TEMPFILE 'dir/temp01.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE 30000M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 2M;
alter database default temporary tablespace temp;
drop tablespace temp2 including contents and datafiles;
Maybe you are looking for
-
How do I transfer songs from one iTunes library to another?
My husband and I each have our own iBook G4 and iPod mini's. I need to get songs from his itunes library (mostly downloaded from cd's) to mine so that I can put together a playlist for his surprise 50th birthday party. What's the easiest and quickest
-
HA N+1 and Mobility Groups
Hi all, One question, can I have 2 WLC's on different Mobility Groups pointing to the same HA N+1 WLC which is located in one of those Mobility Groups?. I have not seen any note about this on the Cisco documentation I have checked. thanks
-
Crystal Reports XI Release 2: Error message when trying to install
I am unable to install Crystal Reports XI Release 2 onto my computer. After putting CD1 into my computer and clicking install, I get the following error message: "Error applying transforms. Verify that the specified transform paths are valid." A c
-
Can i add new genre & create new Smart Playlist?
I'm 1st time iTunes user organizing my music to play on a Bose system. Bose has a capability to 'play all' of a selected playlist but it depends on setup in iTunes. I want to be able to have capability to 'play all' selected piano music on Bose; but
-
Troubles with rear and center speakers (5
Hello. I just purchased a Creative X-Fi XtremeGamer Fatalty Professional sound card and installed it. I have 5. surround speakers (Logitech X-540) and during the speaker connection wizard, I only hear front left and front right and it is coming throu