Document 15033203

advertisement
Matakuliah
Tahun
: T0413
: 2009
DB2 Tools
Pertemuan 3
DB2 Configuration
Bina Nusantara University
3
The DB2 Registry
list variables set
for instance
list all available
variables for platform
sets a variable
list all currently
set variables
db2set
db2set –all
db2set –lr
db2set <parameter>=<value>
Eg: db2set db2comm=tcpip
A place to specify environment or platform specific settings
e.g. settings for RAID, optimizer paths not yet fully integrated,
communication protocols, environment specific performance enhancements
Settings can be applied to various levels
environment
instance
global (all instances)
Bina Nusantara University
4
DB2 Commands & SQL/XML,
Xquery Statements
DB2:
The big
Picture
Bina Nusantara University
SQL/XML, Xquery
Statements
create bufferpool
create tablespace
create table
alter bufferpool
alter tablespace
alter table
select
insert
update
delete
...
DB2 System Commands
db2set
db2start
db2stop
db2ilist
db2icrt
db2idrop
...
DB2 CLP Commands
db2
update dbm cfg
catalog db
list node directory
create database
list applications
list tablespaces
...
<sql statement>
xquery <
>
DB2 Tools
Command Line Tools
Command Editor
Command Line Processor
Command Window
Development Tools
DB2 Developer Workbench
Project Deployment Tool
General Administration Tools
Control Center
Journal
License Center
Replication Center
Task Center
DB2 Environment
Instance 'myinst'
Database Manager
Configuration
File (dbm cfg)
Database MYDB1
Database
Configuration
File (db cfg)
Information
Information Center
Check for DB2 Updates
Monitoring Tools
Event Analyzer
Health Center
Indoubt Transaction Manager
Memory Visualizer
Activity Monitor
Setup Tools
Configuration Assistant
Configure DB2 .Net Data Provider
Default DB2 Selection Wizard
First Steps
Register Visual Studio Add-ins
Port
5
DB2 Tools
Start  Programs  IBM DB2  ...
Bina Nusantara University
6
Roadmap to the GUI tools
IBM DB2
Information
Information
Center
(db2ic)
Bina Nusantara University
Command
Line Tools
Command
Editor
(db2ce)
Command
Line
Processor
(db2)
Command
Window
(db2cmd
or db2cw)
General
Administration
Tools
Monitoring
Tools
Control
Center
(db2cc)
Journal
(db2journal)
Replication
Center
(db2rc)
Task Center
(db2tc)
License
Center
Setup
Tools
Configuration
Assistant
(db2ca)
First Steps
(db2fs)
Event
Analyzer
(db2eva)
Register Visual
Health
Studio Add-ins
Center
(db2vsregister)
(db2hc)
InDoubt
Satellite
Transaction
Synchronizer
Manager
(db2indbt)
Activity
Memory
Monitor
Visualizer
(db2am) (db2memvis)
7
Control Center
• The main DB2 administration tool
• The Control Center allows you to:
– create, modify and manage databases
– Manage database objects (tables, indexes,
etc.)
– Launch the other GUI tools
Bina Nusantara University
8
Control Center Panes
Object
Tree
Pane
Contents
Pane
Object
Detail
Pane
Bina Nusantara University
9
Advanced Control Center View
Note the
Additional
Database
Objects
Bina Nusantara University
10
Command Editor
• Using Command Editor, you can execute DB2
commands and SQL, analyze the execution plan
of an SQL statement, and view/update query
result sets
• You can launch Command Editor several ways:
– As a standalone application
• Navigate through the Windows Start Menu
– START -> PROGRAMS -> IBM DB2 -> COMMAND LINE TOOLS -> COMMAND
EDITOR
• From a command prompt, type db2ce
• From the Control Center, click the Command Editor icon on the Control
Center Toolbar
Bina Nusantara University
• From the Tools menu in Control Center
11
• Embedded within the Control Center
– Right click on the SAMPLE database icon in the Control Center’s
Object Tree pane and select the Query menu item
– Any time a queryable object is selected (database, table, etc.), you
can launch the Command Editor by clicking the Query link in the
Control Center’s Object Detail pane
Back to Control
Center view
Input area
Command Editor
view selected
Add a database
connection
Database currently
connected to
Output area
Bina Nusantara University
Character used to
delimit the end of a
SQL statement or
DB2 command
12
Command Editor Add (database connection) Dialog
• A database connection must exist in order to submit any SQL
statements
• You can inherit the connection from Control Center (by launching
Command Editor in embedded mode) or by clicking the Add button
in Command Editor
Select a database
configured on the system
Check this box to use
the ID and password
of user currently
logged in to the
operating system
Bina Nusantara University
Valid OS user ID and
password
13
Command Editor – Commands Tab
Runs the command
(Can also use the
CTRL+Enter shortcut)
Bina Nusantara University
Runs the command and
generates an access plan
(more on this later)
Generates an access
plan without running the
command (more on this
later)
14
The SQL Assist Wizard
SQL Assist Wizard
can also be launched
from the Selected
menu item
Bina Nusantara University
15
Sections of the
SQL Query.
The query
constructed so far.
Bina Nusantara University
16
Show SQL Button
• Most of the GUI tools/wizards allow you to see the
actual command or SQL statement that is created as a
result of using the tool/wizard to perform an action
• This is very handy for:
– Learning SQL syntax
– Saving the statement to a file (or the Windows clipboard)
for later use
• can be later imported directly into Command Editor
Bina Nusantara University
17
Command Window
– Only on Windows. On Linux use the Linux shell
– Can be started with “db2cmd” or “db2cw” from an MS-DOS prompt
– The Command Window is also the same as the Command Line
Processor in non-interactive mode (as we will see next)
Bina Nusantara University
18
Command Line Processor (CLP)
– Available on all DB2 servers and clients
– The prompt starts with “db2 =>”
Bina Nusantara University
19
Starting a CLP session
non-interactive mode
db2 connect to eddb
db2 "select * from syscat.tables" more
(double quotes may be required)
|
|
interactive mode
db2
db2=> connect to eddb
db2=> select * from syscat.tables
Bina Nusantara University
20
Task Center
Bina Nusantara University
21
Task Center – No Tools Catalog Warning Dialog
•
•
Task Center requires that a tools catalog be created
– This catalog stores all the meta data and information about scheduled tasks
If you did not create the tools catalog when the database was created, an error
message dialog will be displayed like the one below when Task Center is launched
– In order to schedule tasks, you must first create the tools catalog
(you can do this when you schedule the first task)
Bina Nusantara University
22
Journal
• A DBA’s activity journal in online form
• You can view:
– Task History: All attempted scheduled tasks and their success
status
– Database History: A record of database activities performed
(backup, restore, REORGs, etc.)
– Message: History of messages returned by DB2 tools. This is
useful if you want to recall and compare old error messages, or if
you close a dialog box too quickly or by accident
– Notification Log: contains system-level message. Critical errors
are recorded here
Bina Nusantara University
23
Journal
Select what events
to view
Select database
and system
View more details
by double-clicking
on an entry
Bina Nusantara University
24
Health Center
Customize health
indicator settings
Select what types
of alerts to use
Choose screen
refresh time
Double click any
alerts that appear
for more details
Bina Nusantara University
25
Configuring Health Alert Notification
Bina Nusantara University
Health Center > Health Center menu > Configure > Alert Notification
26
Download