解决方案 »

  1.   

    truncate table(截断表) 是清空一个表,是一个DDL语言,效率高,而delete就DML语言;delete时会触发与表相关的触发器,而truncate不会
    delete可以有删除条件,truncate不行
    truncate table这个语句会直接提交,不能回退,delete需要提交
    truncate 会释放表原来占用的空间 delete不会
      

  2.   

    另外truncate 产生的redo log 比delete 要少很多
    truncate 主要的动作其实就是移动表和相关索引的水位.
      

  3.   

    截断表(truncate table)是一个清空表数据的操作,直接效果跟delete from table 一样,但是,delete from table 这种清空方法可以通过回滚取消,truncate table tablename则不可以,但是truncate table tablename效率更高,可以根据实际情况选择
      

  4.   

    After selecting an import file that was previously exported using the PL/SQL Developer method, you can select to import one or more files from the list. The following options can be specified:
    • Drop tables – Drop the tables before they are recreated and loaded. The Create tables, Truncate tables, and Delete records options are disabled in this situation, and have an implicit value.
    • Create tables – Create the table before it is loaded. This includes constraints, indexes and grants.
    • Truncate tables – Truncate the tables before they are loaded. This option is faster than the Delete tables, but cannot be used if foreign key constraints exist.
    PL/SQL Developer 10.0 User’s Guide 183
    • Delete tables – Delete all records in the tables before they are loaded.
    • Disable triggers – Disables all triggers of the tables before they are loaded, and enable them afterwards. This can improve performance, and can sometimes be necessary if the triggers contain checks that are not applicable to the import process.
    • Disable foreign key constraints – Disables all foreign keys of the tables before they are loaded, and enable them afterwards. This can be necessary for self-referencing foreign keys. Foreign keys between different tables will not lead to conflicts, because the tables are exported in a correct order. Disabling foreign keys can also improve performance.
    • Commit every – Controls how many records will be inserted before a commit is executed. If this value is zero, all inserts will be committed at once at the end of the SQL script. For large export files and small rollback segments it will be necessary to supply an appropriate value here.