我了解的global temporary table

From:http://www.oracle-base.com/articles/八i/TemporaryTables.php
Applications often use some form of temporary data store for processes that are to complicated to complete in a single pass. Often, these temporary stores are defined as database tables or PL/SQL tables. In Oracle 八i, the maintenance and management of temporary tables can be delegated to the server by using Global Temporary Tables.
=>施用者常常急需用暂时数据构成的一些表,store一些用单调的模式很难达到的历程。正常,这些暂时性stores被定义为数据库表或pl/sql 表。在oracle 八i,暂时表的维护和治理透过用大局暂时表来委任给server.
Creation of Global Temporary Tables
The data in a global temporary table is private, such that data inserted by a session can only be accessed by that session. The session-specific rows in a global temporary table can be preserved for the whole session, or just for the current transaction. The ON COMMIT DELETE ROWS clause indicates that the data should be deleted at the end of the transaction.
=>创造大局暂时表
在大局暂时表中的数据是私有的,在一个session中安插的数据只好在同一个session中被获取。在大局暂时表三拇指定session里的行被保留在整个session或者是现阶段的transaction中。on commit delete rows话语说明在session中的数据应该在transaction完结时被delete.比如:


Java代码
一.CREATE GLOBAL TEMPORARY TABLE my_temp_table (
2. column一 NUMBER,
3. column二 NUMBER
4.) ON COMMIT DELETE ROWS;
CREATE GLOBAL TEMPORARY TABLE my_temp_table (
column一 NUMBER,
column二 NUMBER
) ON COMMIT DELETE ROWS;
In contrast, the ON COMMIT PRESERVE ROWS clause indicates that rows should be preserved until the end of the session.
=>相反,on commit preserve rows 话语指出截至session终结data应当保留在内存储器中。

Java代码
一.CREATE GLOBAL TEMPORARY TABLE my_temp_table (
2. column一 NUMBER,
3. column二 NUMBER
4.) ON COMMIT PRESERVE ROWS;
CREATE GLOBAL TEMPORARY TABLE my_temp_table (
column一 NUMBER,
column二 NUMBER
) ON COMMIT PRESERVE ROWS;
Miscellaneous Features
If the TRUNCATE statement is issued against a temporary table, only the session specific data is trucated. There is no affect on the data of other sessions.
=>如若truncate一个暂时表时,只是对现阶段session里的数据trucate,而对其它session里的数据没任何影响。
Data in temporary tables is automatically delete at the end of the database session, even if it ends abnormally.
=>即令session以不正常终结,暂时表中的数据也会在session完事时分被自动剔除。
Indexes can be created on temporary tables. The content of the index and the scope of the index is that same as the database session.
Views can be created against temporary tables and combinations of temporary and permanent tables.
=>index会被创办在暂时表上,目录的内容和范畴与session的同样。view会被创造在暂时表,以及暂时表与恒久表的组合表上。(这边所谓组合表,应该是联结查询获得的数据表)
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.
=>DML锁至于暂时表的数据来说没影响,由于每个Session都有它私有的数据。
Temporary tables can have triggers associated with them.
Export and Import utilities can be used to transfer the table definitions, but no data rows are processed.
=>暂时表有trigger与之联系关系。导入,导出效能也可以放在表定义的变换,但是没数据。

Specify GLOBAL TEMPORARY to indicate that the table is temporary and that its definition is visible to all sessions. The data in a temporary table is visible only to the session that inserts the data into the table.
特定大局暂时表---关于全部的Session都显见,而且暂时表中的数据只对安插数据到表中的Session可视。
Restrictions:
=>局限性:
一.Temporary tables cannot be partitioned, index-organized, or clustered.
=>暂时表不能被分区,目录化和群集。
二.You cannot specify any referential integrity (foreign key) constraints on temporary tables.
=>不能在暂时表上指定任何完整性约束。
三.Temporary tables cannot contain columns of nested table or varray type.
=>暂时表中不能包孕嵌套表或变量数组等等的列。
四.You cannot specify the following clauses of the LOB_storage_clause: TABLESPACE, storage_clause, LOGGING or NOLOGGING, MONITORING or NOMONITORING, or LOB_index_clause.
=>不能指定如次clause:TABLESPACE, storage_clause, LOGGING or NOLOGGING, MONITORING or NOMONITORING, or LOB_index_clause.
Parallel DML and parallel queries are not supported for temporary tables. (Parallel hints are ignored. Specification of the parallel_clause returns an error.)
=>呼应的DML和queries也不支持暂时表。
五.You cannot specify the segment_attributes_clause, nested_table_storage_clause, or parallel_clause.
=>与此同时在暂时表上指定segment_attributes_clause, nested_table_storage_clause, or parallel_clause。六.Distributed transactions are not supported for temporary tables.
=>暂时表也不支持分布式事宜。
以次是一个Global Temporary Table的范例:

Java代码
一.create global temporary table T_FORM四_POL_CHG_TMP
2.(
3. POLICY_ID NUMBER(十) not null,
4. CHANGE_ID NUMBER(十),
5. SERVICE_ID NUMBER(十),
6. FINISH_TIME DATE,
7. CASE_ID NUMBER(十),
8. WITHDRAW_TIME DATE,
9. CHANGE_STATUS VARCHAR二(二)
10.);
create global temporary table T_FORM四_POL_CHG_TMP
(
POLICY_ID NUMBER(十) not null,
CHANGE_ID NUMBER(十),
SERVICE_ID NUMBER(十),
FINISH_TIME DATE,
CASE_ID NUMBER(十),
WITHDRAW_TIME DATE,
CHANGE_STATUS VARCHAR二(二)
);
暂时表的引见:
Data in a temporary table is private to the session. Each session can only see and modify its own data.
=>在暂时表中的数据只是对现阶段session足见,每个session仅能访问和批改属于它的数据。
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 crash.
=>对暂时表的DML操作,不会对数据变更生成重做日记。然则,可以生成对数据的撤除日记和对撤消日记的重做日记。暂时表中的数据可以在session间断时被自动drop,如当用户退出可能Session异常中断.
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.
=>你能在暂时表上创造目录,在暂时表上的目录也是暂时的,在目录上的数据同暂时表中的数据同样,在雷同的session或事宜中。与此同时,也能在暂时表上创办视图和触发器。

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.
=>暂时表用暂时段。与永恒表不同,暂时表和属于它的目录在被创设时分,是没法自动分配段空间。取而代之,在第一回安插数据的时分,段空间才会被分配。换言之,在Select,Update,delete施行前,务必作insert操作,由于那时候数据表都为空。
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 ABORT for a transaction-specific temporary table.
=>仅当暂时表不与暂时表联系关系时分,才可以对它之行DDL操作(ALTER TABLE,DROP TABLE,CREATE INDEX等操作)。
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.
=>在Session终结可能Transaction完结时分暂时段才会被收回
本文来源:
我的异常网
Java Exception
Dotnet Exception
Oracle Exception

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值