The DML operation between a common table and a temporary table produces REDO/UNDO comparison and analysis.

Source: Internet
Author: User
In addition to permanent tables, the ORACLE database can also create temporary tables temporarytables. These temporary tables are used to save the data of a SESSION or

In addition to permanent tables, the ORACLE database can also create temporary tables. These temporary tables are used to save the data of a SESSION or

Oracle temporary table introduction:

In addition to permanent tables, the ORACLE database can also create temporary tables. These temporary tables are used to save the data of a SESSION or the data required in a transaction. When the session exits or the user commits a commit or rollback transaction, the data in the temporary table is automatically cleared, but the structure and metadata of the temporary table are also stored in the user's data dictionary.

Oracle temporary tables are divided into session-level temporary tables and transaction-level temporary tables.

A session-level temporary table means that the data in the temporary table only exists in the session lifecycle. When the user exits the session, Oracle automatically clears the data in the temporary table.
Transaction-level temporary table means that the data in the temporary table only exists in the transaction lifecycle. When a transaction ends (commit or rollback), Oracle automatically clears the data in the temporary table.
The data in the temporary table is only valid for the current Session. Each Session has its own temporary data and cannot access the data in the temporary table of other sessions. Therefore, DML locks are not required for temporary tables.

When a session ends (the user Exits normally and the user does not exit normally) or a transaction ends, ORACLE executes the TRUNCATE Statement on the table in the session to clear the temporary table data. however, data in other temporary session tables is not cleared. you can index temporary tables and create views based on temporary tables. similarly, indexes created on temporary tables are temporary and only valid for the current session or transaction. temporary tables can have triggers.

The full text REDO/UNOD is measured in BYTES.

I. Environment and users

BYS @ bys1> select * from v $ version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production
PL/SQL Release 11.2.0.1.0-Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0-Production
NLSRTL Version 11.2.0.1.0-Production

BYS @ bys1> select force_logging from v $ database;

FOR
---
NO
BYS @ bys1> select * from user_role_privs;
USERNAME GRANTED_ROLE adm def OS _
---------------------------------------------------------------------
BYS DBA NO YES NO
BYS @ bys1> select * from tab;
TNAME TABTYPE CLUSTERID
-----------------------------------------------
DEPT TABLE
EMP TABLE

SYS_TEMP_FBT TABLE

Create a table with data records-the source data is dba_objects, which is inserted through multiple queries.

BYS @ bys1> create table test9 as select * from dba_objects;
Table created.

BYS @ bys1> insert into test9 select * from test9; --- use this statement multiple times to insert data

BYS @ bys1> commit;
Commit complete.
BYS @ bys1> select count (*) from test9; nearly entries.
COUNT (*)
----------
6957120

Related reading:

Oracle DML Process

PL/SQL ORA-14551: cannot perform DML operations in queries solved

Common MySQL DDL, DML, and DCL languages (example)

Execute batch DML exercises for Oracle basic transactions and ForAll

Oracle DML Statement (insert, update, delete) rollback Estimation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.