Temporary Tablespace and Temporary Table

Temporary Tablespaces: (sort segments and temp table data segments)

          1.contains transient data that persists only for the duration of the session.         

          2.improve the concurrency of multiple sort operations, reduce their overhead, and avoid Oracle Database space management operations.

          3.A temporary tablespace can be assigned to users with the CREATE USER or ALTER USER statement and can be shared by multiple users.

          4.Within a temporary tablespace, all sort operations for a given instance and tablespace share a single sort segment.  An extent cannot be shared by multiple transactions.

          5.When you create a temporary table, its rows are stored in your default temporary tablespace.

          6. V$SORT_SEGMENT view,V$TEMPSEG_USAGE,v$tempfile,v$dba_temp_files

1.create temporary tablespace temp1 tempfile '/u01/oradata/lsh/tempfile.dbf' size 100m extent management local uniform size 10m;

 

2.alter tablespace temp1 tempfile offline/online ;alter database tempfile '/u01/oradata/lsh/tempfile.dbf' offline/online;

 

3.alter tablespace temp1 add  tempfile '/u01/oradata/lsh/tempfile01.dbf' size 100m; alter database tempfile '/u01/oradata/lsh/tempfile.dbf' resize 150m;

 

4.alter database tempfile '/u01/oradata/lsh/tempfile.dbf' drop including datafiles;               

 

 Temporary Table:    

            1.The definition of a temporary table is visible to all sessions  

            2. the data in a temporary table is visible only to the session that inserts the data into the table

            3.The ON COMMIT clause indicate if the data in the table is transaction-specific (the default) or session-specific, the implications of which are as follows:

ON COMMIT SettingImplications
DELETE ROWSThis creates a temporary table that is transaction specific. A session becomes bound to the temporary table with a transactions first insert into the table. The binding goes away at the end of the transaction. The database truncates the table (delete all rows) after each commit.
PRESERVE ROWSThis creates a temporary table that is session specific. A session gets bound to the temporary table with the first insert into the table in the session. This binding goes away at the end of the session or by issuing a TRUNCATE of the table in the session. The database truncates the table when you terminate the session.

CREATE GLOBAL TEMPORARY TABLE admin_work_area
        (startdate DATE,
         enddate DATE,
         class CHAR(20))
      ON COMMIT DELETE ROWS;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值