sync schema (synchronize schema)

Allows common shared schemas across the existing databases to be retrieved. The command compares the schemas on all of the databases and retrieves those that are common.

Syntax

sync[hronize] schema [-schema schemalist [-retrieve_only] [-restart [-force]] | -apply [-skip_first] | -show [[-ddl ddlnum] [-count n] | [-failed_only]]]

Options

Table 2-119 GDSCTL sync schema Options

Option Description
-apply

Specifies that the previously retrieved DDLs should be run in the catalog.

-count n

Specifies the maximum number of entries to show.

-ddl ddlnum

Specifies the DDL numeric identifier.

-failed_only

Shows only errored out statements.

-force

Forces sync without user confirmation.

-restart

Sync from the beginning, erasing schemas synced earlier.

-retrieve_only

Specifies that the DDLs of the common schemas should be retrieved only from the databases and stored in the catalog but not applied.

-schema schemalist

Specifies that only the listed schemas will be retrieved. Specify all to include all non-Oracle schemas.

-show

Shows DDL statements and their execution status.

-skip_first

Specifies that the first failed DDL statement is skipped.

Usage Notes

This command is used only when the catalog is created for a federated database, which can be created by using option -for_federated_database of the create shardcatalog command. This option is mutually exclusive with –sharding parameter. The rest of the steps are similar to sharded database environment setup with user-defined sharding [create shardcatalog, add gsm, add shardspace, add shard, deploy]. After deployment is complete, the sync schema command can be run to import specified schemas from shards to the catalog.
The sync ddl command combines two operations:
1. Importing and applying schemas on the catalog.
2. Viewing the DDLs generated by combining schemas from shards.
The first operation is the default behavior and it requires a mandatory –schema parameter, which is list of schemas to import from shards. Note that all can be supplied to the -schema parameter to retrieve all non-Oracle schemas common to all shards and which do not exist on the catalog.This operation can be split into two steps using -retrieve_only and -apply options. The option -retrieve_only will retrieve schemas from the shards and generate the required DDL statements to be applied, but it does not execute these statements. To execute them at a later point, the -apply option is used. If, for some reason, a DDL execution fails, subsequent statements will not be executed as there could be dependencies on the failed DDL. When –apply is run again after fixing the issue, it will start from the first failed DDL statement and continue execution.
The second operation, -show is for examining DDL statements and their execution status.

Example

GDSCTL> sync schema -schema myschema
GDSCTL> sync schema -schema foo,bar
GDSCTL> sync schema -schema foo,"Bar"
GDSCTL> sync schema -schema all