Cataloging and Uncataloging a DB2 UDB Database


Cataloging and Uncataloging a DB2 UDB Database

Because a database is implicitly cataloged as soon as it is created, most users never have to concern themselves with the cataloging process. However, if you need to catalog a previously uncataloged database, if you want to set up an alternate name for an existing database, or if you need to access a database stored on a DB2 UDB server from a client and you do not have access to the Configuration Assistant, you will need to be familiar with the other tools that can be used to catalog databases. Fortunately, cataloging a database is a relatively straightforward process that can be done using the Control Center and the CATALOG DATABASE command, as well as the Configuration Assistant.

Earlier, we saw that by highlighting the Databases object shown in the objects pane of the Control Center and right-clicking the mouse button, you will bring up a menu that contains a list of options available for database objects. The dialog used to catalog databases (the Add Database dialog) is invoked by selecting Add from this menu. Figure 4-6 shows the Control Center menu items that must be selected in order to activate the Add Database dialog; Figure 4-7 shows what the Add Database dialog looks like when it is first activated.

Figure 4-6. Invoking the Add Database dialog from the Control Center.

graphics/04fig06.gif

Figure 4-7. The Add Database dialog.

graphics/04fig07.gif

You can also catalog a database by executing the CATALOG DATABASE command. The syntax for this command is:

 CATALOG [DATABASE  DB] [  DatabaseName  ] <AS [  Alias  ]> <ON [  Path  ]  AT NODE [  NodeName  ]> <AUTHENTICATION [  AuthenticationType  ]> <WITH "[  Description  ]"> 

where:

DatabaseName

Identifies the name assigned to the database to be cataloged.

Alias

Identifies the alias to be assigned to the database to be cataloged.

Path

Identifies the location (drive and/or directory) where the directory hierarchy and files associated with the database to be cataloged are physically stored.

NodeName

Identifies the node where the database to be cataloged resides. The node name specified should match an entry in the node directory file (i.e., should correspond to a node that has been cataloged).

AuthenticationType

Identifies where and how authentication is to take place when a user attempts to access the database. (Valid values include: SERVER, CLIENT, SERVER_ENCRYPT, and KERBEROS TARGET PRINCIPAL Principal Name , where PrincipalName is the fully qualified Kerberos principal name for the target server.)

Description

A comment used to describe the database entry that will be made in the database directory for the database to be cataloged. The description must be enclosed by double quotation marks.

So, if you wanted to catalog a database that has the name TEST_DB and physically resides in the directory /home/db2data, you could do so by executing a CATALOG DATABASE command that looks something like this:

 CATALOG DATABASE TEST_DB AS TEST_DB ON /home/db2data AUTHENTICATION SERVER 

Since a database must be cataloged before a user/application can connect to it, you're probably wondering why you would ever want to uncatalog a database. Suppose you are running an older version of DB2 UDB, and when you upgrade, you decide to completely uninstall the old DB2 UDB software before installing the latest release. To prevent this software upgrade from having an impact on your existing databases, you could simply uncatalog them before you uninstall the old version of DB2 UDB, then catalog them again after the new DB2 UDB software has been installed. (Migration may or may not be necessary.)

Just as there are two different ways to catalog a DB2 UDB database when the Configuration Assistant is unavailable, there are two ways to uncatalog one: by using the Control Center or by using the UNCATALOG DATABASE command. By highlighting the object shown in the objects pane of the Control Center that corresponds to the database to be removed from the database cat alog and right-clicking the mouse button, you can display a menu that contains a list of options that are available for that particular database. If you then select the Remove item from this menu, you will be presented with a Confirmation dialog, where you will be asked to confirm your decision to uncatalog the database (the name of the database you are about to uncatalog will be displayed in this dialog in an effort to prevent you from accidentally uncataloging the wrong one). Once you confirm that the database specified is to be uncataloged, its entry is removed from both the system and the local database directory; however, the database itself is not destroyed , nor are its tablespace storage containers made available for other databases to use. Figure 4-8 shows the Control Center menu items that must be selected in order to uncatalog an existing database.

Figure 4-8. Uncataloging a database from the Control Center.

graphics/04fig08.gif

A database can also be uncataloged by executing the UNCATALOG DATABASE command. The syntax for this command is:

 UNCATALOG [DATABASE  DB] [  DatabaseAlias  ] 

where:

DatabaseAlias

Identifies the alias assigned to the database to be uncataloged.

So, if you wanted to uncatalog a database that has the name and alias TEST_DB, you could do so by executing an UNCATALOG DATABASE command that looks like this:

 UNCATALOG DATABASE TEST_DB 


DB2 Universal Database V8.1 Certification Exam 700 Study Guide
DB2 Universal Database V8.1 Certification Exam 700 Study Guide
ISBN: 0131424653
EAN: 2147483647
Year: 2003
Pages: 68

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net