dbfetch

Fetches schema, table, and column metadata from a database connection.

Syntax

dbfetch {
     SCHEMA connection_name [schema_pattern]
   | TABLE  connection_name schema_name [table_pattern]
   | COLUMN connection_name schema_name table_name [column_pattern]
   | IMPORT { SOURCE rssd_connection_name
            | TARGET rssd_connection_name rssd_source_database }  
}

Parameters

  • connection_name – the name of an existing DA connection object.
  • schema_pattern – (optional) a wildcard pattern to filter the schema results.
  • schema_name – the name of a schema.
  • table_pattern – (optional) a wildcard pattern to filter the table results.
  • table_name – the name of a table.
  • column_pattern – (optional) a wildcard pattern to filter the column results.
  • rssd_connection_name – the name of an existing RSSD connection configured in DA.
  • rssd_source_database – the name of source database which exists in the RSSD.

Examples

  • Example 1 – fetches all the schemas found under the connection prod1:
    dbfetch schema prod1
    go
    The returned result is:
    SCHEMA
    ------------
    dauser
    dbo
    
  • Example 2 – fetches all the table names in the dbo schema with table names that begin with the prefix "rs":
    dbfetch table prod1 dbo rs_*
    go
    The returned result is:
    SCHEMA  TABLE
    ------  -----------------
    dbo     rs_lastcommit
    dbo     rs_threads
    dbo     rs_ticket_history
    
  • Example 3 – fetches column metadata for the cust1 table, showing only the columns with names beginning with the letter " i ":
    dbfetch column prod1 dbo cust1 i*
    go
    The returned result is:
    COLUMN  TYPE     PRECISION  SCALE  KEY
    ------  -------  ---------  -----  -----------
    id      int      0          0      PRIMARY KEY
    
  • Example 4 – fetches source (primary) database names from the RSSD connection:
    dbfetch import source my_rssd
    go
    The returned result is:
    SOURCE DB
    -----------
    prod1.cust1
    
  • Example 5 – fetches target (replicate) database names from the RSSD connection, for the prod1.cust1 source database:
    dbfetch import target my_rssd ‘prod1.cust1’
    go
    The returned result is:
    SOURCE DB     TARGET DB
    -----------   -----------
    prod1.cust1   back1.cust1