Catalogo Oracle
Catalogo Oracle
Catálogo
Esquema: un conjunto de estructuras de datos lógicas (objetos del esquema), propiedad de un usuario
Un esquema contiene, entre otros, los objetos siguientes:
tablas
vistas
índices
secuencias
disparadores
sinónimos
clusters
Referenciar un nombre de un objeto del esquema: user1.tabla1
El catálogo de Oracle: diccionario de datos (tablas base y vistas)
Los usuarios acceden a las vistas del catálogo:
USER Lo que el usuario ha creado, o sea, lo que está en su esquema.
ALL A lo que el usuario tiene acceso, esto es, lo que ha creado y a lo que le han otorgado acceso.
DBA A lo que el DBA puede acceder, (a lo que todos los usuarios pueden acceder).
Dictionary (catálogo)
Vista DICTIONARY (sinónimo DICT)
Nombre ¿Nulo? Tipo
----------------------------------- ------ ----------
TABLE_NAME VARCHAR2(30)
COMMENTS VARCHAR2(4000)
Objects
{DBA|ALL|USER}_OBJECTS (Vista) selección de algunas columnas
Column Datatype Description
OWNER VARCHAR2(128) Owner of the OBJECTS definition.
OBJECT_NAME VARCHAR2(128) Name associated with the OBJECTS definition.
OBJECT_TYPE VARCHAR2(128) Type of the object: TABLE, VIEW, INDEX,
SEQUENCE, SYNONYM.
CREATED DATE Timestamp for the creation of the OBJECTS.
STATUS VARCHAR2(128) Status of the OBJECTS: VALID, INVALID, or N/A
(always valid).
Catalog
{DBA|ALL|USER}_CATALOG (Vista)
TABLE_NAME VARCHAR2(30) Name of the INDEX, TABLE, CLUSTER, VIEW, SYNONYM, SEQUENCE
TABLE_TYPE VARCHAR2(11) Type of the INDEX, TABLE, CLUSTER, VIEW, SYNONYM, SEQUENCE
Tables
{DBA|ALL|USER}_TABLES (vista) Selección de algunas columnas
Column Datatype Description
OWNER VARCHAR2(128) User name of the owner of the table.
TABLE_NAME VARCHAR2(128) Name of the table.
TABLESPACE_NAME VARCHAR2(128) Name of the tablespace.
CLUSTER_NAME* VARCHAR2(128) Name of the cluster, if any, to which the table belongs.
PCT_FREE* NUMBER(10) Minimum percentage of free space in a block.
PCT_USED* NUMBER(10) Minimum percentage of used space in a block.
INI_TRANS* NUMBER(10) Initial number of transactions.
MAX_TRANS* NUMBER(10) Maximum number of transactions.
INITIAL_EXTENT* NUMBER(10) Size of the initial extent in bytes.
NEXT_EXTENT* NUMBER(10) Size of secondary extents in bytes.
MIN_EXTENTS* NUMBER(10) Minimum number of extents allowed in the segment.
MAX_EXTENTS* NUMBER(10) Maximum number of extents allowed in the segment.
PCT_INCREASE* NUMBER(10) Percentage increase in extent size.
BACKED_UP* VARCHAR2(1) If the table was backed up since last change.
NUM_ROWS* NUMBER(10) Number of rows in the table.
BLOCKS* NUMBER(10) Number of data blocks allocated to the table.
EMPTY_BLOCKS* NUMBER(10) Number of data blocks allocated to the table that contain no data.
AVG_SPACE* NUMBER(10) Average amount of free space (in bytes) in a data block allocated to the
table.
AVG_ROW_LEN* NUMBER(10) Average length of a row in the table in bytes.
Columnas
{DBA|ALL|USER}_TAB_COLUMNS (vista) Selección de algunas columnas
DATA_PRECISION NUMBER Decimal precision for NUMBER datatype; binary precision for FLOAT datatype, null for all
other datatypes
NULLABLE VARCHAR2(1) Specifies whether a column allows NULLs. Value is N if there is a NOT NULL constraint
on the column or if the column is part of a PRIMARY KEY. The constraint should be in
an ENABLE VALIDATE state.
OBJECT_NAME OBJECT_TYPE
------------------------------ -------------------
TABS SYNONYM
OID_TEXT_LENGTH NUMBER Length of the WITH OID clause of the typed view
VIEW_TYPE_OWNER VARCHAR2(30) Owner of the type of the view if the view is a typed view
El SQLPLUS sólo deja ver unos pocos caracteres de la columna tipo LONG, para ver más:
SET LONG 300 (por ejemplo)
Índices
{DBA|ALL|USER}_INDEXES (vista) Selección de columnas
…. …… ……
Restricciones
{DBA|ALL|USER}_CONSTRAINTS (vista) Selección de columnas
Column Datatype Description
OWNER VARCHAR2(30) Owner of the constraint definition
TABLE_NAME VARCHAR2(30) Name associated with the table (or view) with constraint definition
DEFERRABLE VARCHAR2(14) Indicates whether the constraint is deferrable (DEFERRABLE) or not (NOT
DEFERRABLE)
DEFERRED VARCHAR2(9) Indicates whether the constraint was initially deferred (DEFERRED) or not
(IMMEDIATE)
STATUS VARCHAR2(9) Enforcement status of constraint (ENABLED or DISABLED)
VALIDATED VARCHAR2(13) Whether all data obeys the constraint (VALIDATED or NOT VALIDATED)
Restricciones
Recordemos que Oracle permite activar y desactivar las
restricciones, lo que aparece en las columnas STATUS y
VALIDATED:
ENABLE VALIDATE Se comprueba para todas las filas existentes y
nuevas.
ENABLE NOVALIDATE Se comprueba sólo para las filas nuevas.
DISABLE No se comprueba.
El cambio de status:
ALTER TABLE dept1 DISABLE CONSTRAINT NN_DEPT_CTD;
ALTER TABLE dept1 ENABLE NOVALIDATE CONSTRAINT NN_DEPT_CTD;
ALTER TABLE dept1 ENABLE VALIDATE CONSTRAINT NN_DEPT_CTD;
Restricciones
{DBA|ALL|USER}_CONS_COLUMNS (vista)
Column Datatype NULL Description
OWNER VARCHAR2(30) NOT NULL Owner of the constraint definition
CONSTRAINT_NAME VARCHAR2(30) NOT NULL Name of the constraint definition
TABLE_NAME VARCHAR2(30) NOT NULL Name of the table with the constraint definition
COLUMN_NAME VARCHAR2(4000) Name of the column or attribute of the object type
column specified in the constraint definition
POSITION NUMBER Original position of the column or attribute in the
definition of the object
Sinónimos
{DBA|ALL|USER}_SYNONYMS (vista) Selección de columnas
TABLE_NAME VARCHAR2(30) Name of the object referenced by the synonym. Although the
column is called TABLE_NAME, the object does not necessarily
have to be a table. It can be any general object such as a view,
sequence, stored procedure, synonym, and so on.
Sinónimos
CREATE SYNONYM <sinónimo> FOR <object>;
Usuarios
{DBA|ALL|USER}_USERS (vista)
¿Quién soy?
SELECT USER
FROM DUAL
Parámetros de configuración SGBD
V$PARAMETER (Vista) (selección de columnas)
…. ….. ….