CREATE DATABASE Usage Notes - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Rules for Using CREATE DATABASE

The following rules apply to CREATE DATABASE:
  • The maximum number of databases and users for any one system is 4.2 billion.
  • When a database contains a default journal table, that journal table shares the PERMANENT storage capacity of the database with its data tables.
  • If necessary, the defined PERM, SPOOL, or TEMPORARY space is changed to the highest multiple of the number of AMPs on the system less than or equal to the requested space.
  • When a CREATE DATABASE statement is processed, the system places an EXCLUSIVE lock on the database being created.
  • You can only specify options once.

PERMANENT, SPOOL, and TEMPORARY Space Supported by CREATE DATABASE

You can define the maximum disk space available for specific purposes for any database.

If necessary, the system changes the defined PERMANENT, SPOOL, or TEMPORARY disk space limits to the highest multiple of the number of AMPs on the system less than or equal to the requested space.

Global temporary tables require a minimum of 512 bytes from the PERM space of their containing database or user. This space is used for the table header of the table.

Limit the SPOOL space assigned to a database to a level appropriate for the workloads of its users. Minimize the allotment of spool for any database to a size that is large enough to permit result sets to be handled and space management routines such as MiniCylPack to run when disk space becomes low, but small enough to force spool overflow errors when runaway queries resulting from Cartesian products and other common SQL coding errors occur.

See Determining Available User Table Data Space and Managing Space: Operational DBAs for more information about user space.

Local Journaling in CREATE DATABASE

LOCAL single AFTER image journals are supported analogously to single BEFORE image journals as follows:
  • The DROP DATABASE privilege is required to create or drop LOCAL single AFTER image journals. This is the same privilege required to perform the analogous operation on single BEFORE image journals.
  • LOCAL single AFTER image journaling is restricted to non-fallback data tables.

Teradata MultiLoad, Teradata Parallel Transporter, and Teradata FastLoad are impacted by the use of LOCAL journaling.

Journal Tables and Default Map

If the CREATE DATABASE statement specifies a journal table and a default map, the journal table is created using this default map. The journal table map must be a contiguous map with the same AMPs as TD_GlobalMap.

If the CREATE DATABASE statement specifies a journal table without specifying a default map, the system determines the map for the journal table in the following order of precedence:
  • Default map, if defined, for the profile of the database creator. See the CREATE PROFILE DEFAULT MAP option.
  • Default map, if defined, for the database creator. See the CREATE USER DEFAULT MAP option.
  • System-default map.

Activating Permanent Journaling (CREATE DATABASE)

If you specify only DEFAULT JOURNAL TABLE = table_name, then the system creates a journal table, but does not activate it.

To activate the permanent journal, you must also specify the AFTER JOURNAL journaling option or the BEFORE JOURNAL option.

This action causes permanent journaling to be activated for all tables created in this database afterward.

To determine which tables in your system are journal tables, use the following query:

SELECT DBC.dbase.databasename (FORMAT 'X(15)'),
DBC.tvm.tvmname (FORMAT 'X(25)')
FROM DBC.tvm,DBC.dbase
WHERE DBC.dbase.databaseid=DBC.tvm.databaseid
AND   DBC.tvm.tablekind='j'
ORDER BY 1,2;

To determine which databases and users in your system have a default journal table defined for them, use the following query:

SELECT d.databasename (TITLE'Database'),TRIM(dx.databasename)
||'.'||TRIM(t.tvmname)(TITLE 'Journal')
FROM DBC.dbase AS d,DBC.TVM AS t, DBC.dbase AS dx
WHERE d.journalid IS NOT NULL
AND   d.journalid <> '00'xb
AND   d.journalid = t.tvmid
AND   t.databaseid = dx.databaseid
ORDER BY 1;

To determine which tables in your system are being journaled, use the following query:

SELECT TRIM(Tables_DB)||'.'||TableName (TITLE 'Table',
CHARACTER(26)),'Assigned To' (TITLE ' '),TRIM(journals_db)
||'.'||JournalName (TITLE 'Journals', CHARACTER(26))
FROM DBC.journals
ORDER BY 1,2;

Alternatively:

SELECT TRIM(d.databasename)||'.'||TRIM(t.tvmname) (FORMAT
'x(45)',TITLE 'Table'),TRIM(dj.databasename)
||'.'||TRIM(tj.tvmname) (TITLE 'Journal')
FROM DBC.TVM  AS t, DBC.TVM  AS tj, DBC.dbase AS d, DBC.dbase AS dj
WHERE t.journalid IS NOT NULL
AND   t.journalid <> '00'xb
AND   t.journalid = tj.tvmid
AND   d.databaseid = t.databaseid
AND   dj.databaseid = tj.databaseid
ORDER BY 1;