Oracle 11g r2 new empty table does not allocate semgent

Source: Internet
Author: User

The new feature of Oracle 11g r2, delay segment creation, that is, the default table created from 11GR2 does not set and allocate segment, and does not occupy disk space, which sounds reasonable, space is allocated only when the first data is inserted.

Test

  1. Sys @ ANBOB> conn anbob/anbob
  2. Connected.
  3. Anbob @ ANBOB>Select*FromV $ version;
  4. BANNER
  5. --------------------------------------------------------------------------------
  6. OracleDatabase11g Enterprise Edition Release 11.2.0.1.0-Production
  7. PL/SQL Release 11.2.0.1.0-Production
  8. CORE 11.2.0.1.0 Production
  9. TNSForLinux: Version 11.2.0.1.0-Production
  10. NLSRTL Version 11.2.0.1.0-Production
  11. Anbob @ ANBOB>Create TableTestnew (idInt Primary Key,NameVarchar2 (10 ));
  12. TableCreated.
  13. Anbob @ ANBOB>Create TableTestnew_IME (idInt Primary Key,NameVarchar2 (10) segment creation immediate;
  14. TableCreated.
  15. Anbob @ ANBOB>Create TableTestnew_def (idInt Primary Key,NameVarchar2 (10) segment creation deferred;
  16. TableCreated.
  17. Anbob @ ANBOB>SelectSegment_nameFromUser_segmentsWhereSegment_nameLike 'Testnew %';
  18. SEGMENT_NAME
  19. ---------------------------------------------------------------------------------
  20. TESTNEW_IME
  21. Anbob @ ANBOB>SelectINDEX_NAME, TABLE_OWNERFromUSER_indexesWhereTable_name ='Testnew';
  22. INDEX_NAME TABLE_OWNER
  23. ------------------------------------------------------------
  24. SYS_C0010903 ANBOB
  25. Anbob @ ANBOB>SelectINDEX_NAME, TABLE_OWNERFromUSER_indexesWhereTable_name ='Testnew _ ime';
  26. INDEX_NAME TABLE_OWNER
  27. ------------------------------------------------------------
  28. SYS_C0010904 ANBOB
  29. Anbob @ ANBOB>SelectINDEX_NAME, TABLE_OWNERFromUSER_indexesWhereTable_name ='Testnew _ DEF';
  30. INDEX_NAME TABLE_OWNER
  31. ------------------------------------------------------------
  32. Sys_c00000005 ANBOB
  33. Anbob @ ANBOB>SelectSegment_nameFromUser_segmentsWhereSegment_name ='Sys _ C0010903';
  34. No RowsSelected
  35. Anbob @ ANBOB>SelectSegment_nameFromUser_segmentsWhereSegment_name ='Sys _ C0010904';
  36. SEGMENT_NAME
  37. ---------------------------------------------------------------------------------
  38. SYS_C0010904
  39. Anbob @ ANBOB>SelectSegment_nameFromUser_segmentsWhereSegment_name ='Sys _ c00000005';
  40. No RowsSelected
  41. Anbob @ ANBOB>Insert IntoTestnewValues(1,'Anbob. com');
  42. 1 row created.
  43. Anbob @ ANBOB>Commit;
  44. CommitComplete.
  45. Anbob @ ANBOB>SelectSegment_nameFromUser_segmentsWhereSegment_nameLike 'Testnew %';
  46. SEGMENT_NAME
  47. ---------------------------------------------------------------------------------
  48. TESTNEW
  49. TESTNEW_IME
  50. Anbob @ ANBOB>SelectINDEX_NAME, TABLE_OWNERFromUSER_indexesWhereTable_name ='Testnew';
  51. INDEX_NAME TABLE_OWNER
  52. ------------------------------------------------------------
  53. SYS_C0010903 ANBOB
  54. Anbob @ ANBOB>SelectSegment_nameFromUser_segmentsWhereSegment_name ='Sys _ C0010903';
  55. SEGMENT_NAME
  56. ---------------------------------------------------------------------------------
  57. SYS_C0010903
  58. Anbob @ ANBOB>Truncate TableTestnew;
  59. TableTruncated.
  60. Anbob @ ANBOB>SelectSegment_nameFromUser_segmentsWhereSegment_nameLike 'Testnew %';
  61. SEGMENT_NAME
  62. ---------------------------------------------------------------------------------
  63. TESTNEW
  64. TESTNEW_IME
  65. Anbob @ ANBOB> conn sys/oracleAsSysdba
  66. Connected.
  67. Sys @ ANBOB>Create TableTestnew_def (idInt Primary Key,NameVarchar2 (10) segment creation deferred;
  68. Create TableTestnew_def (idInt Primary Key,NameVarchar2 (10) segment creation deferred
  69. *
  70. ERRORAtLine 1:
  71. ORA-14223: This table does not support delayed creation segments
Sys @ ANBOB> conn anbob/anbobConnected. anbob @ ANBOB> select * from v $ version; BANNER implements Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-ProductionPL/SQL Release 11.2.0.1.0-ProductionCORE 11.2.0.1.0 ProductionTNS for Linux: version 11.2.0.1.0-ProductionNLSRTL Version 11.2.0.1.0-Productionanbob @ ANBOB> create table testnew (id int primary key, name varchar2 (10); Table created. anbob @ ANBOB> create table testnew_IME (id int primary key, name varchar2 (10) segment creation immediate; Table created. anbob @ ANBOB> create table testnew_def (id int primary key, name varchar2 (10) segment creation deferred; Table created. anbob @ ANBOB> select segment_name from user_segments where segment_name like 'testnew % '; SEGMENT_NAME---------------------------------------------------------------------------------TESTNEW _ IMEanbob @ ANBOB> select INDEX_NAME, TABLE_OWNER from USER_indexes where table_name = 'testnew '; INDEX_NAME TABLE_OWNER comment Comment comment ANBOBanbob @ ANBOB> select INDEX_NAME, TABLE_OWNER from USER_indexes where table_name = 'testnew _ IME '; INDEX_NAME TABLE_OWNER comment Comment comment SYS_C0010904 ANBOBanbob @ ANBOB> select INDEX_NAME, TABLE_OWNER from USER_indexes where table_name = 'testnew _ DEF '; INDEX_NAME TABLE_OWNER without using sys_c00000005 ANBOBanbob @ ANBOB> select segment_name from user_segments where segment_name = 'sys _ c0010903 '; no rows selectedanbob @ ANBOB> select segment_name from user_segments where segment_name = 'sys _ C0010904 '; SEGMENT_NAME---------------------------------------------------------------------------------SYS _ blank @ ANBOB> select segment_name from user_segments where segment_name = 'sys _ c00000005 '; no rows selectedanbob @ ANBOB> insert into testnew values (1, 'anbob. com '); 1 row created. anbob @ ANBOB> commit; Commit complete. anbob @ ANBOB> select segment_name from user_segments where segment_name like 'testnew % '; SEGMENT_NAME---------------------------------------------------------------------------------TESTNEWTESTNEW _ IMEanbob @ ANBOB> select INDEX_NAME, TABLE_OWNER from USER_indexes where table_name = 'testnew '; INDEX_NAME TABLE_OWNER comment Comment comment ANBOBanbob @ ANBOB> select segment_name from user_segments where segment_name = 'sys _ C0010903 '; SEGMENT_NAME---------------------------------------------------------------------------------SYS _ C0010903anbob @ ANBOB> truncate table testnew. anbob @ ANBOB> select segment_name from user_segments where segment_name like 'testnew % '; SEGMENT_NAME---------------------------------------------------------------------------------TESTNEWTESTNEW _ IMEanbob @ ANBOB> conn sys/oracle as sysdbaConnected. sys @ ANBOB> create table testnew_def (id int primary key, name varchar2 (10) segment creation deferred; create table testnew_def (id int primary key, name varchar2 (10 )) segment creation deferred * ERROR at line 1: ORA-14223: This table does not support delay in creating segments

Note:
11g r2 is created using segment creation deferred by default. The newly created non-record-free table is not allocated with sement. When the first record is inserted, the segment space is allocated and will not be recycled due to truncate, it is not supported in sys schema. I heard that exp will not be exported.

Related Article

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.