1. Trang chủ
  2. » Công Nghệ Thông Tin

Oracle SQL Plus The Definitive Guide- P22 pptx

10 253 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 89,97 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Columns in the ALL_TAB_COLUMNS View continued SAMPLE_SIZE The number of rows that were sampled when statistics were last computed for this column.b CHARACTER_SET_NAME For character colum

Trang 2

< previous page page_186 next page >

Page 186

Table 6-3 Columns in the ALL_TAB_COLUMNS View (continued)

SAMPLE_SIZE The number of rows that were sampled when statistics were last computed for this

column.b CHARACTER_SET_NAME For character columns, this indicates which character set is stored by the column

This value will be either NCHAR_CS or CHAR_CS NCHAR_CS indicates that data in the column is stored using the national character set CHAR_CS indicates that the database character set is used

a Not maintained automatically by Oracle; beginning with Oracle8, you should use the

ALL_TAB_COL_STATISTICS view to retrieve this value This column is set when you use the ANALYZE

TABLE command with the COMPUTE STATISTICS option

b Not maintained automatically by Oracle This column is set when you use the ANALYZE TABLE command with

the COMPUTE STATISTICS option

The ALL_CONSTRAINTS view

The ALL_CONSTRAINS view returns one row for each constraint you can see Oracle will let you see all constraints on tables you own, as well as all constraints on tables to which you have been granted any type of access Table 6-4 lists the columns in this view

Table 6-4 Columns in the ALL_CONSTRAINTS View

OWNER The owner of the constraint This is usually the same as the owner of the table on

which the constraint is defined

CONSTRAINT_NAME The name of the constraint

CONSTRAINT_TYPE Indicates the type of constraint., Will be one of these values:

P = PRIMARY KEY

R = FOREIGN KEY

C = CHECK

U = UNIQUE KEY TABLE_NAME The table on which the constraint is defined

SEARCH_CONDITION If the constraint is a check constraint, this is the condition that must be satisfied for

each row stored in the table For other constraint types, this will be null

R_OWNER For foreign key constraints, this is the owner of the related primary key or unique

constraint

R_CONSTRAINT_NAME For foreign key constraints, this is the related primary key or unique constraint

Trang 3

(tabel continued on next page)

Trang 4

< previous page page_187 next page >

Page 187

Table 6-4 Columns in the ALL_CONSTRAINTS View (continued)

Column Name Contents

STATUS Will be either ENABLED or DISABLED, depending on whether or not the constraint is

currently being enforced

DEFERRABLE Will be either DEFERRABLE or NOT DEFERRABLE

DEFERRED Will be either DEFERRED or IMMEDIATE, depending on whether not the constraint is

deferred by default

VALIDATED Will be either VALIDATED or NOT VALIDATED, depending on whether or not all rows in

the table have been validated against the constraint

GENERATED Will be either GENERATED NAME or USER NAME depending on whether the constraint

name was system-generated or specified by the user who created it

BAD Usually this is null If this is BAD, you have used a date constant that does not include the

century, and you need to recreate the constraint prior to the year 2000

LAST_CHANGE The date when the constraint was most recently changed Since the only change you can make

is to enable or disable a constraint, this ends up being when that was most recently done

The ALL_CONS_COLUMNS view

The ALL_CONS_COLUMNS view contains one row for each column specified in a primary key, foreign key, or unique

constraint Table 6-5 lists the columns in this view

Table 6-5 Columns in the ALL_CONS_COLUMNS View

OWNER The owner of the constraint, which is the same as the owner of the table on which the

constraint is defined

CONSTRAINT_NAME The name of the constraint

TABLE_NAME The table on which the constraint is defined

COLUMN_NAME The name of a column that makes up the constraint

POSITION The position of the column in the constraint definition

The ALL_INDEXES view

The ALL_INDEXES view returns one record for each index you can see You should be able to see indexes for any table to which you have been granted access The information in ALL_INDEXES pertains to the index as a whole To get

Trang 5

Table 6-6 Columns in the ALL_INDEXES View

OWNER The username of the index's owner, which may not be the same as the owner of the

underlying table

INDEX_NAME The index name

INDEX_TYPE The index type, one of the following values: NORMAL, BITMAP, CLUSTER,

IOT-TOP, IOT-NESTED, SECONDARY, ANSI, or LOB

TABLE_OWNER The username of the table's owner

TABLE_NAME The name of the table on which the index was created

TABLE_TYPE The type of table which is indexed

UNIQUENESS Indicates whether or not the index is a unique index

Values are UNIQUE, NONUNIQUE, or UNDEFINED

TABLESPACE_NAME The name of the tablespace in which the index is stored

INI_TRANS The initial number of transactions

MAX_TRANS The maximum number of transactions

INITIAL_EXTENT The size, in bytes, of the next extent that will be allocated for the index

NEXT_EXTENT The size, in bytes, of the next extent that will be allocated for the index

MIN_EXTENTS The minimum number of extents for the index This number of extents is allocated when

the index is first created

MAX_EXTENTS The maximum number of extents allowed for the index When these fill up, any attempts

to index new rows will result in an error

PCT_INCREASE Each time a new extent is allocated, the NEXT_EXTENT value is increased by this

percentage

PCT_THRESHOLD The percentage of block space allowed for each index entry

INCLUDE_COLUMN Applies to indexes on index-organized table, and is the column ID number of the last

column to be included in the top-level index blocks

FREELISTS The number of freelists allocated to this index

FREELIST_GROUPS The number of freelist groups allocated to this index

PCT_FREE Minimum percentage of free space in a block When free space drops to this level,

Oracle stops adding new rows to the block

Trang 6

(table continued from previous page)

Trang 7

