Sunteți pe pagina 1din 13

Data Dictionary / Directory

DBC

Crashdumps Sys_Calendar SysAdmin SYSDBA SystemFE

Data Dictionary / Directory Tables Views of DD/D Tables


Object definitions Administrative
System event logs Security
System message table Supervisory
Journals and Restart control tables End User
Accounting information Operational
Access control tables
Macros
Add calculation sequence
Generate utilization reports
Reset accounting values
Authorize secured functions
Selecting Information about Created Objects
DBC.Children[X] Hierarchical relationship information.

DBC.Databases[X] Database, user and immediate parent information.

DBC.Users Similar to Databases view, but includes columns specific to users.

DBC.Tables[X] Tables, views, macros, triggers, and stored procedures information.

DBC. ShowTblChecks Database table constraint information.

DBC.ShowColChecks Database column constraint information.

DBC.Columns[X] Information about columns in tables and views, and parameters in macros.

DBC.Indices[X] Table index information.

DBC.IndexConstraints (V2R5) - Provides information about index constraints, e.g., PPI definition.

DBC.AllTempTables Information about all global temporary tables materialized in the system.

DBC.Triggers Information about event-driven, specialized procedures attached to a single


table and stored in the database.
Teradata Administrator List Columns of a View
Teradata Administrator can be used to list the columns of DD/D views (and tables).

Appendix E of
this manual
contains a listing
of all the DD/D
views and
columns for
Teradata V2R5.1.
Teradata Administrator Object Options

Teradata
Administrator can
also be used to
display object details.

For example, right-


click on the object
(e.g., Department
table) and a menu of
options is displayed.

In this example, the


Indexes option was
selected.
Creating New Users and Databases
DBC

SYSDBA

Human_Resources Accounting

Personnel Benefits

PR01 PR02 PR03 BF01 BF02 BF03

You can grant CREATE DATABASE authority to any user.


The user may then create other users and databases from:
• The user’s own space, or
• The space of another user or database (if authorized).
CREATE DATABASE Statement
CREATE DATABASE database_name AS A
CD FROM db_name

,
A PERMANENT = n
PERM BYTES ;

SPOOL = n TEMPORARY = n
BYTES BYTES

ACCOUNT = 'account_id' FALLBACK


NO PROTECTION

JOURNAL AFTER JOURNAL


NO BEFORE NO
DUAL DUAL
LOCAL
NOT LOCAL

DEFAULT JOURNAL TABLE = table_name


db_name.
CREATE USER Statement
CREATE USER name AS PERMANENT =n A
FROM db_name PERM BYTES ,

,
A PASSWORD = password
NULL ;
SPOOL = n TEMPORARY = n STARTUP = 'string;'
BYTES BYTES

ACCOUNT = 'account_id' FALLBACK


('acct_id', 'acct_id', …) NO PROTECTION

DEFAULT DATABASE = db_name COLLATION = coll_seq DEFAULT CHARACTER SET = ch_dt

JOURNAL AFTER JOURNAL


