12 Managing Objects with Data Dictionary Views

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/82

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

83 Terms

1
New cards

What is the Oracle data dictionary?

A collection of tables and views automatically built and maintained by Oracle that stores metadata about all database objects. Who created them, when, etc.

2
New cards

Which data dictionary views store information about granted system privileges?

  • USER_SYS_PRIVS - to current user

  • DBA_SYS_PRIVS - to users and roles

  • ROLE_SYS_PRIVS - to roles

3
New cards

Which data dictionary views store information about granted roles?

  • USER_ROLE_PRIVS - to current user

  • DBA_ROLE_PRIVS - to users and roles

4
New cards

Which data dictionary views store information about grants on objects?

  • USER_TAB_PRIVS - Granted privileges on objects for which the user is the owner, grantor, or grantee

  • DBA_TAB_PRIVS - All grants on objects in the database

  • ROLE_TAB_PRIVS - Table privileges granted to roles

5
New cards

Which data dictionary view stores information about session privileges that the user currently has set?

SESSION_PRIVS

6
New cards

Where will user’s added comments to the table be stored in the data dictionary view?

In USER_TAB_COMMENTS, ALL_TAB_COMMENTS, and DBA_TAB_COMMENTS

7
New cards

Where will user’s added comments a column in a table be stored in the data dictionary view?

USER_COL_COMMENTS, ALL_COL_COMMENTS, and DBA_COL_COMMENTS

8
New cards

What is the syntax for adding a comment?

COMMENT ON objectType fullObjectName is c1;

Where objectType - TABLE, COLUMN, INDEXTYPE, OPERATOR, MATERIALIZED VIEW, and others

If it’s a table then name the TABLE_NAME

If it’s a column then TABLE_NAME.COLUMN_NAME

9
New cards

What are the views that store comments for all objects and columns of all tables and views in the database?

ALL_TAB_COMMENTS, ALL_COL_COMMENTS

10
New cards

What are the other USER_ views?

  • USER_IND_COLUMNS - index columns of the user’s tables owned by the current user

  • USER_SEQUENCES

  • USER SYNONYMS - private synonyms owned by the current user (public synonyms are displayed in ALL_SYNONYMS and DBA_SYNONYMS)

  • USER_TAB_COLUMNS - columns in user’s own tables and views

  • USER_TAB_PRIVS - grants on objects owned by the current user

  • and USER_VIEWS

11
New cards

What does USER_DEPENDENCIES show?

Dependencies to and from a user’s objects owned by the current user

12
New cards

What does USER_ERRORS show?

Current errors on stored objects owned by the current user

13
New cards

What does USER_INDEXES show?

Indexes owned by the current user

14
New cards

What does USER_COL_PRIVS show?

Grants on columns of tables owned by the current user

15
New cards

What does USER_CONS_COLUMNS show?

Accessible columns in constraint definitions for tables owned by the current user

16
New cards

What does the V_$ (for views), V$ (for public synonyms) prefix indicate in a data dictionary view?

Information about dynamic performance views, each of which has a public synonym counterpart. Stores information about the local database instance.

17
New cards

What does the GV_$ (for views), GV$ (for public synonyms) prefix indicate in a data dictionary view?

Global dynamic performance views.

18
New cards

What are the other data dictionary view prefixes?

eg. SM$, AUDIT_, CHANGE_, TABLE_, GLOBAL_, DICT_, NLS_, SESSION_, ROLE_, RESOURCE_, DATABASE_, DBMS_, COLUMN_, or no prefix, etc.

19
New cards

What is allowed to users when interacting with meta data?

To comment them

20
New cards

Is there any abstraction to the meta data?

Yes, many data dictionary objects are renamed via public synonyms. There are multiple levels of abstraction.

21
New cards

What do data dictionary store?

  • Names of DB objects, their owners, when they were created

  • Names of each table’s columns, data types, precision and scale

  • Any constraints

  • Views, indexes, and sequences

  • And more

22
New cards

What is a SYS account?

It is a super user with master privileges to everything in the database. Mostly only DBA has access to the SYS account.

23
New cards

What does metadata mean in the context of Oracle?

It means 'data about data'; information describing database objects such as tables, views, indexes, constraints, sequences, etc. The result of each DDL statement is recorded.

24
New cards

Who owns the data dictionary base tables?

The SYS user account. No user should ever alter data owned by SYS or else the integrity of database may be compromised.

25
New cards

Can users directly modify data dictionary tables?

No, users cannot modify them; Oracle updates them automatically after DDL operations.

26
New cards

What is the purpose of data dictionary views?

They provide read-only access to metadata stored in the data dictionary.

27
New cards

What does the USER_ prefix indicate in a data dictionary view?

Information about objects owned by the current user.

28
New cards

What does the ALL_ prefix indicate in a data dictionary view?

Information about objects accessible to the current user, regardless of owner.

29
New cards

What does the DBA_ prefix indicate in a data dictionary view?

Information about all objects in the database, regardless of owner or privileges.

30
New cards

Why does USER_TABLES not include an OWNER column?

Because all rows refer to the current user's objects, so OWNER is implicit.

31
New cards

What are dynamic performance views?

Views beginning with V$ or GV$ that provide real-time information about database activity.

32
New cards

What is the public synonym prefix for dynamic performance views?

V$

33
New cards

What is the recommendation for querying V$ views?

Limit to simple queries; for complex joins, copy data into temporary tables first then perform joins on the temporary tables because of lack of read consistency.

