0% found this document useful (0 votes)
660 views

DB2 Command List

The document summarizes common commands used with the DB2 command line processor (CLP) including commands to start and stop the database, backup and restore databases, list database information, and run SQL statements. Some key commands are db2start to start DB2, db2stop to stop DB2, backup database to backup a database, restore database to restore a database, and connect to connect to a database and run SQL queries. The CLP is used to manage and query databases from the command line.

Uploaded by

puneetswarnkar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
660 views

DB2 Command List

The document summarizes common commands used with the DB2 command line processor (CLP) including commands to start and stop the database, backup and restore databases, list database information, and run SQL statements. Some key commands are db2start to start DB2, db2stop to stop DB2, backup database to backup a database, restore database to restore a database, and connect to connect to a database and run SQL queries. The CLP is used to manage and query databases from the command line.

Uploaded by

puneetswarnkar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CLP - Command Line Processor Command Center Control Center db2cmd - Open DB2 Command Window db2eva - Event

Analyzer db2evmon - Event Monitor Productivity Tool db2exfmt - Explain Table Format Tool db2ckbkp - Check Backup db2cc - Start Control Center db2admin - DB2 Administration Server db2icrt - Create Instance db2idrop - Remove Instance db2ilist - List Instances db2trc - Trace db2start - Start DB2 db2stop - Stop DB2 db2sync - Start DB2 Synchronizer db2tbst - Get Tablespace State The db2 command starts the command line processor (CLP). The CLP is used to execute database utilities, SQL statements and online help. Common commands include: RESTART DATABASE CREATE DATABASE DROP DATABASE GET DATABASE CONFIGURATION RESET DATABASE CONFIGURATION UPDATE DATABASE CONFIGURATION LIST DATABASE DIRECTORY LIST ODBC DATA SOURCES BACKUP DATABASE RESTORE DATABASE TERMINATE QUIT Launch Control Center for: Privileges, Authorities and Access Rights SQL: (Connect to a Database). connect to <dbname> user <username> using <userpswd> ex: connect to TEST user db2admin using db2admin View a tables structure Connect to the DB first. describe table <schema>.<tablename> Backup and Restore (also Copy a DB). Create a directory to backup to: Ex: C:\db2\mybackup Backup your DB: Ex: db2 => backup database SAMPLE TO c:\db2\mybackup Restore the DB: db2 => restore database SAMPLE from C:\db2\mybackup Restore the DB to another name (ie: Copy DB):

db2 => restore database SAMPLE from C:\db2\mybackup into MYSAMPLE Run SQL Commands db2=> (examples) list database directory - lists databases on DB2 server connect to sample user db2admin using db2admin - connects to a db. list tables - lists tables in the DB. describe select * from emp_act - lists the structure of a table. select * from EMP_ACT - list the contents in the table. disconnect <database name> - clears connection

You might also like