DB2 Universal Database V8.1 Certification Exam 700 Study Guide
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.
Figure 4-7. The Add Database dialog.
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:
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.
A database can also be uncataloged by executing the UNCATALOG DATABASE command. The syntax for this command is: UNCATALOG [DATABASE DB] [ DatabaseAlias ] where:
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 |