IBM Books

Command Reference

CATALOG DATABASE

Stores database location information in the system database directory. The database can be located either on the local workstation or on a remote node.

Scope

In a partitioned database environment, when cataloging a local database into the system database directory, this command must be issued from a node on the server where the database resides.

Authorization

One of the following:

Required Connection

None. Directory operations affect the local directory only.

Command Syntax

>>-CATALOG----+-DATABASE-+--database-name----+------------+----->
              '-DB-------'                   '-AS--alias--'
 
>-----+--------------------+------------------------------------>
      +-ON--+-path--+------+
      |     '-drive-'      |
      '-AT NODE--nodename--'
 
>-----+-----------------------------------------------------------+>
      |                 .-SERVER-------------------------------.  |
      '-AUTHENTICATION--+-CLIENT-------------------------------+--'
                        +-DCS----------------------------------+
                        +-SERVER_ENCRYPT-----------------------+
                        +-DCS_ENCRYPT--------------------------+
                        '-DCE SERVER PRINCIPAL--principalname--'
 
>-----+-------------------------+------------------------------><
      '-WITH--"comment-string"--'
 

Command Parameters

DATABASE database-name
Specifies the name of the database to catalog.

AS alias
Specifies an alias as an alternate name for the database being cataloged. If an alias is not specified, the database manager uses database-name as the alias.

ON path/drive
On UNIX based systems, specifies the path on which the database being cataloged resides. On OS/2 or the Windows operating system, specifies the letter of the drive on which the database being cataloged resides.

AT NODE nodename
Specifies the name of the node where the database being cataloged resides. This name should match the name of an entry in the node directory. If the node name specified does not exist in the node directory, a warning is returned, but the database is cataloged in the system database directory. The node name should be cataloged in the node directory if a connection to the cataloged database is desired.

AUTHENTICATION
Note:Required only if a DB2 Version 2 or greater client is communicating with a DB2 Version 1 server.

The authentication value is stored for remote databases (it appears in the output from LIST DATABASE DIRECTORY) but it is not stored for local databases.

Specifying an authentication type can result in a performance benefit. For more information about authentication types, see the Administration Guide.

SERVER
Specifies that authentication takes place on the node containing the target database.

CLIENT
Specifies that authentication takes place on the node where the application is invoked.

DCS
Specifies that authentication takes place on the node containing the target database, except when using DB2 Connect, when it specifies that authentication takes place at the DRDA application server (AS).

SERVER_ENCRYPT
Specifies that authentication takes place on the node containing the target database, and that passwords are encrypted at the source. Passwords are decrypted at the target, as specified by the authentication type cataloged at the source.

DCS_ENCRYPT
Specifies that authentication takes place on the node containing the target database, except when using DB2 Connect; in that case, authentication takes place at the DRDA application server (AS). Passwords are encrypted at the source, and decrypted at the target, as specified by the authentication type cataloged at the source.

DCE
Specifies that authentication takes place using DCE Security Services. When authentication is DCE, and an APPC connection is used for access, only SECURITY=NONE is supported.

SERVER PRINCIPAL principalname
Fully qualified DCE principal name for the target server. This value is also recorded in the keytab file at the target server.

WITH "comment-string"
Describes the database or the database entry in the system database directory. The maximum length of a comment string is 30 characters. A carriage return or a line feed character is not permitted. The comment text must be enclosed by double quotation marks.

Examples

   db2 catalog database sample on /databases/sample
      with "Sample Database"

Usage Notes

Use CATALOG DATABASE to catalog databases located on local or remote nodes, recatalog databases that were uncataloged previously, or maintain multiple aliases for one database (regardless of database location).

DB2 automatically catalogs databases when they are created. It catalogs an entry for the database in the local database directory and another entry in the system database directory. If the database is created from a remote client (or a client which is executing from a different instance on the same machine), an entry is also made in the system database directory at the client instance.

If neither path nor node name is specified, the database is assumed to be local, and the location of the database is assumed to be that specified in the database manager configuration parameter dftdbpath.

Databases on the same node as the database manager instance are cataloged as indirect entries. Databases on other nodes are cataloged as remote entries.

CATALOG DATABASE automatically creates a system database directory if one does not exist. The system database directory is stored on the path that contains the database manager instance that is being used, and is maintained outside of the database.

List the contents of the system database directory using LIST DATABASE DIRECTORY.
Note:If directory caching is enabled (see the configuration parameter dir_cache in GET DATABASE MANAGER CONFIGURATION), database, node, and DCS directory files are cached in memory. An application's directory cache is created during its first directory lookup. Since the cache is only refreshed when the application modifies any of the directory files, directory changes made by other applications may not be effective until the application has restarted.

To refresh the CLP's directory cache, use TERMINATE. To refresh DB2's shared cache, stop (db2stop) and then restart (db2start) the database manager. To refresh the directory cache for another application, stop and then restart that application.

See Also

UNCATALOG DATABASE.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]