VIEWS: DBA_, ALL_, USER_ IS 475 Metadata Data about the data—how tables are constructed, what data types are used, what fields are primary or foreign keys, etc. Standard user views include: user_tables => Shows information about the tables owned by the user. Example: select table_name from user_tables; all_tables => Shows information about all the tables the user has access to. Example: select table_name from all_tables where owner like 'IS475%'; user_catalog => Shows the tables and views owned by the user. Example: Select * from user_catalog order by table_type, table_name; all_catalog => All users. Example: select * from all_catalog where owner like 'IS475%'; user_constraints => Shows the constraints for tables owned by the user. Example: Column constraint_name format a15; Column table_name format a12; Column r_constraint_name format a10; Column search_conditiona format a20 truncate; Set pagesize 50; select constraint_name, constraint_type, table_name, r_constraint_name, search_condition from user_constraints; all_constraints => All users. Example: select constraint_name, constraint_type from all_constraints where owner like 'IS475%'; ora_DBA_Exercise_02.doc - 1 user_indexes => Shows the indexes created for the primary keys. Example: select index_name, table_owner, table_name from user_indexes; all_indexes => All users. user_tab_columns => Shows data about each column in each table. Example: select table_name, column_name, data_type from user_tab_columns where table_name = 'ZIPCODE' all_tab_columns => All users. user_views => Shows the SQL statement that defines each view. Example: select text from user_views where view_name = 'ENROLLMENT_VIEW'; all_views: All users. System Data Dictionary Catalog tables/views: (You may not be able to access these views due to limits on rights and roles.) user$ => Table of users. Example: desc user$ Example: select name, ctime from user$ where name like 'J%'; Here are only a few of the USER_, ALL_, and DBA views ora_DBA_Exercise_02.doc - 2 USER VIEWS user_tables Some Column Names Description of View Content user_constraints Lists the tables owned by the current user. Lists the constraints on tables owned by the current user. user_sequences Lists the sequences owned by the current user. user_tab_privs List the table privileges granted to the current user. Lists settings for current user’s password, such as “life time”. Lists resource settings for current user, such as “connect time”. user_password_limits user_resource_limits ALL (DATA DICTIONARY) VIEWS all_tables all_constraints all_cons_columns Lists the columns associated with each constraint. all_tab_privs all_sequences ora_DBA_Exercise_02.doc - 3 DBA VIEWS dba_users Lists all users’ information: ID, account status, profile, etc. dba_profiles Lists all profile settings. dba_tables Lists the name and settings for tables. dba_tab_columns List all columns and their settings in each table. dba_unused_col_tabs dba_segments Lists tables that contain unused columns. List table privileges granted to the current user on any table. Lists information about segments—type, owner, location. dba_indexes Lists indexes, their owner, type, etc. dba_sys_privs Lists system privileges granted. dba_role_privs Lists all roles and grantees. dba_roles Lists all roles. dba_tab_privs dba_catalog dba_tablespaces dba_data_files database_properties Shows the database version, SID (name), etc. ora_DBA_Exercise_02.doc - 4