NO BEFORE NO
DUAL DUAL
LOCAL
NOT LOCAL
DEFAULT JOURNAL TABLE = table_name DATEFORM = INTEGERDATE
db_name. ANSIDATE
NULL
TIMEZONE = LOCAL DEFAULT ROLE = role_name PROFILE = profile_name
quotestring NULL NULL
sign NONE
NULL ALL (V2R5.1)
CREATE USER and the Data Dictionary
EXPLAIN
CREATE USER tfact06 AS PERM = 10e6, SPOOL = 100e6, PASSWORD = secure1time;
Explanation
1) First, we lock data base tfact06 for exclusive use.
2) Next, we lock a distinct DBC."pseudo table" for write on a RowHash to prevent global deadlock for
DBC.DataBaseSpace.
3) We lock a distinct DBC."pseudo table" for write on a RowHash to prevent global deadlock for
DBC.AccessRights.
4) We lock a distinct DBC."pseudo table" for write on a RowHash to prevent global deadlock for DBC.Parents.
5) We lock a distinct DBC."pseudo table" for write on a RowHash to prevent global deadlock for DBC.Owners.
6) We lock DBC.DataBaseSpace for write, we lock DBC.AccessRights for write, we lock DBC.Parents for write,
we lock DBC.Owners for write, we lock DBC.Accounts for write on a RowHash, we lock DBC.DBase for
write on a RowHash, and we lock DBC.DBase for write on a RowHash.
7) We execute the following steps in parallel.
1) We do a single-AMP ABORT test from DBC.DBase by way of the unique primary index with no
residual conditions.
2) We do a single-AMP ABORT test from DBC.Roles by way of the unique primary index with no
residual conditions.
3) We do a single-AMP ABORT test from DBC.DBase by way of the unique primary index.
4) We do a single-AMP ABORT test from DBC.DBase by way of the unique primary index.
5) We do an INSERT into DBC.DBase.
6) We do a single-AMP UPDATE from DBC.DBase by way of the unique primary index with no residual
conditions.
7) We do a single-AMP RETRIEVE step from DBC.Parents by way of the primary index with no residual
conditions into Spool 1 (all_amps), which is redistributed by hash code to all AMPs. Then we do a
SORT to order Spool 1 by row hash.
8) We do an all-AMPs MERGE into DBC.Owners from Spool 1 (Last Use).
CREATE USER and the Data Dictionary
(cont.)
9) We execute the following steps in parallel.
1) We do an INSERT into DBC.Owners.
2) We do a single-AMP RETRIEVE step from DBC.Parents by way of the primary index with no residual
conditions into Spool 2 (all_amps), which is redistributed by hash code to all AMPs. Then we do a
SORT to order Spool 2 by row hash.
10) We do an all-AMPs MERGE into DBC.Parents from Spool 2 (Last Use).
11) We execute the following steps in parallel.
1) We do an INSERT into DBC.Parents.
2) We do an INSERT into DBC.Accounts.
3) We do a single-AMP RETRIEVE step from DBC.AccessRights by way of the primary index into Spool 3
(all_amps), which is redistributed by hash code to all AMPs.
12) We execute the following steps in parallel.
1) We do a single-AMP RETRIEVE step from DBC.AccessRights by way of the primary index into Spool 3
(all_amps), which is redistributed by hash code to all AMPs.
2) We do an all-AMPs RETRIEVE step from DBC.AccessRights by way of an all-rows scan into Spool 4
(all_amps), which is redistributed by hash code to all AMPs. Then we do a SORT to order Spool 4 by
row hash.
13) We do an all-AMPs JOIN step from DBC.Owners by way of a RowHash match scan, which is joined to
Spool 4 (Last Use). DBC.Owners and Spool 4 are joined using a merge join. The result goes into Spool 3
(all_amps), which is redistributed by hash code to all AMPs. Then we do a SORT to order Spool 3 by row
hash.
14) We do an all-AMPs MERGE into DBC.AccessRights from Spool 3 (Last Use).
15) We flush the DISKSPACE and AMPUSAGE caches.
16) We do an all-AMPs ABORT test from DBC.DataBaseSpace by way of the unique primary index.
17) We do an INSERT into DBC.DataBaseSpace.
18) We do an all-AMPs UPDATE from DBC.DataBaseSpace by way of the unique primary index with no residual
conditions.
19) We flush the DISKSPACE and AMPUSAGE caches.
20) We spoil the parser's dictionary cache for the database.
21) Finally, we send out an END TRANSACTION step to all AMPs involved in processing the request.
-> No rows are returned to the user as the result of statement 1.
MODIFY USER Statement
,
MODIFY USER name AS
;
PASSWORD = pwd RELEASE PASSWORD LOCK STARTUP = NULL
NULL FOR USER 'string;'

PERMANENT =n SPOOL = n TEMPORARY = n


PERM BYTES BYTES BYTES

ACCOUNT = 'account_id' FALLBACK COLLATION = coll_seq


('acct_id', 'acct_id', …) NO PROTECTION

DEFAULT DATABASE = db_name DEFAULT CHARACTER SET = character_data_type

DATEFORM = INTEGERDATE JOURNAL AFTER JOURNAL


ANSIDATE NO BEFORE NO
NULL DUAL DUAL
LOCAL
NOT LOCAL
DEFAULT JOURNAL TABLE = table_name DROP DEFAULT JOURNAL TABLE
db_name. =table_name

TIMEZONE = LOCAL DEFAULT ROLE = role_name PROFILE = profile_name


quotestring NULL NULL
sign NONE
NULL ALL (V2R5.1)
Teradata Administrator
Tools Menu Options
Teradata Administrator
can be used to create
and manage users and
databases.

Tools menu
• Selections to create
and modify
databases and uses,
grant/revoke access
rights, and send ad
hoc query requests
to Teradata RDBMS.
• Options include the
ability to clone a
user, move space,
and set preferences.
• This example
illustrates how to
create a database by
completing the
entries.
Teradata Administrator
GRANT/REVOKE Rights
Teradata Administrator can be used to easily grant or revoke access rights.
Tools Î Grant/Revoke Î Object Rights

• Select the object name and


object type.
• Select who is going to get
the right.
• Select the rights.
Teradata Administrator
Rights on DB/User
Teradata Administrator can also be used to easily view existing access rights

Right-click on the
database AU and
select the option.
In this example,
Rights on DB/User
was selected.

S-ar putea să vă placă și