[20210520]关于主键索引问题.txt --//链接问的问题:http://www.itpub.net/thread-2141807-1-1.html ORACLE 11204 1 先创建个B树索引,然后再对该索引字段创建主键约束,此时,主键约束会自动使用之前创建好的B树索引, 2 或者,若该字段没有B树索引,在对该字段创建主键约束时,ORACLE自动以该字段创建一个唯一性的B树索引。 问:哪个数据字典能够识别出,该索引是事先创建的,还是创建主键约束时自动创建的? --//我记忆里有一个标识记录这样的情况。测试看看。 1.环境: SCOTT@book> @ver1 PORT_STRING VERSION BANNER ------------------------------ -------------- -------------------------------------------------------------------------------- x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production create table t1 (id number ,name varchar2(20) , constraint pk_t1 primary key(id)); create table t2 (id number ,name varchar2(20)); create unique index pk_t2 on t2(id); alter table t2 add constraint pk_t2 primary key (id) ; --//分析表略。 2.测试: SCOTT@book> select object_name,object_id,data_object_id,object_type from dba_objects where owner='SCOTT' and object_name in ('PK_T1','PK_T2','T1','T2') order by 2; OBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE -------------------- ---------- -------------- ------------------- T1 92621 92621 TABLE PK_T1 92622 92622 INDEX T2 92623 92623 TABLE PK_T2 92624 92624 INDEX SELECT * FROM sys.ind$ WHERE (obj#, dataobj#) IN (SELECT OBJ#, dataobj# FROM sys.obj$ WHERE name LIKE 'PK_T%'); SCOTT@book> @ prxx ============================== OBJ# : 92624 DATAOBJ# : 92624 TS# : 4 FILE# : 0 BLOCK# : 0 BO# : 92623 INDMETHOD# : 0 COLS : 1 PCTFREE$ : 10 INITRANS : 2 MAXTRANS : 255 PCTTHRES$ : TYPE# : 1 FLAGS : 67110914 PROPERTY : 1 BLEVEL : 0 LEAFCNT : 0 DISTKEY : 0 LBLKKEY : 0 DBLKKEY : 0 CLUFAC : 0 ANALYZETIME : 2021-05-20 09:14:26 SAMPLESIZE : 0 ROWCNT : 0 INTCOLS : 1 DEGREE : INSTANCES : TRUNCCNT : SPARE1 : 1 SPARE2 : SPARE3 : SPARE4 : SPARE5 : SPARE6 : 2021-05-20 01:13:27 ============================== OBJ# : 92622 DATAOBJ# : 92622 TS# : 4 FILE# : 0 BLOCK# : 0 BO# : 92621 INDMETHOD# : 0 COLS : 1 PCTFREE$ : 10 INITRANS : 2 MAXTRANS : 255 PCTTHRES$ : TYPE# : 1 FLAGS : 67110914 PROPERTY : 4097 BLEVEL : 0 LEAFCNT : 0 DISTKEY : 0 LBLKKEY : 0 DBLKKEY : 0 CLUFAC : 0 ANALYZETIME : 2021-05-20 09:14:26 SAMPLESIZE : 0 ROWCNT : 0 INTCOLS : 1 DEGREE : INSTANCES : TRUNCCNT : SPARE1 : 1 SPARE2 : SPARE3 : SPARE4 : SPARE5 : SPARE6 : 2021-05-20 01:12:39 PL/SQL procedure successfully completed. --//PROPERTY 标识不同。 --//4097 = 0x1001 --//查看/u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/admin/dcore.bsq的定义。 create table ind$ ... property number not null, /* immutable flags for life of the index */ /* unique : 0x01 */ /* partitioned : 0x02 */ /* reverse : 0x04 */ /* compressed : 0x08 */ /* functional : 0x10 */ /* temporary table index: 0x20 */ /* session-specific temporary table index: 0x40 */ /* index on embedded adt: 0x80 */ /* user said to check max length at runtime: 0x0100 */ /* domain index on IOT: 0x0200 */ /* join index : 0x0400 */ /* system managed domain index : 0x0800 */ /* The index was created by a constraint : 0x1000 */ /* The index was created by create MV : 0x2000 */ /* composite domain index : 0x8000 */ /* The following columns are used for index statistics such * as # btree levels, # btree leaf blocks, # distinct keys, * # distinct values of first key column, average # leaf blocks per key, * clustering info, and # blocks in index segment. */ --//可以发现 /* The index was created by a constraint : 0x1000 */ 表示索引建立通过约束建立。
[20210520]关于主键索引问题.txt
来源:这里教程网
时间:2026-03-03 16:43:47
作者:
编辑推荐:
- [20210520]关于主键索引问题.txt03-03
- [20210520]11g shared pool latch与library cache mutex的简单探究.txt03-03
- [20210520]11g shared pool latch与library cache mutex的简单探究3.txt03-03
- Oracle 单机配置DataGuard03-03
- [20210521]11g shared pool latch与library cache mutex的简单探究4.txt03-03
- oracle动态注册服务名03-03
- goldengate目标端复制进程延迟03-03
- centos 7.4静默安装oracle 19.303-03
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- oracle动态注册服务名
oracle动态注册服务名
26-03-03 - goldengate目标端复制进程延迟
goldengate目标端复制进程延迟
26-03-03 - 业务系统不释放资源,引起临时表空间报ORA-1652错误
业务系统不释放资源,引起临时表空间报ORA-1652错误
26-03-03 - 网校在线招生模板,快速定制出属于自己的网校小程序
网校在线招生模板,快速定制出属于自己的网校小程序
26-03-03 - 【ORACLE12C】oracle 12C wmsys.wm_concat()函数
- 2021超实用淘宝运营技巧,教你如何与客户做朋友
2021超实用淘宝运营技巧,教你如何与客户做朋友
26-03-03 - Oracle SCN健康状态检查
Oracle SCN健康状态检查
26-03-03 - PLSQL只安装客户端的配置
PLSQL只安装客户端的配置
26-03-03 - 12c rac-rac dg broker和fast-failover及客户端TAF配置详细步骤
- OGG抽取进程延迟100多小时
OGG抽取进程延迟100多小时
26-03-03