Table 6-6 Columns in the ALL_INDEXES View (continued)

LOGGING The logging attribute for the index

BLEVEL For B-Tree indexes, this is the number of different levels between the root

(top) and the leaf (bottom) blocks.a LEAF_BLOCKS The number of leaf blocks contained in the index.a

DISTINCT_KEYS The number of distinct index values With a UNIQUE index, every value is

a distinct value.a AVG_LEAF_BLOCKS_PER_KEY Each distinct indexed value appears in one or more leaf blocks This is the

average of the number of leaf blocks for each entry For a UNIQUE index, this will always be 1.a

AVG_DATA_BLOCKS_PER_KEY Each distinct index entry references one or more data blocks in the table

This is the average number of data blocks referenced by each entry.a CLUSTERING_FACTOR This indicates how well-ordered the table is in terms of the index This

value can range from the number of blocks in the table to the number of rows in the table The more this value approaches the number of blocks in the table, the more closely the order of the rows in the table match the order

in which they are indexed As the rows are more randomized, this value will approach the row count for the table.a

STATUS The status of the index; it has one of these values: DIRECT LOAD or

VALID A status of VALID indicates that the index is up to date and can be used

NUM_ROWS The number of rows indexed by this index.a

SAMPLE_SIZE The sample used when the index was last analyzed.a

LAST_ANALYZED The date on which the index was last analyzed.a

DEGREE The number of threads used by each instance scanning the index This

applies only to partitioned indexes, and will be null if the index is not partitioned

INSTANCES Similar to DEGREE, but refers to the number of instances that can

simulaneously scan the index If the index is not partitioned, this will be null

PARTITIONED A YES/NO flag indicating whether or not the index is a partitioned index

TEMPORARY A Y/N flag indicating whether or not the index is a temporary index If the

index is temporary, users will only see entries for rows they have inserted

Trang 8

< previous page page_190 next page >

Page 190

Table 6-6 Columns in the ALL_INDEXES View (Continued)

Column Name Contents

GENERATED A Y/N flag indicating whether or not the index name was system-generated A value of Y is

used for system-generated names, which look like this: SYS_C001194

BUFFER_POOL The name of the default buffer pool to be used for the index

a Not maintained automatically by Oracle This column is set when you use the ANALYZE TABLE command with

the COMPUTE STATISTICS option

The ALL_IND_COLUMNS view

Indexes are made up of one or more columns To find out what columns are included in an index, you need to use the

ALL_IND_COLUMNS view Table 6-7 describes this view

Table 6-7 Columns in the ALL_IND_COLUMNS View

Column Name Contents

INDEX_OWNER The owner of the index

INDEX_NAME The name of the index

TABLE_OWNER The owner of the table that is indexed

TABLE_NAME The name of the table that is indexed

COLUMN_NAME The name of a column in the index

COLUMN-POSITION The relative position of the column in the index The first column will be number 1, the

second column will be number 2, etc

COLUMN_LENGTH The number of bytes of the column that form part of the index entry

The ALL_TRIGGERS view

The ALL_TRIGGERS view returns one row for each trigger on tables you own or to which you have access Table 6-8

describes the columns in this view

Table 6-8 Columns in the ALL_TRIGGERS View

OWNER The owner of the trigger

TRIGGER_NAME The trigger name

TRIGGER_TYPE This indicates when the trigger fires and whether or not it fires for each row The type will be

one of these values: BEFORE EACH ROW, AFTER EACH ROW, BEFORE STATEMENT,

of AFTER STATEMENT

Trang 9

< previous page page_190 next page >

Trang 10

< previous page page_191 next page >

Page 191

Table 6-8 Columns in the ALL_TRIGGERS View (continued)

TRIGGERNING_EVENT The type of statement that fires the grigger, causing it to be executed This will be one

or more of the following: INSERT, UPDATE, DELETE

TABLE_OWNER The owner of the table on which the trigger is defined Usually this is the same as the

trigger owner, but it doesn't have to be

TABLE_NAME The name of the table on which the trigger is defined

REFERENCING_NAMES Tells you what correlation names are used in the trigger to reference columns in the

table If the defaults were taken when the trigger was created, the value for this column will be REFFERENCING NEW AS NEW OLD AS OLD

WHEN_CLAUSE The WHEN clase, if any, that was specified when the trigger was created This will

actually be the part of the WHEN clause between parentheses Thus, if the CREATE TRIGGER statement specifies WHEN (new.hire_date = sysdate), this column will return only the new.hire_date = sysdate portion A WHEN clause can only be specified for a row-level trigger, and the trigger only fires if this condition is true

STATUS This will be either ENABLED or DISABLED, and indicates whether or not the

trigger will fire at all

DESCRIPTION This contains part of the orginal staement that was used to create the trigger

Everything following CREATE TRIGGER up until the keyword REFERENCING is stored here This includes the trigger name, the table name, the trigger type, the triggering event, and the list of update columns Using this field provides a more convenient way to get this information than selecting all the other columns way to get this information than selecting all the other columns separately This is especially true

if you are trying to recreate the original CREATE TRIGGER statement

TRIGGER_BODY This is a LONG column containing the PL/sql code that makes up the body of the

trigger

The ALL_TRIGGER_COLS view

The ALL_TRIGGER_COLS view returns one row for each database column referenced or modified in triggers on tables you own or to which you have access I rarely use this view, but if there is ever any doubt about whether or not a trigger uses a particular database column, this view can provide a quick answer Table 6-9 describes the columns in this view

Table 6-9 Columns in the ALL_TRIGGER_COLS View

(table continued on next page)

Ngày đăng: 05/07/2014, 04:20

TỪ KHÓA LIÊN QUAN