LOGSCAN SQL file definition
This syntax specifies overall characteristics of the SQL statements that Log Master creates using the log records selected in your log scan.
For more information about Unicode characters in SQL output files, see Considerations-for-output-files-and-Unicode.
The following figure shows the SQL file definition syntax of the LOGSCAN statement:
Option | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SQL type/output definition | The SQL type/output definition defines the type of SQL that Log Master generates and where it writes the generated SQL. For more information, see SQL-type-output-definition. | ||||||||||||
QUALIFY | Specifies the columns that Log Master includes in the WHERE clauses of generated SQL. By default, Log Master uses available index information to determine what columns to include. To explicitly control the columns used, enter one of the following choices:
| ||||||||||||
VERBOSE | Directs Log Master to embed ANSI-standard comments in the generated SQL. These comments describe unit of recovery identifier (URID) information and other information related to the database structures. This information is useful under some circumstances. This keyword is optional. Regardless of whether you specify this keyword, Log Master can include comments in the generated SQL to provide information about conditions detected during SQL generation. | ||||||||||||
COMMIT FREQUENCY | Specifies how frequently Log Master includes COMMIT statements in the generated SQL. The value can represent a number of SQL statements or a number of transactions. In this context, transactions are considered to be the same as unit of recovery identifiers (URIDs).
If you omit the COMMIT FREQUENCY keyword, the default value is equivalent to one transaction (insert COMMIT statements in output at the same points as in the original SQL). If you specify a value without specifying STATEMENTS or TRANSACTIONS, the default value is TRANSACTIONS. | ||||||||||||
UPDATE ALL COLUMNS | Directs Log Master to generate SQL that updates all columns in a table row (whether the column is changed or not). If you omit this keyword, Log Master generates SQL that updates only the changed columns in a row. | ||||||||||||
DECIMAL POINT | Determines which character Log Master uses to represent the decimal point in the generated SQL. Log Master extracts the default character for DECIMAL POINT from the DSNHDECP module of the subsystem for BSDS and Db2 log input.
When Log Master obtains input from a logical log, it uses the same decimal point character that was in use when the logical log was created. | ||||||||||||
SQLID sqlid | Directs Log Master to generate a SET CURRENT SQLID statement and insert it at the beginning of the generated SQL. When you execute the generated SQL, Db2 runs it under the authority granted to the authorization ID represented by sqlid. Specify a valid authorization ID that has the appropriate authority in your environment. | ||||||||||||
CONCAT OPERATOR | Directs Log Master to use the specified characters as the SQL concatenation operator in output SQL statements. Log Master uses a concatenation operator to generate SQL statements that contain any string constants that are longer than the maximum length supported by the current version of Db2 (for example, 255 or 32,704 characters).
| ||||||||||||
INCLUDE or EXCLUDE INSERT COLUMN NAMES | Directs Log Master to include or exclude column names in SQL INSERT statements. The default value is INCLUDE INSERT COLUMN NAMES. By excluding column names and including only the values, SQL files are smaller.
| ||||||||||||
Column include/exclude | The Column include/exclude definition enables you to control the information in your SQL file based on table columns. For more information, see LOGSCAN-column-include-exclude-definition. | ||||||||||||
Directs Log Master to generate a SET SCHEMA statement and insert it at the beginning of the generated DDL statements. The SET SCHEMA statement sets the default schema for the current environment to the specified schema. The default schema is used as the target schema for all statements issued from the environment that do not explicitly specify a schema name. For more information about SCHEMA, see SCHEMA. | |||||||||||||
Indicates whether to generate a TRANSFER OWNERSHIP statement after the CREATE of an object when the original OWNER value in the log does not match the CREATOR or CREATEBY value. The execution of the DDL will transfer the ownership of the object to the original owner value in the log, or to the specified new owner. This option is for SQL with INCLUDE DDL only.
For more information about TRANSFER OWNERSHIP, see TRANSFER OWNERSHIP. |
More information about SCHEMA and TRANSFER OWNERSHIP YES mutual exclusive
When the SCHEMA option is specified in DDL, SQL, or DROPRECOVERY syntax, Log Master generates a SET SCHEMA statement (the default SCHEMA) at the beginning of the output dataset and does not generate other SET SCHEMA statements afterwards. With TRANSFER OWNERSHIP YES specified, Log Master builds CREATE TABLE, INDEX, or VIEW with an unqualified name, the default SCHEMA is the qualifier. However, a fully qualified name is still used in other DDL statements, such as ALTER and GRANT. These DDL statements may get an SQL error if the qualifier in the log does not match the default SCHEMA.
More information about TRANSFER OWNERSHIP
If you run a TRANSFER OWNERSHIP statement without the proper authorization to perform the transfer, you will get an SQL error. The error will occur when the user executing the statement is not the owner of the object or does not have SECADM authority.
To prevent the SQL error, Log Master will generate a SET CURRENT SQLID statement with the OWNER value from the log before the TRANSFER OWNERSHIP statement for TABLE, INDEX, and VIEW objects. However, the error can still occur when any one of the following conditions exists:
- The old owner is a ROLE or the owner name is longer than 8 bytes in length and cannot be used in a SET CURRENT SQLID statement.
- The use ID executing the DDL is not the owner of the DATABASE, TABLESPACE, or STOGROUP.
- The CREATOR and OWNER of the TABLE, INDEX, or VIEW are different.
Use one of the following resolutions for the error:
- Run the generated DDL using the user ID that initially ran the statements being migrated.
- Generate DDL with TRANSFER OWNERSHIP YES if the CREATOR and OWNER of an object are different.
- Manually add or modify the SET CURRENT SQLID statement to the object owner before the TRANSFER OWNERSHIP statement.
- Run the generated DDL with a user ID that has SECADM authority.
This section contains the following topics: