Professional Documents
Culture Documents
1.4 Informix Database Administration Lab
1.4 Informix Database Administration Lab
Informix Database
Administration
1. INTRODUCTION ...........................................................................................3
2. SUGGESTED READING...............................................................................3
3. INVOKING AND USING THE DB-ACCESS UTILITY ...................................5
3.1 INTRODUCTION TO DB-ACCESS ..................................................................5
3.2 STARTING AN INFORMIX INSTANCE ..............................................................5
3.3 CREATING THE DEMONSTRATION DATABASE ................................................6
3.4 PUTTING THE DB-ACCESS UTILITY TO WORK ...............................................8
4. ADMINISTERING INFORMIX SERVERS WITH OAT.................................11
4.1 ACCESSING OAT ....................................................................................11
4.2 HEALTH CENTER AND THE LOGS...............................................................13
4.3 SPACE ADMINISTRATION AND SERVER ADMINISTRATION ..............................16
4.4 OTHER OAT FEATURES...........................................................................19
5. WORKING WITH THE COMMAND LINE UTILITIES..................................28
5.1 ONMODE UTILITY .....................................................................................28
5.2 ONINIT UTILITY.........................................................................................29
5.3 ONSTAT UTILITY .......................................................................................29
5.4 ONPARAMS UTILITY ..................................................................................30
2
1. Introduction
In this lab, you will learn the basics of administering an Informix instance using
some of the command line utilities as well as the new OpenAdmin Tool (OAT).
OAT for Informix is a PHP-based Web browser administration tool that provides
the ability to administer multiple database server instances from a single location.
Exciting features in the OpenAdmin Tool include:
Health Center: Analyze the current state of the server with detailed statistics and
alert information.
Logs: View previous administration commands, recent messages from the online
log, and the latest backup and recovery information from the ON-Bar Activity log.
Task Scheduler: View and update Scheduler tasks to be run at the current
server.
Space Administration: Manage server space for your system with tools to
administer dbspaces, chunks, checkpoints, and the physical and logical logs.
Server Administration: Configure and validate your servers, as well as
administer high availability clusters (MACH clusters).
Performance Analysis: Get high quality and detailed performance statistics
about your databases with the SQL exploration of each table, statement, or
transaction. Query drill down and session exploration provide detailed
information about every aspect of transactions and statement types. View over
20 system performance reports, such as memory pools, the five slowest
transactions, and server memory usage.
SQL Toolbox: Explore your databases, view table statistics, browser schemas,
run queries, and view query plans.
2. Suggested Reading
3
IBM Informix Administrator’s Reference
This publication provides reference material for Informix Administrators. It
contains comprehensive descriptions of configuration parameters, the system-
monitoring interface (SMI) tables in the sysmaster database, the syntax of
database server utilities such as onmode and onstat.
www.ibm.com/support/docview.wss?uid=swg27010058
4
3. Invoking and Using the DB-Access Utility
5
¾ Change to the “scripts” directory.
cd /home/informix/scripts
6
where:
dbname Name of the stores demo database.
-log Requests transaction logging for the demonstration
database.
-dbspace Requests a particular dbspace location for the
demonstration database.
dbspace_name Houses the demonstration database. If you do not
specify a dbspace name, by default, the data for the
database is put in the root dbspace.
¾ Using the same terminal window opened in the previous
section, enter the following command to create a demonstration
database called “stores”.
dbaccessdemo stores –log
You will see the messages similar to the ones shown in the
following screen shot.
7
3.4 Putting the DB-Access utility to work
In this exercise, you will practice invoking the DB-Access utility and
use it for simple tasks such as connecting to the STORES database,
looking at a table definition, and running a simple query against the
table.
8
¾ Go back to the main menu by selecting Exit twice from the
interactive menu at the top.
9
¾ Press the ESC key when you are finished typing the statement.
This switches from editing mode to interactive mode.
¾ Select Run from the top menu options and press Enter.
The rows in the table should now be displayed on the screen,
one at a time. Select Next from the top menu to see the next
row.
10
4. Administering Informix Servers with OAT
11
¾ This will launch the Firefox web browser with OAT login page.
¾ On the login page, click the Get Servers button to get a list of
available servers.
12
4.2 Health Center and the Logs
Explore the Health Center menu and the Logs menu.
13
4.2.2 Using the Dashboard
¾ Clicking the Dashboard option displays the memory usage
information and the number of transactions information. (Note:
You may need to click the Refresh button in order to display the
graphs)
14
¾ Drag the pointer to all the way to the right. This changes the
refresh rate to every 60 seconds.
15
4.2.4 Viewing the messages in the Online Log
¾ Click the Online Messages option under the Logs menu to
display the messages in the online log. Messages are displayed
in ascending order by date.
16
¾ Click the first dbspace in the table (i.e. rootdbs), to display
detailed information about the space utilization of this dbspace.
17
4.3.2 Adding space to a dbspace
Add a chunk called online_root02 of size 50M to rootdbs
Click the Admin tab while you are in the rootdbs detailed view.
¾ On the Admin page, enter the following details under Add
Space to [rootdbs]
Path: /data/IBM/informix/demo/server/online_root02
Offset: 0 (default)
Size: 50 M
File Creation: Create File if None Exists (default)
This will add a chunk of size 50M to the rootdbs dbspace. You will
also notice a message at the top of the window that says a new chunk
has been added to the dbspace.
18
4.4 Other OAT Features
OAT is a great tool for performance monitoring and troubleshooting.
The Performance Analysis menu has various options that allow you
to control SQL statement tracing, obtain detailed query information,
generate system reports, and examine what all the connections
(sessions) are doing at a given point in time.
19
¾ Select the Show Dynamic Only option from the drop down list
at the top of the window to display only dynamic parameters.
Changes to dynamic parameters take effect right away; they do
not require an instance re-start.
20
¾ Select the Show Recommendations option from the drop
down list at the top of the window to display the parameters
with some recommendations from OAT.
¾ As you notice, all parameters with recommendations are
highlighted in yellow.
21
4.4.2 SQL Tracing administration
OAT is a great tool for performance monitoring and troubleshooting.
The Performance Analysis menu has various options that allow you
to control SQL statement tracing, obtain detailed query information,
generate system reports, and examine what all the connections
(sessions) are doing at a given point in time.
¾ Click the SQL Explorer menu option. This displays the SQL
Tracing Options. By default, SQL Tracing is turned off.
22
4.4.3 Query drill down
¾ Click the SQL Explorer menu option again, after enabling SQL
Tracing. By default this option displays the SQL Tracing
summary information by statement type (if you don’t see any
statements there, wait a little and click SQL Explorer again, or
use DB-Access to issue a few select statements)
23
¾ Click on the magnifying glass next to the first statement to get
more details:
24
¾ Create a sample report with the Server Configuration,
Computer Resource Information, and Computer OS
Information.
¾ Select the check box next to these items and click the Create
Report button.
¾ OAT creates a consolidated report and displays it in a separate
browser window.
25
4.4.5 Display database information
¾ Click the Databases menu option under the SQL Tool Box
menu to display the Databases page on the right side.
¾ This page displays a list of the databases on the selected
database server, as well as a chart of the space used by each
database. Click the Graph or Data buttons to change the view
of database space usage.
26
4.4.6 SQL Editor
¾ Click the SQL Editor Menu option to bring up the SQL Editor
Page. The SQL editor page is used to run ad-hoc SQL queries.
¾ Enter the following query in the query editor and click the Run
Query button.
select * from state order by code;
27
¾ The query results will be displayed on the screen.
In this exercise, you will get to use important command line utilities
with Informix.
Enter each of the commands described in this section with the options
that are discussed.
5.1.1 onmode –j
¾ onmode –j changes the instance mode to single-user. Only
DBSA / Informix can connect to the instance in this mode. This
mode is very useful when you need to perform administrative
tasks on the instance that require restricted access.
28
5.1.2 onmode -m
¾ onmode –m brings the database server online from quiescent
mode or from administration mode.
5.1.3 onmode –k
¾ onmode –k takes the server off-line.
5.2.1 oninit
¾ Enter oninit command to bring the instance online.
5.3.1 onstat –l
The onstat -l command displays information about the physical
and logical log buffers and log files.
As you see, 5 logical logs were created by default. In the next
exercise, you will add an additional logical log and use onstat -l
again to check the number of log files.
29
BONUS: Using the Informix documentation or another source, try to
determine what each of the options in the Flags column in output
refers to.
30
6.2 Using the ADMIN() function
The ADMIN() function returns an integer indicating the success or
failure of the command that was executed. It also inserts a row into the
sysadmin:command_history table which contains a list of all
commands that the Administration API ran. The table also contains the
results of the commands.
If > 0, the command succeeded and a row was inserted into
command_history table.
If = 0, the command succeeded, but a row could not be inserted into
into the command_history table.
If < 0, the command failed, but a row was inserted into the
command_history table.
You can use the integer return code to query the command_history
table to review the results of that function invocation.
31
¾ Press the ESC key to exit from editing mode and select the
Run option to run the statement and execute the function.
¾ Note down the expression number returned after the execution
of the function. You will use that number in the following step.
¾ Select Query-Language > New and enter the following SQL
statement.
select * from command_history where
cmd_number = expression_number;
32
6.3 Using the TASK() function
The TASK() function returns a string indicating the status of command
just entered.
33
7. Working with the DB Scheduler
34
¾ Press the ESC key to exit out of editing mode and select the
Run option to run the statement.
¾ Running the SQL statement above displays the information
stored in the ph_task table for a task with the name Auto
Update Statistics Evaluation.
35
7.2 Using the OAT Scheduler Interface
The Task Scheduler is the interface created to work with the Informix
DB Scheduler. It displays the scheduled task details and information
about previously executed tasks. It also allows you to create new
tasks and schedule them to run at a later time, as well as make
changes to existing tasks.
36
7.2.2 Making changes to tasks
Try disabling the execution of the Auto Update Statistics Evaluation
task on Saturdays and Sundays.
¾ While on the Auto Update Statistics Evaluation task details
page, select the Disabled option from the drop down menu for
Saturday and Sunday and click the Save button.
¾ You should notice that the task execution is now disabled for
Saturdays and Sundays.
37
7.2.3 Checking the task execution statistics
¾ Click the Task Runtimes option under the Task Scheduler
menu to display the task execution statistics such as the
number of executions, average time it took to run the task, total
time, last run time and last execution status.
38
7.3 Auto Update Statistics Configuration
The Auto Update Statistics option under the Server Administration
menu allows you to configure this feature in OAT.
¾ Click the Auto Update Statistics option. This will display the
results of the Auto Update Stats Evaluation and Results
tasks by database.
¾ Click the Info tab at the top of the page. This displays the
Evaluation and Refresh schedule information as well as the
parameters that are used by these two tasks.
39
¾ Click the Alerts tab to display AUS Alerts.
¾ Click the List tab to display the list of commands that will be
executed by the Refresh task the next time it runs.
40
¾ Click the Config tab to display and change the values of AUS
configuration parameters. Just for fun, change the
AUS_CHANGE parameter value to “20” and click Save.
In this section, you will use the new data compression feature in
Informix, introduced in 11.50.xC4. All compression features are
controlled through the SQL Admin API.
There are four steps when compressing a table:
¾ Enable compression
¾ Compress the table
¾ Repack the table (moving the data to the front of the dbspace)
¾ Shrink (freeing the unused space for use by other tables in that
dbspace)
41
¾ Create and load a sample table “comptab” with data by running
the following script:
dbaccess stores
/home/informix/scripts/sqls/createComptab.sql
You can use the oncheck –pt command to get the number of data
pages used by the table. Run this command and fill in the first row of
the following table with the results:
oncheck -pt stores:informix.comptab | grep
"data pages"
42
¾ Compress, repack and shrink the table:
set isolation to repeatable read;
execute function sysadmin:task(“table compress
repack shrink”, “comptab”);
¾ You can also experiment and uncompress the table again using
the following command:
execute function
sysadmin:task(“table uncompress”, “comptab”)
43
When compressing a larger table, you can use the “onstat –g dsk”
command to monitor the progress, where the OP column will show
one the following flags, depending on the compression action being
performed:
(1 = create_dictionary, 2 = compress, 4 = repack, 8 = repack_offline,
16 = shrink, 32 = uncompress, 64 = uncompress_offline,
128=estimate_compression, 256 = purge_dictionary)
¾ Under the Space Administration menu item on the left, you will
find an option called Compression:
44
Click the small icon ( ) next to the USAGE column for the
comptab table. (open a terminal and type dbaccess stores
/home/informix/scripts/sqls/createComptab.sql if
the comptab table does not exist yet)
¾ From here, you can execute all the (un)compress, repack and
shrink options:
45
¾ If the table is compressed, select the Uncompress option and
click OK to uncompress the table. Alternatively, try compressing
the table if it is uncompressed. From the resulting window, click
Go To Task List to see the result of that action. In the screen
shot below, the uncompress operation was successful.
46
This concludes the lab. If you have completed all the exercises and have extra
time, feel free to continue exploring with the utilities/functionality described here.
Otherwise, you can close any open windows.
47
© Copyright IBM Corporation 2010
All Rights Reserved.
IBM Canada
8200 Warden Avenue
Markham, ON
L6G 1C7
Canada
Printed in Canada
01/2010
IBM, IBM (logo), and Informix are trademarks or registered Information concerning non-IBM products was obtained from the
trademarks of International Business Machines Corporation in the suppliers of those products, their published announcements or
United States, other countries, or both. other publicly available sources. IBM has not tested those products
and cannot confirm the accuracy of performance, compatibility or
Linux is a trademark of Linus Torvalds in the United States, other any other claims related to non-IBM products. Questions on the
countries, or both capabilities of non-IBM products should be addressed to the
suppliers of those products.
UNIX is a registered trademark of The Open Group in the United
States, other countries, or both The information in this publication is provided AS IS without
warranty. Such information was obtained from publicly available
Windows is a trademark of Microsoft Corporation in the United sources, is current as of January 2010, and is subject to change.
States, other countries, or both. Any performance data included in the paper was obtained in the
specific operating environment and is provided as an illustration.
Other company, product, or service names may be trademarks or Performance in other operating environments may vary. More
service marks of others. specific information about the capabilities of products described
should be obtained from the suppliers of those products.
References in this publication to IBM products or services do not
imply that IBM intends to make them available in all countries in
which IBM operates. The following paragraph does not apply to the
United Kingdom or any other country where such provisions are
inconsistent with local law:
48