Tutorial: Running queries

You can run queries to display and filter information about database objects.

About this task

In this stage of the tutorial, you will view databases in the system catalog.

Procedure

  1. On the DB2 Administration Menu (ADB2) panel, in the Option field, specify 1, as shown in the following example:
    Figure 1. DB2 Administration Menu (ADB2) panel
    Start of change
    ADB2 dmin -------------- DB2 Administration Menu 13.1.0 ------------------ 00:49
    Option ===> 1                                                                  
                                                                                   
       1 - DB2 system catalog                                DB2 System: DD1A      
       2 - Execute SQL statements                            DB2 SQL ID: ADM001     
       3 - DB2 performance queries                           Userid    : ADM001     
       4 - Change current SQL ID                             DB2 Schema: ADM001     
       5 - Utility generation using LISTDEFs and TEMPLATEs   DB2 Rel   : 1315     
       P - Change DB2 Admin parameters                       DB2 F.Lvl : V13R1M501 
      DD - Distributed DB2 systems                           Max ApplC : V13R1M501 
       E - Explain                                           ApplCompat: V13R1M501
       Z - DB2 system administration                         Cat Level : V13R1M501
      SM - Space management functions                        Loc. : DB2B11      
       W - Manage work statement lists                                 
       X - Exit DB2 Admin 			                
      CC - DB2 catalog copy version maintenance	
      CM - Change management                                                       
                                                                                   
    Interface to other DB2 products and offerings:                                 
       I  DB2I   DB2 Interactive                                                   
       C  DB2 Object Comparison Tool			            
    
    End of change
  2. Press Enter.
    The System Catalog (ADB21) panel is displayed.
  3. Specify option D for databases, as shown in the following figure:
    Figure 2. System Catalog (ADB21) panel - object options
    Start of change
    ADB21 min ---------- DD1A System Catalog - Objects ---------------------- 16:17
    Option ===>  D                                                                 
                                                               DB2 System: DD1A    
     AO - Display Authorization options                        DB2 SQL ID: ADM001  
                                                                        
    Object options:                                                                                                                                             
      G - Storage groups                   P - Plans                          
      D - Databases                        L - Collections                    
      S - Table spaces                     K - Packages                            
      T - Tables, views, and aliases     JAR - JAR files        
      V - Views                            H - Schemas                             
      A - Aliases for tables and views     E - User defined data types             
      Y - Synonyms                         F - Functions                           
      X - Indexes                          O - Stored procedures                   
      C - Columns                          J - Triggers                            
      N - Constraints                      Q - Sequences and aliases               
     DS - Database structures            DSP - DS with plans and packages          
    PDC - DB2 pending definition changes  GV - Global variables                    
    XCU - Index cleanup                    RS - REST services
    Enter standard selection criteria: Settings: LIKE operator; Criteria saved.
    Name  . . . .  DB*                       > Grantor . . .           >            
    Schema  . . .                            > Grantee . . .           >           
    Owner . . . .                            >                                     
    In DB/Coll  .                            > Switch Catalog Copy   . . N (N/S/C) 
    And/or other selection criteria (option xC shows you columns for option x)     
    Column  . . .                            > Oper . .        Value . .           
    End of change
  4. Press Enter.
    The Databases (ADB21D) panel is displayed, as shown in the following figure. This panel lists all databases that meet the search criteria.
    Figure 3. Databases (ADB21D)
     ADB21D in ------------------- DD1A Databases ----------------------------------
                                                                                    
     Commands: GRANT  MIG  DIS  STA  STO  UTIL       MOVETB                                   
     Line commands:                                                                 
      T - Tables  S - Table spaces  X - Indexes  G - Storage group  ICS - IC status 
      DIS - Display database  STA - Start database  STO - Stop database  A - Auth   
      ? - Show all line commands                                                    
                              Storage  Buffer          Created      Index          
     Select Name     Owner    Group    Pool       DBID By       T E BPool    I     
            *        *        *        *             * *        * * *        *     
     ------ -------- -------- -------- -------- ------ -------- - - -------- -     
            DB1      ADB      ADBGCH   BP1         271 ISTFL2     E BP2      Y     
            DB1A     DPGROTH  SYSDEFLT BP1         272 DPGROTH    E BP2      Y     
            DB12     DPGROTH  SYSDEFLT BP1         273 DPGROTH    E BP2      Y     
            DB14     SYSIBM   SYSDEFLT BP1           4 SYSIBM       BP2      N     
            DB16     SYSIBM                          6 SYSIBM     E BP0      N     
            DB17     DSCGDB2  SYSDEFLT BP1           7 ISTJE      W BP2      N     
            DB1B     DSCGDB2  SYSDEFLT BP1         257 ISTJE      E BP2      N     
    ******************************* END OF DB2 DATA *******************************
    

    You can filter the databases that are displayed by specifying a search argument in the Name field. You can use a percent sign (%) or an asterisk (*) as a wildcard character in your search argument.

What to do next

Press PF3 to return to the System Catalog (ADB21) panel to complete the next stage of the tutorial.