Académique Documents
Professionnel Documents
Culture Documents
5
Informix Database
Administration
I
Contents
1.
INTRODUCTION ...........................................................................................3
2.
SUGGESTED READING...............................................................................3
3.
4.
5.
8.
7.
6.
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.
3.1
Introduction to DB-Access
DBAccess provides a user interface for entering, executing, and
debugging Structured Query Language (SQL) statements and Stored
Procedure Language (SPL) routines.
You can use DBAccess for the following aspects of database
processing:
Issuing ad hoc queries and other SQL statements.
Connecting to one or more databases, transferring data
between the database and external text files, and displaying
information about a database.
Displaying system catalog tables and the Information Schema,
which are explained in the IBM Informix Guide to SQL:
Reference.
3.2
3.3
where:
dbname
-log
-dbspace
3.4
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.
4.1
Accessing OAT
The OpenAdmin tool can be accessed through a web browser in your
environment.
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
4.2.1
13
4.2.2
14
Drag the pointer to all the way to the right. This changes the
refresh rate to every 60 seconds.
4.2.3
15
4.2.4
4.3
4.3.1
16
17
4.3.2
Path:
/data/IBM/informix/demo/server/online_root02
Offset:
0 (default)
Size:
50 M
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.
4.3.3
18
4.4
4.4.1
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
21
4.4.2
Click the SQL Explorer menu option. This displays the SQL
Tracing Options. By default, SQL Tracing is turned off.
22
4.4.3
23
4.4.4
24
25
4.4.5
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
5.
5.1
onmode utility
The onmode utility is used to shut down an operating instance or to
change the operating mode of the instance.
It is also used to instantiate and manage High Availability Data
Replication (HDR) and related functionality, as well as manage shared
memory changes.
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
oninit utility
The oninit utility is used to initialize and/or start the instance from an
offline mode. It can also be used to switch operating modes while the
instance is operational.
5.2.1
oninit
Enter oninit command to bring the instance online.
5.2.2
oninit -version
The oninit -version command displays the version of the
Informix server being used.
5.3
onstat utility
The onstat utility is one of the most useful administration utilities in
Informix. It reads shared-memory structures and provides statistics
about the database server at the time that the command is executed.
You can combine multiple onstat option flags in a single command.
The contents of shared memory might change as the onstat output
displays. The onstat utility does not place any locks on shared
memory, so running the utility does not affect performance.
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
5.4
onparams utility
The onparams utility is used to add and/or remove logical logs, resize
and/or relocate the log files, as well as create and/or change buffer
pool settings.
5.4.1
6.
6.1
30
6.2
6.2.1
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
6.3.1
33
7.
7.1
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
7.2.1
36
7.2.2
You should notice that the task execution is now disabled for
Saturdays and Sundays.
37
7.2.3
38
7.3
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 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.
8.
8.1
41
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"
* 100
42
NOTE: Before you executed the previous COMPRESSREPACK-SHRINK command, you set the isolation level to
Repeatable Read (RR). The reason for this is that if you are
doing an online repack or online uncompress at an isolation
level below RR, there is a possibility of seeing phantom rows in
table scans. To avoid this, you can use the RR isolation level.
This does not impact compress, shrink, repack_offline, or
uncompress_offline, only repack and uncompress (online
variants).
NOTE: You can also use the compress, repack and shrink
commands separately.
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)
8.2
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
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
48