Vous êtes sur la page 1sur 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

Vous aimerez peut-être aussi