创建与维护Oracle分区表和本地索引
2008-08-26 12:44:08 来源:WEB开发网SQL>CREATETABLEdbobjs2
2(object_idNUMBERNOTNULL,
3object_nameVARCHAR2(128),
4createdDATENOTNULL
5);
Tablecreated.
SQL>CREATEINDEXdbobjs_idx2ONdbobjs2(created);
Indexcreated.
SQL>insertintodbobjs2
2selectobject_id,object_name,created
3fromdba_objectswherecreated
6227rowscreated.
SQL>commit;
Commitcomplete.
SQL>selectcount(distinct(object_name))fromdbobjs2wherecreated<to_date('01/01/2007','dd/mm/yyyy');
COUNT(DISTINCT(OBJECT_NAME))
----------------------------
4753
ExecutionPlan
----------------------------------------------------------
0SELECTSTATEMENTptimizer=CHOOSE
10SORT(GROUPBY)
21TABLEACCESS(BYINDEXROWID)OF'DBOBJS2'
32INDEX(RANGESCAN)OF'DBOBJS_IDX2'(NON-UNIQUE)
Statistics
----------------------------------------------------------
0recursivecalls
0dbblockgets
2670consistentgets
0physicalreads
1332redosize
400bytessentviaSQL*Nettoclient
503bytesreceivedviaSQL*Netfromclient
2SQL*Netroundtripsto/fromclient
1sorts(memory)
0sorts(disk)
1rowsprocessed
当增加表分区时,LOCAL索引被自动维护:
SQL>ALTERTABLEdbobjs
2ADDPARTITIONdbobjs_08VALUESLESSTHAN(TO_DATE('01/01/2009','DD/MM/YYYY'));
Tablealtered.
SQL>setautotraceoff
SQL>COLsegment_namefora20
SQL>COLPARTITION_NAMEfora20
SQL>SELECTsegment_name,partition_name,tablespace_name
2FROMdba_segments
3WHEREsegment_name='DBOBJS_IDX';
SEGMENT_NAMEPARTITION_NAMETABLESPACE_NAME
----------------------------------------------------------------------
DBOBJS_IDXDBOBJS_06USERS
DBOBJS_IDXDBOBJS_07USERS
DBOBJS_IDXDBOBJS_08EYGLE
SQL>SELECTsegment_name,partition_name,tablespace_name
2FROMdba_segments
3WHEREsegment_name='DBOBJS';
SEGMENT_NAMEPARTITION_NAMETABLESPACE_NAME
----------------------------------------------------------------------
DBOBJSDBOBJS_06EYGLE
DBOBJSDBOBJS_07EYGLE
DBOBJSDBOBJS_08EYGLE
-The End-
- ››oracle 中 UPDATE nowait 的使用方法
- ››Oracle ORA-12560解决方法
- ››Oracle 10g RAC 常用维护命令
- ››Oracle如何在ASM中定位文件的分布
- ››Oracle的DBMS_RANDOM.STRING 的用法
- ››oracle 外部表导入时间日期类型数据,多字段导入
- ››Oracle中查找重复记录
- ››oracle修改用户登录密码
- ››Oracle创建删除用户、角色、表空间、导入导出等命...
- ››Oracle中登陆时报ORA-28000: the account is lock...
- ››Oracle数据库在配置文件中更改最大连接数
- ››Oracle中在pl/sql developer修改表的两种方式
赞助商链接