Oracle metadata
Encyclopedia
The Oracle Database
contains tables which describe what database objects – i.e. tables, procedures, triggers etc. – exist within the database. This information about the information is known as metadata
.
Oracle metadata is information contained within the Oracle Database
about the objects contained within the Oracle database. You can use this information to find all tables accessible by a user, get a list of stored procedures, and get information about many other types of objects in an Oracle database.
The ORACLE application server and Oracle relational database
keep metadata
in two areas: data dictionary tables (accessed via built-in views) and a metadata registry.
The main built-in views accessing Oracle RDBMS data dictionary tables are few, and are as follows:
In addition there are equivalent views prefixed "USER_" which show only the objects owned by the current user (i.e. a more restricted view of metadata) and prefixed "DBA_" which show all objects in the database (i.e. an unrestricted global view of metadata for the database instance). Naturally the access to "DBA_" metadata views requires specific privileges.
Note that NUM_ROWS records the number of rows which were in a table when (and if) it was last analyzed. This will most likely deviate from the actual number of rows currently in the table.
Warning: This is incomplete with respect to multiple datatypes including char, varchar and timestamp and uses extremely old, deprecated dictionary views, back to oracle 5.
pattern match to a single character and should be escaped if you are in fact looking for an underscore character in the LIKE clause of a query.
Just add the following after a LIKE statement:
ESCAPE '_'
And then each literal underscore should be a double underscore: __
Example
LIKE '%__G' ESCAPE '_'
(EMM) is an ISO/IEC 11179
compatible metadata registry
. It stores administered metadata in a consistent format that can be used for metadata publishing
. In January 2006, EMM was available only through Oracle consulting services.
Oracle Database
The Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation....
contains tables which describe what database objects – i.e. tables, procedures, triggers etc. – exist within the database. This information about the information is known as metadata
Metadata
The term metadata is an ambiguous term which is used for two fundamentally different concepts . Although the expression "data about data" is often used, it does not apply to both in the same way. Structural metadata, the design and specification of data structures, cannot be about data, because at...
.
Oracle metadata is information contained within the Oracle Database
Oracle Database
The Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation....
about the objects contained within the Oracle database. You can use this information to find all tables accessible by a user, get a list of stored procedures, and get information about many other types of objects in an Oracle database.
The ORACLE application server and Oracle relational database
Relational database
A relational database is a database that conforms to relational model theory. The software used in a relational database is called a relational database management system . Colloquial use of the term "relational database" may refer to the RDBMS software, or the relational database itself...
keep metadata
Metadata
The term metadata is an ambiguous term which is used for two fundamentally different concepts . Although the expression "data about data" is often used, it does not apply to both in the same way. Structural metadata, the design and specification of data structures, cannot be about data, because at...
in two areas: data dictionary tables (accessed via built-in views) and a metadata registry.
Views for metadata
The total number of these views depends on the Oracle version, but is in a 1000 range.The main built-in views accessing Oracle RDBMS data dictionary tables are few, and are as follows:
- ALL_TABLES – list of all tables in the current database that are accessible to the current user
- ALL_TAB_COLUMNS – list of all columns in the database that are accessible to the current user
- ALL_ARGUMENTS – lists the arguments of functions and procedures that are accessible to the current user
- ALL_ERRORS – lists descriptions of errors on all stored objects (views, procedures, functions, packages, and package bodies) that are accessible to the current user
- ALL_OBJECT_SIZE – included for backward compatibility with Oracle version 5
- ALL_PROCEDURES – (from Oracle 9 onwards) lists all functions and procedures (along with associated properties) that are accessible to the current user
- ALL_SOURCE – describes the text (i.e. PL/SQL) source of the stored objects accessible to the current user
In addition there are equivalent views prefixed "USER_" which show only the objects owned by the current user (i.e. a more restricted view of metadata) and prefixed "DBA_" which show all objects in the database (i.e. an unrestricted global view of metadata for the database instance). Naturally the access to "DBA_" metadata views requires specific privileges.
Example 1: finding tables
Find all Tables that have PATTERN in the table nameExample 2: finding columns
Find all tables that have at least one column that matches a specific PATTERN in the column nameExample 3: counting rows of columns
Estimate a total number of rows in all tables containing a column name that matches PATTERN (this is SQL*Plus specific script)Note that NUM_ROWS records the number of rows which were in a table when (and if) it was last analyzed. This will most likely deviate from the actual number of rows currently in the table.
Example 4: finding view columns
Find view columnsWarning: This is incomplete with respect to multiple datatypes including char, varchar and timestamp and uses extremely old, deprecated dictionary views, back to oracle 5.
Use of underscore in table and column names
The underscore is a special SQLSQL
SQL is a programming language designed for managing data in relational database management systems ....
pattern match to a single character and should be escaped if you are in fact looking for an underscore character in the LIKE clause of a query.
Just add the following after a LIKE statement:
ESCAPE '_'
And then each literal underscore should be a double underscore: __
Example
LIKE '%__G' ESCAPE '_'
Oracle Metadata Registry
The Oracle product Oracle Enterprise Metadata ManagerOracle Enterprise Metadata Manager
The Oracle Enterprise Metadata Manager is a product of the Oracle Corporation that provides an ISO/IEC 11179 metadata registry.-Strategic nature of a metadata registry:...
(EMM) is an ISO/IEC 11179
ISO/IEC 11179
ISO/IEC 11179 is an international standard for representing metadata for an organization in a metadata registry.- Intended purpose :...
compatible metadata registry
Metadata registry
A metadata registry is a central location in an organization where metadata definitions are stored and maintained in a controlled method.-Use of Metadata Registries:...
. It stores administered metadata in a consistent format that can be used for metadata publishing
Metadata publishing
Metadata publishing is the process of making metadata data elements available to external users, both people and machines using a formal review process and a commitment to change control processes....
. In January 2006, EMM was available only through Oracle consulting services.