- 浏览: 27385 次
- 性别:
- 来自: 北京
最新评论
Temporary Segments
- 博客分类:
- oracle
Temporary Segments: including Temporary Segments for Queries and Temporary Tables and Indexes
Allocation of Temporary Segments for Queries(sort segments)
One or more temporary tablespaces can be used only for sort segments. A temporary tablespace is not the same as a tablespace that a user designates for temporary segments, which can be any tablespace available to the user. No permanent schema objects can reside in a temporary tablespace.
Sort segments are used when a segment is shared by multiple sort operations. One sort segment exists for every instance that performs a sort operation in a given tablespace.
Temporary tablespaces provide performance improvements when you have multiple sorts that are too large to fit into memory. The sort segment of a given temporary tablespace is created at the time of the first sort operation. The sort segment expands by allocating extents until the segment size is equal to or greater than the total storage demands of all of the active sorts running on that instance.
Oracle allocates temporary segments as needed during a user session in one of the temporary tablespaces of the user issuing the statement. Specify these tablespaces with a CREATE
USER
or an ALTER
USER
statement using the TEMPORARY
TABLESPACE
clause.
Note:
You cannot assign a permanent tablespace as a user's temporary tablespace.If no temporary tablespace is defined for the user, then the default temporary tablespace is the SYSTEM
tablespace. The default storage characteristics of the containing tablespace determine those of the extents of the temporary segment. Oracle drops temporary segments when the statement completes.
Because allocation and deallocation of temporary segments occur frequently, create at least one special tablespace for temporary segments. By doing so, you can distribute I/O across disk devices, and you can avoid fragmentation of the SYSTEM
and other tablespaces that otherwise hold temporary segments.
Note:
When theSYSTEM
tablespace is locally managed, you must define a default temporary tablespace when creating a database. A locally managed SYSTEM
tablespace cannot be used for default temporary storage. Entries for changes to temporary segments used for sort operations are not stored in the redo log, except for space management operations on the temporary segment.
Allocation of Temporary Segments for Temporary Tables and Indexes
In addition to permanent tables, Oracle can create temporary tables to hold session-private data that exists only for the duration of a transaction or session.
Oracle allocates segments for a temporary table when the first Segments for a temporary table are allocated in a temporary tablespace of the user who created the temporary table. Oracle drops segments for a transaction-specific temporary table at the end of the transaction and drops segments for a session-specific temporary table at the end of the session. If other transactions or sessions share the use of that temporary table, the segments containing their data remain in the table. INSERT
into that table is issued. (This can be an internal insert operation issued by CREATE
TABLE
AS
SELECT
.) The first INSERT
into a temporary table allocates the segments for the table and its indexes, creates the root page for the indexes, and allocates any LOB
segments.
The CREATE
GLOBAL
TEMPORARY
TABLE
statement creates a temporary table that can be transaction-specific or session-specific. For transaction-specific temporary tables, data exists for the duration of the transaction. For session-specific temporary tables, data exists for the duration of the session. Data in a temporary table is private to the session. Each session can only see and modify its own data. DML locks are not acquired on the data of the temporary tables. The LOCK
statement has no effect on a temporary table, because each session has its own private data.
A TRUNCATE
statement issued on a session-specific temporary table truncates data in its own session. It does not truncate the data of other sessions that are using the same table.
DML statements on temporary tables do not generate redo logs for the data changes. However, undo logs for the data and redo logs for the undo logs are generated. Data from the temporary table is automatically dropped in the case of session termination, either when the user logs off or when the session terminates abnormally such as during a session or instance failure.
You can create indexes for temporary tables using the CREATE
INDEX
statement. Indexes created on temporary tables are also temporary, and the data in the index has the same session or transaction scope as the data in the temporary table.
You can create views that access both temporary and permanent tables. You can also create triggers on temporary tables.
Oracle utilities can export and import the definition of a temporary table. However, no data rows are exported even if you use the ROWS
clause. Similarly, you can replicate the definition of a temporary table, but you cannot replicate its data.
Segment Allocation
Temporary tables use temporary segments. Unlike permanent tables, temporary tables and their indexes do not automatically allocate a segment when they are created. Instead, segments are allocated when the first INSERT
(or CREATE
TABLE AS
SELECT
) is performed. This means that if a SELECT
, UPDATE
, or DELETE
is performed before the first INSERT
, then the table appears to be empty.
You can perform DDL statements (ALTER
TABLE
, DROP
TABLE
, CREATE
INDEX,
and so on) on a temporary table only when no session is currently bound to it. A session gets bound to a temporary table when an INSERT
is performed on it. The session gets unbound by a TRUNCATE
, at session termination, or by doing a COMMIT
or ROLLBACK
for a transaction-specific temporary table.
Temporary segments are deallocated at the end of the transaction for transaction-specific temporary tables and at the end of the session for session-specific temporary tables.
发表评论
-
from string get number data using pl/sql or sql
2012-02-16 17:32 892declare @aa varchar(80),--- ... -
SQL
2012-02-15 18:01 7341.select sal salary from emp; ... -
modify ip
2012-02-10 17:45 7991.netconfig 2./etc/sysconfig/n ... -
MULTI dbwr or io slaves
2012-02-10 15:21 883thanks dukope of itpub. ... -
FAQS
2012-02-09 15:59 7581.How can I get the largest amo ... -
HOW TO STUDY ORACLE FROM Yong Huang
2012-01-18 14:48 804Assuming you want to study orac ... -
RMAN
2012-01-14 17:07 7081.components of the rman ... -
INSTANCE and CRASH RECOVERY
2012-01-12 10:12 7541.type of checkpoint full c ... -
STARTUP PFILE=
2011-12-31 14:11 12281.vi initdbs.ora spfile=&quo ... -
MANAGE TABLE
2011-12-26 16:50 5751.heap table IOT PARTI ... -
MONITOR redo size
2011-12-21 17:48 6501.set autot on stat 2.unsin ... -
What do rollback and commit
2011-12-21 11:21 746When we COMMIT, all that is lef ... -
What is the schema ?
2011-12-20 15:18 592A schema is a collection of dat ... -
MANAGE UNDOTABS
2011-12-19 17:15 6801.manual undo_management=ma ... -
DBA SQL
2011-12-19 15:21 4401.select a.name,b.status from v ... -
SEGMENT EXTENTS ORACLEBLOCK
2011-12-15 16:11 8001.SEGMENT: allocated fo ... -
MANAGE TABLESPACE AND DATAFILES
2011-12-13 15:28 5801. tablespace,segment,extent,bl ... -
ORACLE NET
2011-12-12 09:49 6881.net_service_name: servive ... -
SQLPLUS TIPS
2011-12-09 17:51 9121.SQLPLUS : a tool that execute ... -
ORACLE ENVIRONMENT VARIABLES
2011-12-09 17:15 660ORACLE_HOME ORACLE_SID : or ...
相关推荐
4. 临时段(Temporary Segments): 用于临时数据,如排序或并行操作。在需要调整临时表空间大小时,可以调整全局临时表空间或会话临时表空间的初始和下次扩展大小。 5. 聚合统计信息(Aggregate Statistics): ...
根据存储数据的类型, 可以将段(segment)分为**表段**(Table Segments)、**索引段**(Index Segments)、**回滚段**(Rollback Segments)、**LOB段**(Large Object Segments)以及**临时段**(Temporary Segments)。...
- 释放临时段(temporary segments)。 ##### 5. 归档进程 Oracle数据库支持两种归档模式:NOARCHIVELOG模式和ARCHIVELOG模式。NOARCHIVELOG模式不支持联机日志,无法对数据库进行恢复;而ARCHIVELOG模式支持联机...
- 临时段(Temporary Segments):用于临时排序操作。 - 索引缓冲区(Index Buffers):存储索引页的副本。 **2. PGA的管理** - PGA在每个用户会话建立时分配,在会话结束时释放。 - PGA的大小取决于会话的具体活动...
- **临时段(Temporary Segments)**:用于存储临时数据,例如排序操作的结果。这些段通常在事务结束时被清除。 #### 六、安全与审计 - **用户、权限、资源与策略(Users, Privileges, Resources & Policies)**:...
create temporary tablespace stbss_tmp tempfile 'E:\oracle\product\10.2.0\oradata\orcl\stbss_temp01.dbf' size 32m autoextend on next 32m maxsize 2048m extent management local; ``` 这条语句创建了一个名...
可以通过查询`DBA_SEGMENTS`视图来查看用户和表空间的关系,或者使用`ALTER TABLESPACE`命令添加、删除数据文件,调整表空间大小。例如: ``` SELECT DISTINCT(owner), tablespace_name FROM dba_segments; ...
- 查询每个用户的默认表空间(`default_tablespace`)和临时表空间(`temporary_tablespace`)。 3. **查询特定段的使用情况** ```sql SELECT segment_name, bytes FROM dba_segments WHERE segment_name = 'RE_...
Oracle9i的逻辑存储结构主要由表空间(Tablespaces)、段(Segments)、区(Extents)和数据块(Blocks)组成。这些组成部分共同构成了数据库的数据存储体系。 ##### 2.1 表空间(Tablespaces) 表空间是Oracle数据库中的...
7. **临时表空间(Temporary Tablespace)**:用于临时数据存储,比如在排序、GROUP BY或UNION ALL操作中产生的中间结果。在多用户环境中,设置多个临时表空间可以提高并发性能。 8. **错误分析与管理**:在实际...
- **检查是否有用户的缺省表空间和临时表空间设置为SYSTEM表空间**: `SELECT username, default_tablespace, temporary_tablespace FROM dba_users;` - 确保没有用户的默认表空间被设置为系统表空间。 #### 三、...
6. **临时表空间(Temporary Tablespace)**:临时表空间用于存储临时数据,比如排序和聚合操作的中间结果。 7. **用户表空间(User Tablespace)**:用户表空间是为满足用户需求而创建的,用于存储用户的数据对象...
2. 回滚段(Rollback Segments):用于存储事务的回滚信息,以便在事务回滚时恢复数据。 3. 扩展(Extent):表空间中分配给对象的连续数据块集合。 4. 数据块(Data Blocks):Oracle数据库最小的数据存储单位,由...
4. **段(Segments)**:段是表空间内的逻辑存储单元,用于存储特定数据库对象,如表、索引、回滚段(Rollback Segments)等。 5. **分区(Partitions)**:对于大型表,Oracle支持分区技术,将表划分为逻辑上独立...
CREATE TEMPORARY TABLESPACE temp_tablespace_name TEMPFILE 'temp_tablespace_file_path.dbf' SIZE 50M AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED; ``` 3. **将表移动到新表空间**: ```sql ALTER TABLE ...
- `SELECT default_tablespace, temporary_tablespace FROM dba_users WHERE username='GAME';` 显示用户(如 'GAME')的默认和临时表空间。 - `SELECT profile FROM dba_users WHERE username='GAME';` 显示用户...
These links are temporary and allow the identification of specific processes or applications on the receiving host. - For example, when you visit a website, your web browser (running on your ...
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE new_temp_tablespace; ALTER TABLESPACE old_temp_tablespace OFFLINE; DROP TABLESPACE old_temp_tablespace INCLUDING CONTENTS AND DATAFILES; ``` 四、重建索引:...
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP2; ``` 哪个视图可以帮助您确认`TEMP2`表空间已被设置为默认临时表空间? A. DATABASE_PROPERTIES B. V$DATABASE C. DBA_TEMP_FILES D. DBA_TABLESPACES **...