22.Identify the logical structure that will never have more than one data segment created for it.
A.external table
B.partitioned table
C.partitioned index
D.nonclustered table
E.global temporary table
答案:D
解析:
一、首先看下数据库中现有的,多于1个segment的类型
SQL> select distinct segment_type from dba_segments group by segment_name,owner,segment_type having count(*)>1;
SEGMENT_TYPE
------------------
INDEX PARTITION
TABLE SUBPARTITION
TABLE PARTITION
所以排除BC
二、接下来我们创建一个外部表
SQL> create table test_delta
2 (id varchar2(100))
3 organization external
4 (type oracle_loader
5 default directory DATA_DIR
6 access parameters
7 (records delimited by newline characterset us7ascii
8 badfile 'LOG_DIR':'test.bad'
9 logfile 'LOG_DIR':'test.log'
10 fields terminated by " " optionally enclosed by '\t'
11 )
12 location('test_delta.txt')
13 )
14 reject limit unlimited;
Table created.
[oracle@wahaha3 data_dir]$ vi test_delta.txt
1
2
3
4
5
6
7
8
SQL> select * from scott.test_delta;
ID
--------------------------------------------------------------------------------
1
2
3
4
5
6
7
8
8 rows selected.
SQL> select SEGMENT_NAME from user_segments;
SEGMENT_NAME
--------------------------------------------------------------------------------
DEPT
EMP
SALGRADE
WAHAHA2
WAHAHA0713
PK_DEPT
PK_EMP
7 rows selected.
这里说不表不占用segment
三、建立一个global temporary table
SQL> create global temporary table tbgtemp1 (id integer) on commit preserve rows tablespace temp;
Table created.
SQL> insert into tbgtemp1 values(1);
1 row created.
SQL> select table_name,tablespace_name from dba_tables where TABLE_NAME=upper('tbgtemp1');
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
TBGTEMP1 TEMP
SQL> select segment_name from dba_segments where tablespace_name='TEMP';
no rows selected
这里也没有
四、nonclustered table指的是非簇表
多个表存在一个段中
create cluster c1 (id integer) tablespace users
create table t1(id integer)cluster c1(id);
create table t2(id integer)cluster c1(id);
create index c1_index on cluster c1;
insert into t1 values(1);
SQL> select segment_name from dba_segments where segment_name='C1';
SEGMENT_NAME
--------------------------------------------------------------------------------
C1
只有1个
非簇表不知道是不是就是多个表不在一个segment中存储的意思
所以这道题
A:是外部表 0个
B:分区表 多个
C:分区索引 多个
D:非簇表 多个
E:全局临时表 0个
我觉得应该选AE
A.external table
B.partitioned table
C.partitioned index
D.nonclustered table
E.global temporary table
答案:D
解析:
一、首先看下数据库中现有的,多于1个segment的类型
SQL> select distinct segment_type from dba_segments group by segment_name,owner,segment_type having count(*)>1;
SEGMENT_TYPE
------------------
INDEX PARTITION
TABLE SUBPARTITION
TABLE PARTITION
所以排除BC
二、接下来我们创建一个外部表
SQL> create table test_delta
2 (id varchar2(100))
3 organization external
4 (type oracle_loader
5 default directory DATA_DIR
6 access parameters
7 (records delimited by newline characterset us7ascii
8 badfile 'LOG_DIR':'test.bad'
9 logfile 'LOG_DIR':'test.log'
10 fields terminated by " " optionally enclosed by '\t'
11 )
12 location('test_delta.txt')
13 )
14 reject limit unlimited;
Table created.
[oracle@wahaha3 data_dir]$ vi test_delta.txt
1
2
3
4
5
6
7
8
SQL> select * from scott.test_delta;
ID
--------------------------------------------------------------------------------
1
2
3
4
5
6
7
8
8 rows selected.
SQL> select SEGMENT_NAME from user_segments;
SEGMENT_NAME
--------------------------------------------------------------------------------
DEPT
EMP
SALGRADE
WAHAHA2
WAHAHA0713
PK_DEPT
PK_EMP
7 rows selected.
这里说不表不占用segment
三、建立一个global temporary table
SQL> create global temporary table tbgtemp1 (id integer) on commit preserve rows tablespace temp;
Table created.
SQL> insert into tbgtemp1 values(1);
1 row created.
SQL> select table_name,tablespace_name from dba_tables where TABLE_NAME=upper('tbgtemp1');
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
TBGTEMP1 TEMP
SQL> select segment_name from dba_segments where tablespace_name='TEMP';
no rows selected
这里也没有
四、nonclustered table指的是非簇表
多个表存在一个段中
create cluster c1 (id integer) tablespace users
create table t1(id integer)cluster c1(id);
create table t2(id integer)cluster c1(id);
create index c1_index on cluster c1;
insert into t1 values(1);
SQL> select segment_name from dba_segments where segment_name='C1';
SEGMENT_NAME
--------------------------------------------------------------------------------
C1
只有1个
非簇表不知道是不是就是多个表不在一个segment中存储的意思
所以这道题
A:是外部表 0个
B:分区表 多个
C:分区索引 多个
D:非簇表 多个
E:全局临时表 0个
我觉得应该选AE