34
New cards

What does V$DATABASE contain?

It’s a dynamic performance synonym that stores database name, the creation date, OS platform, etc.

35
New cards

What does V$INSTANCE contain?

It’s a dynamic performance synonym that stores instance name, host name, startup time, etc.

36
New cards

What does V$PARAMETER contain?

Dynamic performance synonym that stores the current system parameter settings such as NLS_LANGUAGE, NLS_DATE_LANGUAGE, SQL_TRACE, NLS_CURRENCY, etc

37
New cards

What does V$SESSION show?

Many current settings for each individual user session such as login times, machine names, and transaction states.

38
New cards

What does V$RESERVED_WORDS list?

Reserved SQL keywords and whether they are always or conditionally reserved.

39
New cards

What does V$OBJECT_USAGE monitor?

Usage of index objects.

40
New cards

What does V$TIMEZONE_NAMES contain?

Includes two columns: TZNAME - Time zone region name and TZABBREV - abbreviations.

41
New cards

What does the DICTIONARY view contain?

A list of all data dictionary views with their names and descriptions.

42
New cards

How many entries are typically in the DICTIONARY view?

Thousands (e.g., 3,228 in one sample installation).

43
New cards

How can you search DICTIONARY for views about indexes?

By running SELECT * FROM DICTIONARY WHERE COMMENTS LIKE '%index%';

44
New cards

What does USER_CATALOG show?

A summary of tables, views, synonyms, and sequences owned by the user.

There are two columns: TABLE_NAME and TABLE_TYPE

45
New cards

What is the synonym for USER_CATALOG?

CAT.

46
New cards

What does USER_OBJECTS show?

Information about all objects owned by the user.

47
New cards

What is the synonym for USER_OBJECTS?

OBJ.

48
New cards

What does USER_TABLES show?

Metadata about tables owned by the current user (e.g., table name, status, row movement, avg row length, owner).

49
New cards

What does USER_TAB_COLUMNS show?

Metadata about columns of tables owned by the user (name, data type, precision, scale, length).

50
New cards

What are synonyms for USER_TABLES and USER_TAB_COLUMNS?

TABS and COLS respectively.

51
New cards

What statement allows users to add comments to tables or columns?

COMMENT statement.

52
New cards

What are the views for table comments?

USER_TAB_COMMENTS, ALL_TAB_COMMENTS, DBA_TAB_COMMENTS.

53
New cards

What are the views for column comments?

USER_COL_COMMENTS, ALL_COL_COMMENTS, DBA_COL_COMMENTS.

54
New cards

How can you remove a comment?

By setting the comment to an empty string with COMMENT ON … IS '';

55
New cards

How can you check if a view is invalid?

Query the STATUS column in USER_OBJECTS.

56
New cards

Where can you find the SQL text of a view?

In the USER_VIEWS view, in the TEXT column.

57
New cards

What happens if a column used by a view is dropped from its base table?

The view status becomes INVALID.

58
New cards

What does USER_SYS_PRIVS show?

System privileges granted to the current user.

59
New cards

What does USER_TAB_PRIVS show?

Privileges on objects where the user is the owner, grantor, or grantee.

60
New cards

What does USER_ROLE_PRIVS show?

Roles granted to the current user.

61
New cards

What does DBA_SYS_PRIVS show?

System privileges granted to all users and roles.

62
New cards

What does DBA_TAB_PRIVS show?

All grants on objects in the database.

63
New cards

What does DBA_ROLE_PRIVS show?

Roles granted to users and roles.

64
New cards

What does ROLE_SYS_PRIVS show?

System privileges granted to roles.

65
New cards

What does ROLE_TAB_PRIVS show?

Table privileges granted to roles.

66
New cards

What does SESSION_PRIVS show?

Privileges that the user currently has in the session.

67
New cards

What does USER_CONSTRAINTS show?

Information about constraints on tables owned by the user.

68
New cards

What does CONSTRAINT_TYPE = P mean?

PRIMARY KEY constraint.

69
New cards

What does CONSTRAINT_TYPE = R mean?

FOREIGN KEY constraint (referential integrity).

70
New cards

What does CONSTRAINT_TYPE = U mean?

UNIQUE constraint.

71
New cards

What does CONSTRAINT_TYPE = C mean?

CHECK constraint or NOT NULL constraint.

72
New cards

Which column shows ON DELETE rules?

DELETE_RULE column.

73
New cards

Which column shows CHECK constraint conditions?

SEARCH_CONDITION column.

74
New cards

What does USER_CONS_COLUMNS show?

Columns involved in constraints and referenced tables/columns for foreign keys.

75
New cards

How can you find all tables with a specific column name?

Query ALL_TAB_COLUMNS or USER_TAB_COLUMNS with WHERE COLUMN_NAME = 'X'.

76
New cards

Which view lists all dictionary views with descriptions?

DICTIONARY.

77
New cards

Which view lists sequences accessible to the current user, regardless of owner?

ALL_SEQUENCES.

78
New cards

Who owns the data dictionary?

SYS.

79
New cards

Which objects can you comment on with COMMENT statement (exam relevant)?

TABLE and COLUMN.

80
New cards

Which view contains info about columns in all tables in the database?

DBATABCOLUMNS.

81
New cards

Which abbreviation in USER_CONSTRAINTS indicates FOREIGN KEY?

R.

82
New cards

What does metadata mean?

Data about data.

83
New cards

What happens to a view’s status if a column used by the view is dropped?

It becomes INVALID.