- Sacramento - The California State University

advertisement
CONFIGURATION AND PERFORMANCE EVALUATION OF THE TRUCK DATAWAREHOUSE SYSTEM
Chetan Krishna
B.E, Visveswaraiah Technological University, Karnataka, India, 2005
PROJECT
Submitted in partial satisfaction of
the requirements for the degree of
MASTER OF SCIENCE
in
COMPUTER SCIENCE
at
CALIFORNIA STATE UNIVERSITY, SACRAMENTO
SPRING
2010
CONFIGURATION AND PERFORMANCE EVALUATION OF THE TRUCK DATAWAREHOUSE SYSTEM
A Project
by
Chetan Krishna
Approved by:
__________________________________, Committee Chair
Ying Jin, Ph.D
__________________________________, Second Reader
Ahmed Salem, Ph.D
____________________________
Date
ii
Student: Chetan Krishna
I certify that this student has met the requirements for format contained in the University
format manual, and that this project is suitable for shelving in the Library and credit is to
be awarded for the Project.
__________________________, Graduate Coordinator
Cui Zhang, Ph.D
Department of Computer Science
iii
________________
Date
Abstract
of
CONFIGURATION AND PERFORMANCE EVALUATION OF THE TRUCK DATAWAREHOUSE SYSTEM
by
Chetan Krishna
Truck Data Warehouse (TDW) System is a web-based application developed at
the California State University Sacramento for the California Department of
Transportation (Caltrans). The TDW System allows Caltrans to use this web-based
application system to generate online reports on various statistics related to truck data
that passes through the different weigh stations across California.
The current prototype system of TDW was developed using Oracle 10g database
and SUSE Linux 9.0 as the operating system. It also uses Oracle Business Intelligence
(BI) tools such as Oracle Discoverer Plus to generate the BI reports. Moreover, this
application uses Google Maps API and JSP to locate the weight station on the map. SQL
loader utility was used for loading ASCII files in a very specific format to populate the
database.
In this project, the existing prototype application is being recreated in a
virtualized environment by using VMware ESXi 4.0 Update 1 as the virtualization
software and Oracle Enterprise Linux 4.0 as the operating system. Oracle 10g Release 2
iv
and MySQL-server-5.1.45-1 databases are setup to compare the execution time analyze
the efficiency and behavior of these databases in a virtualized environment. The
described scenario is being created on a single physical machine where execution times
of the pre-defined reports in these two environments are compared and analyzed.
_______________________, Committee Chair
Ying Jin, Ph.D
_______________________
Date
v
DEDICATION
This work is dedicated to my parents, D.C. Krishna & G. Nalini Krishna, uncle
K.P. Nagaraja, aunt G. Vani Nagaraja and my love without their confidence, patience,
support, understanding and most of all their love the completion of this work would not
have been possible.
vi
ACKNOWLEDGMENTS
I take this opportunity to express my sincere gratitude to the people who have
helped and supported me throughout the work of the project.
I would like to thank my project advisor, Dr. Ying Jin for all her valuable
guidance, support and advice. She encouraged throughout the life cycle of this project
and was always there to provide valuable suggestions and assistance during the
implementation of this project. I am very grateful for her assistance with flexibility in
time which helped me work fulltime along with working on the project. I express my
honest gratitude and appreciation for her continuous support throughout this project.
I would like to thank Dr. Ahmed Salem for being the Second Reader and
providing valuable feedback towards the completion of this project. Also, I would like to
thanks Dr. Cui Zhang for her continuous support and advice.
My personal thanks to my friends, mentors Benjamin Z. Schaffer and Lynne
Onitsuka for helping me overcome some of the many technical obstacles in implementing
the setup and configuration of the project. Special thanks to friends who have always
cheered me on during the tough times and have provided their valuable advice and
support, especially Shashikumar Nanjaiah, Susheel Kumar, Pradeep Manjuraj and Navin
Verma.
vii
Finally I would like to thank Sushma, my parents, my uncle & aunt for their love,
constant support and encouragement in my endeavor to complete this project.
viii
TABLE OF CONTENTS
Page
Dedication .......................................................................................................................... vi
Acknowledgments............................................................................................................. vii
List of Tables .................................................................................................................... xii
List of Figures .................................................................................................................. xiii
Chapter
1. BACKGROUND AND PURPOSE ................................................................................ 1
1.1 Existing System – Background Information ............................................................. 1
1.2 Project Purpose ......................................................................................................... 1
1.3 Project Organization ................................................................................................. 2
2. VIRTUALIZATION ....................................................................................................... 3
2.1 History of Virtualization ........................................................................................... 3
2.2 Need for x86 Virtualization ...................................................................................... 3
2.3 What is Virtualization ............................................................................................... 4
2.4 What is a Virtual Machine ........................................................................................ 4
2.5 Advantages of a Virtual Machine ............................................................................. 5
ix
3. INSTALLATION AND CONFIGURATION OF ORACLE ......................................... 7
3.1 Installation and Configuration of VMware ESXi ..................................................... 7
3.2 Installation and Configuration of VMware ESXi (vSphere) Client.......................... 9
3.3 Installation and Configuration of Oracle Enterprise Linux 4.0 Virtual Machine ... 12
3.4 Installation and Configuration of Oracle 10g Release 2 Application Server.......... 18
3.4.1 System Requirements........................................................................................... 19
3.4.2 Software Requirements ........................................................................................ 20
3.4.3 Kernel Parameters ................................................................................................ 22
3.4.4 Set Shell Limits for the Oracle User .................................................................... 24
3.4.5 Operating System Groups and User ..................................................................... 24
3.4.6 Environment Variables ........................................................................................ 26
3.4.7 Check If Port 1521 is in Use ................................................................................ 27
3.4.8 Starting up the Oracle Application Installer ........................................................ 28
3.4.9 Setup Variables for Oracle ................................................................................... 31
3.5 Installation and Configuration of Oracle 10g Release 2 Middle-Tier .................... 32
3.6 Configuration of the Oracle Database..................................................................... 34
4. INSTALLATION AND CONFIGURATION OF MYSQL ......................................... 40
x
4.1 About MySQL ........................................................................................................ 40
4.2 Installation of MySQL ............................................................................................ 41
4.3 Configuration of the MySQL Database .................................................................. 43
5. PERFORMANCE COMPARISON .............................................................................. 45
5.1 Environment Staging .............................................................................................. 45
5.2 Execution Time for Oracle Database ...................................................................... 47
5.3 Execution Time for MySQL Database ................................................................... 47
5.4 Execution Time Comparison .................................................................................. 48
6. SUMMARY AND FUTUREWORK ........................................................................... 51
Appendix A. Oracle Database Queries ............................................................................. 53
Appendix B. MySQL Database Queries ........................................................................... 60
Appendix C. Execution Time for Oracle Database .......................................................... 67
Appendix D. Oracle Web Report Queries ........................................................................ 69
Appendix E. Execution Time for MySQL Database ........................................................ 80
Appendix F. MySQL Web Report Queries....................................................................... 82
References ......................................................................................................................... 93
xi
LIST OF TABLES
Page
Table 1: Custom Linux Partition Table ............................................................................ 16
Table 2: System Requirements for OAS Infrastructure & Middle Tier ........................... 19
Table 3: Software Requirements for OAS Infrastructure & Middle Tier ......................... 21
Table 4: Kernel Parameters............................................................................................... 22
Table 5: Commands to View Current Kernel Parameters ................................................ 22
Table 6: Shell Limits for Oracle User ............................................................................... 24
Table 7: MySQL Setup Directory Structure ..................................................................... 42
Table 8: Hardware Specification ...................................................................................... 47
Table 9: Average Execution Time Comparison................................................................ 48
Table 10: Average Execution Time Comparison ............................................................. 48
xii
LIST OF FIGURES
Page
Figure 1: VMware Virtual Machine ................................................................................... 5
Figure 2: vSphere Client Download ................................................................................. 10
Figure 3: vSphere Client Login ........................................................................................ 11
Figure 4: vSphere Console ................................................................................................ 14
Figure 5: Linux Installation Boot Screen .......................................................................... 15
Figure 6: Oracle Bash Profile Configuration .................................................................... 31
Figure 7: Record Count in Oracle Database ..................................................................... 46
Figure 8: Record Count in MySQL Database ................................................................... 46
Figure 9: Execution Time Comparison ............................................................................. 49
xiii
1
Chapter 1
BACKGROUND AND PURPOSE
1.1 Existing System – Background Information
Truck Data Warehouse (TDW) System is a web-based application developed at
the California State University Sacramento for the California Department of
Transportation (Caltrans) [1]. The TDW System allows Caltrans to use this web-based
application system to generate online reports on various statistics related to truck data
that passes through the different weigh stations across California.
The current prototype system of TDW was developed using Oracle 10g database
and SUSE Linux 9.0 as the operating system. It also uses Oracle Business Intelligence
(BI) tools such as Oracle Discoverer Plus to generate the BI reports. Moreover, this
application used Google Maps API and JSP to locate the weight station on the map. SQL
loader utility was used for loading ASCII files in a very specific format to populate the
database [1].
1.2 Project Purpose
The current prototype application is being recreated in a virtualized environment
by using VMware ESXi 4.0 Update 1 as the virtualization software, Oracle Enterprise
Linux 4.0 as the operating system. Oracle 10g Release 2 database and MySQL database
2
are used to analyze the efficiency and behavior of the Oracle database and the MySQL
database in a virtualized environment. The described scenario is created on a single
physical machine where the performances of the pre-defined report handling capabilities
of both the databases in a virtualized environment are compared against each other.
1.3 Project Organization
This section provides a brief idea on how the rest of the report is organized.
Chapter 2 describes the history, need and concept of virtualization, definition of a virtual
machine and the advantages of adopting the virtualization software. Chapter 3 covers the
system configuration involved in the setup of the VMware ESXi host, Oracle Enterprise
Linux 4.0, Oracle Application Server 10g Release 2 and Oracle Application Server 10g
Release 2 Middle-Tier. Chapter 4 presents the installation and configuration of MySQL
database on the Linux platform. Chapter 5 provides the performance comparison of the
report handling capability of MySQL and Oracle 10g database. Finally Chapter 6
summarizes
this
project
report
along
with
some
future
enhancements.
3
Chapter 2
VIRTUALIZATION
2.1 History of Virtualization
IBM implemented virtualization more than 30 years ago as a way to logically
partition the mainframe computers into separate virtual machines [2]. These partitions
allowed the mainframe computers to multitask - run multiple applications and processes
at the same time. Since mainframes were expensive resources at the time, they were
designed for partitioning as a way to fully leverage the investment.
2.2 Need for x86 Virtualization
Virtualization was abandoned during the 1980s and 1990s when client-server
applications and inexpensive x86 servers and desktops led to distributed computing. But
the vast growth in x86 servers and desktop systems led to new IT infrastructure and
operational challenges. These challenges include [2]:

Low Infrastructure Utilization

Increasing Physical Infrastructure Costs

Increasing IT Management Costs

Insufficient Failover and Disaster Protection
4

High Maintenance end-user desktops.
2.3 What is Virtualization
“Virtualization is a software technology that is rapidly transforming the IT
landscape and is fundamentally changing the way people compute” [3] Computer
hardware was originally designed to run only a single operating system, but through
virtualization it is possible to run multiple operating systems and multiple applications on
the same computer at the same time, increasing the utilization and flexibility of hardware.
It allows people to transform hardware into software. Use of softwares such as VMware
ESXi helps us to transform or “virtualize” the hardware resources of a computer
including the CPU, RAM, hard disk, network controller and even the CD-Rom Drives to
create a fully functional virtual machine that can run its own operating system and
applications just like a “real” computer. Multiple virtual machines share hardware
resources without interfering with each other so that we can safely run several operating
systems and applications at the same time on a single computer.
2.4 What is a Virtual Machine
A virtual machine (VM) is a software that behaves exactly like a physical
computer but has its own virtual (i.e., software-based) CPU, Memory, hard disk and
network interface card (NIC). Neither the operating system nor the application can tell
the difference between a virtual machine and a physical machine. The other computers on
5
a network also feel the virtual machine as a physical machine. Even the virtual machine
itself thinks it is a “real” computer. A virtual machine is entirely composed of software
components and contains no hardware components whatsoever. Figure 1 displays the
basic structure of a VMware virtual machine [4].
Figure 1: VMware Virtual Machine
2.5 Advantages of a Virtual Machine
The key benefits of a virtual machine are [4]

Compatibility: Virtual machines are compatible with all the standard x86
computers.

Isolation: Virtual machines are isolated from each other as if they are physically
separated.

Encapsulation:
environment.
Virtual
machines
encapsulate
a
complete
computing
6

Hardware independence: Virtual machines run independently of underlying
hardware.
7
Chapter 3
INSTALLATION AND CONFIGURATION OF ORACLE
The machine used for the project is a Dell Precision 490 workstation. The
workstation consists of Intel Dual core Xeon 5130 2.00GHz processor with 2 GB of
physical memory. It has a 1TB of physical hard disk. The entire setup starting from the
installation of the VMware ESXi hypervisor, Oracle Enterprise Linux 4.0, Oracle
Application Server 10g Release 2 and Oracle Application Server Middle-Tier is
described below.
3.1 Installation and Configuration of VMware ESXi
1. Download a copy of the VMware ESXi 4.0 Update 1 ISO from the VMware
website [5] and burn the ISO file on to a CD or DVD.
2. Complete documentation for installing VMware ESXi 4.0 can be found at the
website [6].
3. Insert the CD containing the ESXi install on to the machines CD/DVD drive and
boot the machine. Upon booting off of the VMware ESXi installation CD the
screen will be presented – press the ‘Enter’ key to start the installation process.
4. Accept the End User License Agreement by pressing the ‘F11’ key.
5. At this stage you will see a list of all your storage devices connected to the
VMware ESXi host machine – select CD drive stick and press ‘Enter’.
8
6. Next press ‘F11’ to confirm the installation of ESXi onto the machine. This install
process generally only takes a couple of minutes.
7. Once the installation has completed the system has to be rebooted. At this point
remove the ESXi installation CD from the servers CD/DVD drive and press
‘Enter’ to reboot the server.
Note: Upon the server rebooting ensure that its boot priority order is set to hard
disk so that the machine is booted from it first.
8. Now we have to secure and configure the machine so that it can be accessed from
the client installed on any machine.
9. Press the ‘F2’ button on the keyboard of the machine to set the ‘root’ password
and configure the network settings. Enter the following information in the
appropriate network configuration tab and ‘reboot’ the machine to enable the
settings.
IP Address: 130.86.79.167
Machine Name: calproj1
Domain Name: ecs.csus.edu
Subnet: 255.255.0.0
Gateway: 130.86.74.254
Primary DNS Server: 130.86.71.150
Alternate DNS Server: 130.86.71.9
9
10. Now the machine has been installed with VMware ESXi 4.0 Update 1 hypervisor
server and can be accessed from the client machine.
3.2 Installation and Configuration of VMware ESXi (vSphere) Client
Once the hypervisor server has been installed, the client to access and use the server
has to be installed on a windows machine.
1. Download the client by entering the IP address of the server as shown in Figure 2.
10
Figure 2: vSphere Client Download
2. Click on the “Download vSphere Client” hyper link and save the installer on the
machine where the client has to be installed.
3. “Run” the installer and install the client. Once installed, double click on the
“VMware vSphere Client” icon to start the client.
4. Enter the IP address of the server along with the username/password as shown in
Figure 3. The username/password is the same as the one used during the
installation of the hypervisor.
11
Figure 3: vSphere Client Login
5. Click on the “Login” button to view the “vSphere Client” screen which allows us
to access the host/server machine which has the hypervisor installed on it.
Once we have installed the client on a machine, we can control the entire server from
the client machine. It allows us to create, modify and delete virtual machine. It also
allows us to monitor the server machine even when we are physically not present at the
location of the server machine.
12
3.3 Installation and Configuration of Oracle Enterprise Linux 4.0 Virtual Machine
1. On the “vSphere Client” screen, right click on the IP address of the server
machine and select “New Virtual Machine”.
2. Select the “Custom” radio button to customize the virtual machine to be created
and click “Next” to continue.
3. Enter the name as “calproj1-oracle” for the VM being created and click “Next” to
continue.
4. Select the Datastore (hard disk) where the virtual machine has to be created. In
our case since we have only one hard disk installed on the machine, we select the
default available hard disk (VMDSK) as the datastore. Click “Next” to continue.
5. Select “Virtual Machine 7” to enable the latest virtual machine features and click
“Next” to continue.
6. Select the Guest Operation System as “Linux” and the version as “Other Linux
32-bit” from the dropdown and click “Next” to continue.
7. Enter the values for the “Number of Virtual Processors” and “Memory” as 1 and 4
GB respectively and click “Next” to continue.
8. On the next screen we have to create the network connection to be used by the
virtual machine. Since our machine has only physical network card, we select the
value “1” from the dropdown and click “Next” to continue.
13
9. On the SCSI controller window, keep the default setting as “LSI Logic Parallel”
and click “Next” to continue.
10. Select the “Create New Disk” radio button to create a new virtual disk and click
“Next” to continue.
11. Enter the desired disk size and select the checkbox next to “Allocate and commit
space on demand (Thin Provisioning)” so that the disk space is allocated as and
when needed. Click “Next” to continue.
12. In the “Advanced options” screen, keep the default option and click “Next” to
continue.
13. Enable the check box to edit the virtual machine before completion and Click the
“Finish” to open the “Virtual Machine Properties” screen.
14. Make sure a copy of the “Oracle Enterprise Linux 4.0” ISO is on the datastore so
that we can browse to that location in the “CD/DVD” option on the properties
screen. Click “OK” to save the settings.
15. A new “Virtual Machine” is created as shown in Figure 4 without any operating
system installed in it.
14
Figure 4: vSphere Console
16. Since we have selected the Linux ISO in the previous step, let us start the Virtual
machine to start the installation of the “Oracle Enterprise Linux 4.0”
17. Complete documentation for installing Oracle Enterprise Linux 4.0 can be found
at the website [7].
18. Boot from the CD or DVD. At the boot screen as shown in Figure 5, press the
"Enter" key.
15
Figure 5: Linux Installation Boot Screen
19. Press the "tab" key to move focus to the "Skip" key, and then press the "Enter"
key to continue.
20. On the "Welcome" screen, click the "Next" button.
21. Select the appropriate language, and then click the "Next" button.
22. Select the relevant keyboard setting, and then click the "Next" button.
23. Select “Remove all partitions on selected drive and create default layout” from the
drop down menu and then check the "Review and modify partitioning layout"
16
option, and then allow the installer to automatically partition the disk by clicking
on the "Next" button.
24. Here /dev/sda is the name of the hard disk in the machine. Create Custom
partition as shown in Table 1.
Device
Mount
Type
Size
/dev/sda1
/boot
ext3
500 MB
/dev/sda6
/u01
ext3
20 GB
/dev/sda4
Extended 606743 MB
/dev/sda3
/
ext3
5 GB
/dev/sda2
swap
2 GB
/dev/sda7
/tmp
ext3
2 GB
/dev/sda5
/u02
ext3
584223 MB
Table 1: Custom Linux Partition Table
25. Leave the default settings to install the GRUB Boot Loader on /dev/sda
26. Select “Automatically via DHCP” option to setup the Network Devices.
27. Select the relevant region by clicking on the map.
28. Enter a root password for the server, and then click the "Next" button to proceed.
29. Select the "Customize now" option and the appropriate installation type and click
the "Next" button.
30. The "Package Group Selection" screen allows us to select the required package
groups, and individual packages within the details section. Select only the
package sets shown here and leave all others unselected and click “Next” to
proceed
17
a. Desktop – Select “X Window System” and “Gnome”.
b. Applications – “Graphical Internet (optional)”.
c. Servers – “Do not select anything in this group”.
d. Development – “Development Tools”.
e. System – “Administration Tools” and in “System Tools” add the package
'sysstat' by clicking on the Details link and selecting "sysstat” from the
Optional Packages list.
f. Miscellaneous – “Do not select anything in this group”.
31. On the "About to install" screen, click the "Next" button.
32. Depending on the kind of media used (CD or DVD) user is asked to insert the
appropriate media.
33. Click the "Reboot" button to complete the installation.
34. On the "Welcome" screen, click the "Forward" button.
35. Accept the license agreement and click the "Forward" button.
36. On the Firewall screen, choose the "Disabled" option and click the "Forward"
button.
37. Click the "Yes" button on the subsequent warning screen.
38. On the SELinux screen, choose the "Disabled" option and click the "Forward"
button.
39. Click the "Yes" button on the subsequent warning screen.
18
40. Accept the default setting on the Kdump screen by clicking the "Forward" button.
41. Adjust the Date and Time settings if necessary, and click the "Forward" Button.
42. Select the "No, I prefer to register at a later time" option and click the "Forward"
button to avoid this step.
43. Create an additional system user if required, and click the "Next" button.
44. If we chose not to define an additional system user, click the "Continue" button
on the resulting warning dialog.
45. On the sound card screen, click the "Forward" button.
46. On the "Additional CDs" screen, click the "Finish" button.
47. Click the "OK" button on the reboot request dialog.
48. Once the system has rebooted, you are presented with the login screen.
3.4 Installation and Configuration of Oracle 10g Release 2 Application Server
Now that the Linux operating system has been installed, we need to configure it to
use with Oracle Application Server. Download the copy of Oracle Application Server
10g Release 2 (10.1.2.0.2) from the location in [8].
“Oracle Application Server is an integrated and powerful product” [9]. To
optimize its capabilities, we need to follow the following steps for installing Oracle
Application Server.
19
3.4.1 System Requirements
The Minimum System Requirements required for the installation of Oracle
Application Server Infrastructure and Oracle Application Server Middle Tier is as shown
in Table 2.
Processor Speed 450MHz or faster
Memory
1 GB + 1GB
Disk Space
3.7 GB + 2 GB
Temp Space
400MB
Swap Space
1.5GB
Table 2: System Requirements for OAS Infrastructure & Middle Tier
To check the above mentioned requirements, execute the commands as shown
o Login as root
o If not logged in as root, type this to log in as root from the terminal
# su root
o Once you logged in as root, perform following steps.
1) Check physical RAM size
#grep MemTotal
/proc/meminfo
2) Check amount of disk space
#df
-k
/<directory name>
Note: “directory name” is the directory in which oracle is installed. In here it is “u01”
3) Check Swap space
# grep
SwapTotal
/proc/meminfo
20
4) Check size of /tmp directory
# df -k /tmp
5) Check the directory size in which you want to keep your database files
#df
-k
/<directory name>
Note: “directory name” in the setup is “u02”
3.4.2 Software Requirements
Before installing Oracle Application Server we have to ensure that the system
meets all the software requirements as mentioned in Table 3.
o Login as root
o If not logged in as root, type this to log in as root from the terminal
# su root
o Once you logged in as root, perform following steps.
1) To determine which distribution and version of Linux is installed, run the
following command:
# cat /etc/issue
2) To determine whether any other package is installed, run a command
similar to the following:
# rpm -q package_name
21
Item
Operating System
Requirements
Red Hat Enterprise Linux AS/ES 4.0. The minimum
supported kernel versions are:



Software packages (check that these versions or
higher versions are installed)
kernel-2.6.9-11.EL
kernel-smp-2.6.9-11.EL
kernel-hugemem-2.6.9-11.EL
glibc-2.3.4-2.9
glibc-common-2.3.4-2.9
binutils-2.15.92.0.2-13
compat-libstdc++-296-2.96-132.7.2
gcc-3.4.3-22.1
gcc-c++-3.4.3-22.1
libstdc++-3.4.3-22.1
libstdc++-devel-3.4.3-22.1
openmotif21-2.1.30-11.RHEL4.4
pdksh-5.2.14-30
setarch-1.6-1
make-3.80-5
gnome-libs-1.4.1.2.90-44.1
sysstat-5.0.5-1
compat-db-4.1.25-9
control-center-2.8.0-12
xscreensaver-4.18-5.rhel4.
Table 3: Software Requirements for OAS Infrastructure & Middle Tier
3) If a package is missing, download it and install it using the following
command:
# rpm -i package_name
4) When installing a package, make sure you are using the correct
architecture and optimization rpm file. To check the architecture of an rpm
file, run the following command:
# rpm -q package_name --queryformat "%{arch}\n"
22
3.4.3 Kernel Parameters
Verify that the kernel parameters shown in Table 4 are set either to the values
greater than or equal to the recommended value shown.
Parameter
Semmsl
semmns
semopm
semmni
Shmall
shmmax
shmmni
Msgmax
msgmnb
msgmni
file-max
ip_local_
port_range
Value
256
32000
100
142
2097152
2147483648
4096
8192
65535
2878
131072
10000 - 65000
File
/proc/sys/kernel/sem
/proc/sys/kernel/shmall
/proc/sys/kernel/shmmax
/proc/sys/kernel/shmmni
/proc/sys/kernel/msgmax
/proc/sys/kernel/msgmnb
/proc/sys/kernel/msgmni
/proc/sys/fs/file-max
/proc/sys/net/ipv4/ip_local_port_range
Table 4: Kernel Parameters
To view the current value specified for these kernel parameters, and to change them if
necessary, follow these steps:
o Run commands as mentioned in Table 5 to view the current values of the kernel
parameters:
Parameter
semmsl, semmns, semopm, and semmni
shmall, shmmax, and semmni
msgmax, msgmnb, and msgmni
file-max
ip_local_port_range
Command
# /sbin/sysctl –a | grep sem
# /sbin/sysctl –a | grep shm
# /sbin/sysctl –a | grep msg
# /sbin/sysctl –a | grep file-max
# /sbin/sysctl –a | grep ip_local_port_range
Table 5: Commands to View Current Kernel Parameters
o If the value of any kernel parameter is different from the recommended value,
complete the following steps:
23
1) Using any text editor, create or edit the /etc/sysctl.conf file and add or edit
lines similar to the following:
Note: Include lines only for the kernel parameter values that you want to change.
For the semaphore parameters (kernel.sem), you must specify all four values.
However, if any of the current values are larger than the recommended value,
specify the larger value.
Kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 256 32000 100 142
fs.file-max = 131072
net.ipv4.ip_local_port_range = 10000 65000
kernel.msgmni = 2878
kernel.msgmax = 8192
kernel.msgmnb = 65535
2) Run the following command to change the current values of the
kernel parameters.
# /sbin/sysctl –p
24
3) Review the output of the above command to verify that the values are
correct. If the values are incorrect, edit the /etc/sysctl.conf file, then enter
this command again.
3.4.4 Set Shell Limits for the Oracle User
To improve the performance of the software on Linux systems, you must increase
the shell limits for the oracle user. To increase the shell limits for the oracle user we have
to perform the following steps:
o Add the following lines shown in Table 6 to /etc/security/limits.conf file:
*
*
*
*
soft
hard
soft
hard
nproc
nproc
nofile
nofile
2047
16834
2048
65536
Table 6: Shell Limits for Oracle User
o Add the following line to the /etc/pam.d/login file, if it does not already exist:
session
required
/lib/security/pam_limits.so
3.4.5 Operating System Groups and User
If this is the first Oracle product to be installed on the computer, create an
operating system group for the “inventory” directory. The installer creates files in the
inventory directory to keep track of the Oracle products that are installed on the
computer. The default group name for this is ‘oinstall’. By having a separate group for
the inventory directory, different users can install Oracle products on the computer. Users
25
need the write permission for the inventory directory. This can be done by being a
member of the “oinstall” group. The default name of the inventory directory is
“oraInventory.”
If unsure about having an inventory directory on the computer, look in the
/etc/oraInst.loc file. This file lists the location of the inventory directory and the group
who owns it. If the file does not exist, the computer does not have Oracle products
installed on it. So it means when we start the installation of oracle application server, the
installer will prompt to specify the path as well as to run one script related with
“orainventory” as a root user. The installer also needs the “dba” group created as part of
the installation process. To create the “oinstall” and “dba” group, enter the following as
the root user:
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
Finally to create the oracle operating system user as part of the “oinstall” and
“dba”group, enter the following command as the root user:
# /usr/sbin/useradd –m –g oinstall –G dba oracle
Set the password on the oracle account by entering the following as the root user:
# passwd oracle
26
3.4.6 Environment Variables
Here we specify the oracle home directory, oracle base directory and other
environment variables oracle.
The values of oracle environment variables for our project:

$ORACLE_BASE
=
‘/u01/app/oracle’

$ORACLE_HOME
=
‘$ORACLE_BASE/product/10_2/oracleas1’

$ORACLE_SID
=
‘imw’
In the project, we would want to specify the default locations of oracle software
as “/u01” file system and for database files (.dbf) as the “/u02” file system.
So we have to create those directories as a root user and have to assign the
modification and the ownership rights to “oracle” user. Perform following steps to create
directories in appropriate location.

Create directories
#mkdir -P /u01/app/oracle/product/10_2/oracleas1
In file system “/u02”, create following directory for database files. During the
installation of oracle application server, we specify this location as the path to install the
database files.
#mkdir -P /u02/oradata

Change the mode, ownership and assign those to “oracle”
#chown –R oracle:oinstall /u01/
27
#chown –R oracle:oinstall /u02/oradata/
#chmod –R 777 /u01/
#chmod –R 777 /u02/oradata/
3.4.7 Check If Port 1521 is in Use
This section is applicable only if Oracle AS Infrastructure is being installed. The
Oracle AS Infrastructure installs an oracle database, which uses port 1521 by default. To
check if port 1521 is in use:
# netstat –an | grep 1521
If port 1521 is in use by a third-party application, we have to configure the
application to use a different port. If port 1521 is in use by an existing oracle database
listener, you have to stop the listener before installing the Oracle AS Infrastructure.
Note: Since this is the first Oracle AS Infrastructure installation on the machine, we
found out that port 1521 was not used by any application.
At this point we are almost done with the configuration of Oracle Enterprise
Linux 4.0 for use with oracle application server installation. So logout if logged in as root
and log in as an oracle user.
28
3.4.8 Starting up the Oracle Application Installer

After logging in as an oracle user, copy all 4 CDs in a directory which has enough
space to accommodate oracle software.

After you are done copying of all 4 oracle CDs open terminal and type following:
#cd / pathname for oracle software

If the oracle software in “.gz” format try following to unzip it.
#gunzip filename_cpio.gz

After the above step your file is in “cpio” format.
#cpio –id < filename_cpio

Perform the above steps to unzip rest of oracle CDs.

Open terminal and go to the directory Disk1 using “cd” command.
#cd /u02/OAS/Oracle10gR2/Disk1

Type following command to set the ENVIRONMENT variable.
#env (to get the hostname)
#set DISPLAY = <hostname>:0.0
#export DISPLAY

Run the “runInstaller” file which is present within the Disk 1 folder using
following command only.
# ./runInstaller
This will start the oracle installation process.
29

Specify following destination directory as the path for oracle infrastructure
installation files and click “Next”.
Name: oracleas1
Path: /u01/app/oracle/product/10_2/oracleas1

Select “Oracle Application Server Infrastructure 10g 10.1.2.0.2” as the product to
be installed and click “Next” to continue.

Select “Identity Management and Metadata Repository” as the installation type
and click “Next” to continue.

The installer asks for confirming pre-installation requirements. So check the
“Root Privileges” check box and click “Next” to continue.

Now the installer will display the Configuration options selection list. Keep the
default selection and click “Next” to continue.

In this screen we specify the Port configuration options. Keep the default settings
(Automatic) and click “next” to continue.

Keep the default selection for specifying the namespace in internet directory and
click “Next” to continue.

Specify following database configuration options for the creation of the oracle
database.
30

Global Database Name
: imw.ecs.csus.edu
SID
: imw
Database character set
: keep the default selection
Database File Location
: /u02/oradata
Specify database schema password. Here we specify common password for the
following users: SYS, SYSTEM, SYSMAN and DBSNMP

Specify instance name and ias_admin password.
Instance Name
: imw
ias_admin Password : <Password>
NOTE: In the project, we have a common password for the entire above
mentioned users. We can later change them through the database console screen.

Click “Install” to install the products.

Restart the machine and log in as oracle user.

Use SQLPLUS command to start oracle. Use following command to connect
oracle.
Conn sys as sysdba
Password: <same password specified during the installation>

If the prompt returns “connected to an idle instance”, use “startup” command to
mount and start the “imw” database instance.
31
3.4.9 Setup Variables for Oracle
Now that we have setup the database, we have to setup the variables for the
“Oracle” user to use the database. Enter the values shown in Figure 6 at the end of the
.bash_profile file of the “oracle” user. The entire process of starting and mounting the
database instance can be automated. But in this project we prefer to keep it as a manual
process so that the user can start and mount the database only when needed. This can be
useful only under the scenario where we know the database is being accessed by an
individual rather than a group of people.
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10_2/oracleas1; export ORACLE_HOME
ORACLE_SID=imw; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export CLASSPATH
#LD_ASSUME_KERNEL=2.4.1; export LD_ASSUME_KERNEL
if [ $USER = “oracle” ]; then
if [ $SHELL = “/bin/ksh” ]; then
ulimit –p 16384
ulimit –n 65536
else
ulimit –u 16384 –n 65536
fi
fi
Figure 6: Oracle Bash Profile Configuration

This finally completes the installation of oracle application server on the machine.
32
3.5 Installation and Configuration of Oracle 10g Release 2 Middle-Tier
Now that we have already installed Oracle Application Server Infrastructure on the
machine, we can go ahead and start the installation of Oracle Application Server MiddleTier.

After logging in as an oracle user, make sure to create the oracle middle-tier home
location folder structure using the following commands
#mkdir -P /u02/app/oracle/product/10_2

Change the mode, ownership and assign those to “oracle”
#chown –R oracle:oinstall /u02/app
#chmod –R 777 /u02/app

Open terminal and browse to the location of the directory where the oracle
installation setup folders are located using the following command
#cd /u02/OAS/Oracle10gR2/Disk1

Run the “runInstaller” file which is present within the Disk 1 folder using
following command only.
# ./runInstaller
This will start the oracle installation process to install the Oracle Application
Server Middle-Tier.

Specify following destination directory as the path for oracle middle-tier
installation files and click “Next” to continue.
33
Name: imw_mid
Path: /u02/app/oracle/product/10_2

Select “Oracle Application Server 10g” as the product to be installed and click
“Next” to continue.

Select “Business Intelligence and Forms” as the installation type and click “Next”
to continue.

The installer asks for confirming pre-installation requirements. So check the
“Root Privileges” check box and click “Next” to continue.

Now the installer will display the Configuration options selection list. Keep the
default selection and along with it make sure to check “Oracle Application Server
10g Discoverer and Oracle Application Server 10g Report Services” and click
“Next” to continue.

In this screen make sure to register the middle-tier installation with Oracle
Internet Directory (OID) using the following information and click “Next” to
continue.
Host: calproj1-oracle.ecs.csus.edu
Port: 389

In this screen specify the OID login information with the following information
and click “Next” to continue.
Username: cn=orcladmin
34
Password: <orcleadmin password from the infrastructure installation>

In this screen, enter the “Database Connect String” for the application metadata
repository using the following information and click “Next” to continue.
calproj1-oracle.ecs.csus.edu:1521:imw.ecs.csus.edu:imw.ecs.csus.edu

On this screen, we have to specify a unique “Instance Name” and the
“Administrator Username Password” and click “Next” to continue.
Instance Name: imw_mid
ias_admin Password: <password>

On the “Summary” screen, Click “Install” to install the products.

This finally completes the oracle application server middle-tier installation on the
machine
3.6 Configuration of the Oracle Database
Now that we have all the required software on the machine, we have to configure
the database to meet the needs of the Truck Data-Warehouse application [1]. The
following steps will customize the “imw” instance of the oracle database so that it can be
used to store the Truck Data-Warehouse information.
Step 1: Start the Database Instance

Open a “Terminal” window and type following
# sqlplus /nolog
35

At the prompt, type the following username/password
Username: sys as sysdba
Password: <specified during oracle installation>

After the above command, SQL*Plus returns the message “Connected to an Idle
instance” which means that oracle instance had not yet started.

We have to start the instance using the following command.
SQL:>startup

This creates the SGA (System Global Area) and the background processes for the
database instance and allows the user to access the database. Since we have not
automated the auto sequence of the oracle database, we have to follow the above
steps each time the machine is restarted.
Step 2: Create Tablespaces
In oracle databases, tablespace is a logical storage unit which contains the
database files, index files etc. In the “imw” database there are two tablespaces one for
data – “imwdata” which contains all the data and another one for indexing – “imwindx”
which contains indexes created on the table columns of the database. Run the following
command from the SQL prompt:
SQL:>@/u02/scripts/create_tbs.sql
Appendix –A contains “create_tbs.sql” script for creating the table spaces. It was created
by [1].
36
Step 3: Run the Scripts catalog.sql and catproc.sql
Execute the following commands as SYS user so that the data dictionaries and
structure for PL/SQL are created. These two scripts are oracle built-in scripts and the user
does not have to worry about the messages prompted during the execution of these
scripts. Once the execution of theses automated scripts are complete, SQL prompt is
displayed to the user
SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql
SQL> @$ORACLE_HOME/rdbms/admin/catproc.sql
Step 4: Configure Java
Since the JSP files for reports in project use java we have to install enable the
Jserver option for the oracle database.
SQL> @$ORACLE_HOME/javavm/install/initjvm
Step 5: Create Users
To establish database connections for generating the reports, we have to create the
users. Run the following command from the SQL prompt:
SQL:>@/u02/scripts/create_usr.sql
Appendix –A contains “create_usr.sql” script for creating the users. It was created by [1].
Once the users are created, appropriate role-based privileges have to be granted to them
so that the users can perform the required database operations. Run the following
command from the SQL prompt:
37
SQL:> Grant connect, resource to “username”;
“connect” includes the following system privileges – alter session, create cluster, create
database link, create sequence, create session, create synonym, create table, create view
“resource” includes the following system privileges – create cluster, create indextype,
create operator, create procedure, create sequence, create table, create trigger, create type
Step 6: Create Database Tables
Since Truck Data-Warehouse database tables have relationships, the order of the
table creation is important. The weight station table must be created first followed by
weight station lane table followed by Wiminstance table. Finally we have to create a
login table. Run the following command from the SQL prompt:
SQL:>@/u02/scripts/create_tables.sql
Appendix –A contains “create_tables.sql” script for creating all the tables. It was created
by [1].
Step 7:Create Views
The main purpose of these views is to format the data, especially the date time
values, in required format. There are four normal views that were created for the “imw”
database.

wiminstance_date_fmt -- This view restricts the time span of the data. In
wiminstance table the date and time are in separate fields: Year, Month, Day,
38
Hour, Minute, Second. This view uses the built-in to_date() function to combine
the date and time in the “Month-Day-Year Hour:Minute:Second” format.

weekday_view -- This view is used to query only the data of all the weekdays.

weekend_view -- This view is used to query weekends’ data.

axle_weight_view -- Some of the reports are based on the axle data stored in
wiminstance table. This view for axle data gives the axle weights and axle lengths
between the axles for each record in the wiminstance table.
Appendix –A contains “views.sql” script for creating all the views. It was created
by [1]. Run the following command from the SQL prompt:
SQL:>@/u02/scripts/views.sql
Step 8: Create Indexes
In databases, indexes are created on the key column values of the database tables.
In the Truck Data-Warehouse database, the following indexes were created for the same
purpose.

bit_vehicle_class_index -- Since many reports use vehicle class for the vehicle
classifications the bitmap index on vehicle class column of wiminstance table was
created.

speed_index -- For the reports based on speed distribution a normal b-tree index
on speed column of wiminstance table was created.
39

bit_year_index -- A bitmap index on the year column of wiminstance table was
created as most of the TDW reports are using year value to retrieve data.

datetime_index -- A composite index was created on Month, Day, Year, Hour,
Minute and Second columns of wiminstance table as all the reports were based on
the start date-time and end date-time.

bit_hour_index -- This index was created for the reports that are based on the start
hour and end hour.
Appendix –A contains “create_indx.sql” script for creating all the indexes. It was created
by [1]. Run the following command from the SQL prompt:
SQL:>@/u02/scripts/create_indx.sql
Step 9: Create Materialize View
A special kind of view which improves query performance by pre-calculating
expensive join and aggregation on the database tables prior to execution and storing the
result in the database is a “Materialize view”. In the “imw” database we use materialize
view for formatting the date-time values of the wiminstance table.
Run the following command from the SQL prompt:
SQL:>@/u02/scripts/create_mv.sql
Appendix –A contains “create_mv.sql” script for creating all the indexes. It was created
by [1].
40
Chapter 4
INSTALLATION AND CONFIGURATION OF MYSQL
4.1 About MySQL
MySQL is a very popular open source relational database system. “MySQL is a
key part of LAMP (Linux, Apache, MySQL, PHP / Perl / Python), the fast-growing open
source enterprise software stack. More and more companies are using LAMP as an
alternative to expensive proprietary software stacks because of its lower cost and freedom
from platform lock-in”[10].
Some of the key features of MySQL are discussed below.

Open Source – Since Oracle now owns and supports MySQL a unique cost and
support model is available which provides the user a unique combination of open
source freedom and trusted software with support.

Flexibility – Platform flexibility is one of the best features of MySQL. Linux,
UNIX, and Windows are all the supported platforms. Since MySQL is open
source, it can be customized based on the requirement of the application being
developed using the database.
41

High Performance – MySQL uses unique storage-engine architecture which
allows database administrators to configure the MySQL database server
specifically for particular applications, which results in amazing performance.

Ease of Management – MySQL is very easy to install and manage on any of the
operating system platforms like Microsoft Windows, Linux, Macintosh, or UNIX.
MySQL also provides the database administrators a complete suite of graphical
management and migration tools that allows them to manage and control the
operation of many MySQL servers from a single workstation.
4.2 Installation of MySQL
MySQL database server installation is a very easy process which can be completed in
a very less amount of time without much hassle. Since this project is about the
comparison of the report handling capability of Oracle and MySQL databases on a Linux
platform in a virtualized environment, we chose to install the community version of
MySQL.
1. Download the copy of MySQL Community Server 5.1.45 from the website [11].
2. In here select the platform as “Linux – Generic” from the dropdown and click
“Select” button.
3. From the list, click the download button next to “Generic Linux (glibc 2.3) (x86,
32-bit), RPM Package MySQL Server” to download the RPM package.
42
4. On a “Terminal” start the installer by executing the following command to
perform a standard minimal installation of the server.
Shell> rpm –i MySQL-server-5.1.45.glibc23.i386.rpm
Select the “Default” options when prompted during the installation.
5.
6. Since the installation was made using the standard MySQL RPM, the files were
created under the following system directories as shown in Table 7 similar to the
one in [12]:
Directory
Contents
/usr/bin
Client programs and scripts
/usr/sbin
The mysqld server
/var/lib/mysql
Log files, databases
/usr/share/info
Manual in Info format
/usr/share/man
Unix man pages
/usr/include/mysql
Include (header) files
/usr/lib/mysql
Libraries
/usr/share/mysql
Error message and character set files
/usr/share/sql-bench
Benchmarks
Table 7: MySQL Setup Directory Structure
7. The installer finally completes the installation process and mounts the MySQL
database with a warning message to set the “Root” password as it is not set as part
of the standard installation process.
8. Open “Terminal” and login to MySQL as “root” using the following command
and hit “Enter” button on the keyboard.
shell> mysql –u root
43
9. Set the “Root” password using the following commands.
mysql>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql>SET PASSWORD FOR 'root'@'calproj1-oracle'=PASSWORD('newpwd');
Here the “newpwd” is the password that we need to login to MySQL as “Root”
from now on.
10. MySQL installer also creates two “anonymous” accounts during the installation.
We can remove those two accounts which improve security using the following
command.
mysql>DROP USER ‘’;
mysql>DROP USER ‘’@’localhost’;
11. We have now secured the “Root” account as well as the MySQL database
instance that we just created.
4.3 Configuration of the MySQL Database
To recreate the Truck Data-Warehouse tables in MySQL similar to the one
created in Oracle, first we have to create a new user and grant the required permissions.
Run the following command from the MySQL prompt:
mysql:>@/u02/mysqlscripts/mysql_usr.sql
44
Appendix - B contains “mysql_usr.sql” and “mysql_grants.sql”script for creating the
users and granting them with the required privileges. Run the following command from
the MySQL prompt:
mysql:> @/u02/mysqlscripts/mysql_grants.sql
Step 1: Create Database Tables
To create similar tables in MySQL as created in oracle, run the following
command from the SQL prompt:
mysql:> @/u02/mysqlscripts/mysql_tables.sql
Appendix - B contains “mysql_tables.sql” script for creating all the required tables
similar to the table is oracle.
Step 2:Create Views
To create similar views in MySQL as created in oracle, run the following
command from the SQL prompt:
mysql:> @/u02/mysqlscripts/mysql_views.sql
Appendix - B contains “mysql_views.sql” script for creating all the required tables
similar to the table is oracle.
Since MySQL does not support bitmap indexing, no bitmap index was created for
MySQL.
45
Chapter 5
PERFORMANCE COMPARISON
5.1 Environment Staging
The main focus of this comparison is to compare the report handling capability
with respect to execution time in Oracle 10g Release 2 database and MySQL 5.1.45
database. Both the databases have the exact same instances of the Truck Data-Warehouse
system.
In the earlier chapters we have discussed the process of setting up both the
databases with similar tables. The tables in both the databases have the exact number of
records as shown in Figure 7 and Figure 8
46
Figure 7: Record Count in Oracle Database
Figure 8: Record Count in MySQL Database
47
The hardware specifications for both the databases are the same and are shown in
Table 8.
Processor
Memory
Operating System
Intel Xeon 5130 2.0 GHz
4 GB
Oracle Enterprise Linux 4.0
Table 8: Hardware Specification
Now that the environment is identical in both the databases, the 12 pre-defined
reports in the Truck Data-Warehouse system were executed against both the databases.
Each report in the Truck Data-Warehouse system was executed 30 different times. The
average execution time per report was captured and a graph was plotted to compare the
observation.
5.2 Execution Time for Oracle Database
The report execution time in milliseconds (ms) for all the 12 reports executed
against Oracle database is available in Appendix - C. The query for the web reports in
Oracle [1] is available in Appendix - D.
5.3 Execution Time for MySQL Database
The report execution time in milliseconds (ms) for all the 12 reports executed
against MySQL database is available in Appendix - E. The query for the web reports in
MySQL is available in Appendix - F
48
5.4 Execution Time Comparison
Table 9 and Table 10 display the average execution time in milliseconds (ms) for
each of the 12 reports in both Oracle and MySQL databases.
Oracle
Execution
Time
MySQL
Execution
Time
Axle
Load
by
Class
Axle
Load
by
Hour
Axle
Relationships
Empty/Loaded
Trucks by Hour
Empty/Loaded
Trucks by
Station
Exceptionally
Heavy
Vehicles
52.18
163.33
296.67
275.43
340.13
16.77
43.32
47.47
249.53
264.7
179.67
13.43
Table 9: Average Execution Time Comparison
Oracle
Execution
Time
MySQL
Execution
Time
Lane wise
Truck
Distribution
Speeds by
Classification
Speeds
by Hour
Volume and
Percentage
of Trucks by
Hour
Volume by
Station and
Classification
Wheel
Load
Deviance
Ratio
183.27
225.4
195.6
278.43
130.93
49.5
51.6
42.57
46.5
33.9
20.63
31.1
Table 10: Average Execution Time Comparison
Finally a graph was plotted to view the comparison of the execution time between
Oracle and MySQL databases as shown in Figure 9.
49
400
350
300
250
200
150
100
50
0
Oracle Execution Time in
Milliseconds
MySQL Execution Time in
Milliseconds
Figure 9: Execution Time Comparison
Since MySQL does not support materialized views, we have simulated the
materialized view by creating a base table which can be updated using a scheduler or a
trigger. The base table can be refreshed based on the user’s needs. Typically the base
table can be refreshed on a daily basis after the nightly load. In Figure 9, “Axle
Relationships” and “Empty/Loaded Trucks By Hours” use materialized view in Oracle.
Figure 9 illustrates that MySQL has better performance on all the queries. The
results were produced by running reports over 9654 records in the Wiminstance table.
For large dataset, the performance comparison between Oracle and MySQL are not
known.
50
In our case we could not populate the databases with large datasets as the
available system resources (hardware specification of the machine) were very limited.
51
Chapter 6
SUMMARY AND FUTUREWORK
The project is implemented in a virtualized environment using VMware ESXi 4.0
hypervisor server on which Oracle Enterprise Linux was installed. The databases, Oracle
10g Release 2 and MySQL 5.1.45 were installed and configured which in itself was a
great experience and challenge. Setting up the reports to access the databases using a
common version of JDK was crucial task. Since the reports use java technology, the
version of java being used should be the same on the operating system, application
server, OC4J module and even in JDeveloper application that is being used to create the
reports.
Performance analysis was done to analyze the report execution time among the
two databases. Configuring MySQL database to behave exactly as the oracle database
was a great experience. The installation process was very easy compared to the oracle
installation.
Future work includes the use Oracle 11g database along with Oracle Fusion Web
logic server can be used as oracle has provided the user with an option to install
components as required compared to installing the entire application server. A wide range
of data can be loaded into the databases which include all kinds of data like good and
corrupt/bad. The data currently used, restricts the error handling functionality as it does
52
not have any corrupt/bad data. Automated report execution process to reduce the effort of
the user and a batch job at a scheduled time to trigger the execution can be an interesting
enhancement. The system can also be configured to send out email notifications to the
users of the generation of the report.
53
APPENDIX A
Oracle Database Queries

create_tbs.sql
/*Data and Index tablespaces*/
create tablespace imwdata logging
datafile '/u02/oradata/imw/imwdata/datafiles/imw_userdata01.dbf'
size 10G reuse autoextend on next 4048k maxsize unlimited
extent management local;
create tablespace imwindx logging
datafile '/u02/oradata/imw/imwindx/indxfiles/imw_indx.dbf'
size 1G reuse autoextend on next 4048k maxsize unlimited
extent management local;

create_usr.sql
/* Create user Robert*/
create user robert
identified by robert
default tablespace imwdata
quota unlimited on imwdata
quota unlimited on imwindx
quota 20M on system;
/* create wimuser */
create user wimuser
identified by wimuser
default tablespace imwdata
quota 20M on imwdata
quota 20M on imwindx
quota 20M on system;
54

create_tables.sql
/*login table*/
create table login(username varchar(20), password varchar(20))tablespace imwdata;
insert into login values('wimuser1', 'wimpass1');
insert into login values('wimuser2', 'wimpass2');
commit;
/*Weightstation table*/
create table Weightstation
(Stationid number(3) not null,
Stationname varchar2(30) not null,
Dialup number(3),
Contact varchar2(20),
Enabled number(3),
Batch number(3),
District number(2),
County varchar2(8),
Route number(3),
Postmile varchar2(5),
Latitude number(10,4),
Longitude number(10,4),
constraint weightstation_PK primary key (Stationid) using index tablespace imwindx
)tablespace imwdata;
/*Weightstation Lane table*/
create table Weight_Station_Lane
(Stationid number(3) not null,
Laneno number(1) not null,
Direction varchar2(2),
constraint weight_station_lane_PK primary key(Stationid,Laneno) using index tablespace
imwindx,
constraint stationfk foreign key(Stationid) references
Weightstation(Stationid)
55
)tablespace imwdata;
/*Wiminstance table*/
create table Wiminstance
(
Stationid number(3) not null, -- Unique Site ID referenced to Site in Sites table
Laneno number(1), -- Specify lane number
Month number(2), -- Month
Day number(2), -- Day
Year number(4), -- year
Hour number(2), -- Hour
Minute number(2), -- Minute
Second number(2), -- Second
VehicleNumber number(5), -- Vehicle Occurence count number. Must be reset at midnight
everyday
VehicleClass number(3), -- class of Vehicle. Ex: class 5, 14, 8 etc.
GrossWeight number(6,1), -- Gross weight of vehicle
Length number(6,1), -- Length of vehicle
Speed number(5,1), -- Speed of vehicle
ViolationCode number(3), -- violation code. used to calculate number heavy weight vehicle
Axle1RightWeight number(4,1),
Axle1LeftWeight number(4,1),
Axle2RightWeight number(4,1),
Axle2LeftWeight number(4,1),
AxleSpace12 number(4,1),
Axle3RightWeight number(4,1),
Axle3LeftWeight number(4,1),
AxleSpace23 number(4,1),
Axle4RightWeight number(4,1),
Axle4LeftWeight number(4,1),
AxleSpace34 number(4,1),
Axle5RightWeight number(4,1),
Axle5LeftWeight number(4,1),
AxleSpace45 number(4,1),
Axle6RightWeight number(4,1),
Axle6LeftWeight number(4,1),
AxleSpace56 number(4,1),
Axle7RightWeight number(4,1),
Axle7LeftWeight number(4,1),
AxleSpace67 number(4,1),
Axle8RightWeight number(4,1),
56
Axle8LeftWeight number(4,1),
AxleSpace78 number(4,1),
Axle9RightWeight number(4,1),
Axle9LeftWeight number(4,1),
AxleSpace89 number(4,1),
ErrorCode number(2), -- Error number for particular vehicle
constraint wt_PK primary
key(Stationid,Laneno,Month,Day,Year,Hour,Minute,Second,VehicleNumber) using index
tablespace imwdata,
constraint wt_FK_To_weightstation foreign key(Stationid) references Weightstation(Stationid)
)tablespace imwdata;

views.sql
CREATE VIEW Wiminstance_Date_Fmt AS
SELECT i.Stationid,s.stationname, i.Laneno, i.Month, i.Day, i.Year, i.Hour, i.Minute, i.Second,
to_date(datetime,'MM-DD-YY HH24:MI:SS') AS DateTime, i.VehicleNumber, i.VehicleClass,
i.GrossWeight, i.Length, i.Speed, i.ViolationCode, i.AxleSpace12, i.AxleSpace23,
i.AxleSpace34, i.AxleSpace45, i.AxleSpace67, i.AxleSpace78, i.AxleSpace89
FROM (
SELECT Stationid, Laneno, VehicleNumber, VehicleClass, GrossWeight,Length, Speed,
ViolationCode, AxleSpace12, AxleSpace23, AxleSpace34, AxleSpace45, AxleSpace67,
AxleSpace78, AxleSpace89, Month, Day, Year, Hour, Minute, Second,
Month||'-'||Day||'-'||Year||' '||Hour||':'||Minute||':'||Second AS datetime
FROM Wiminstance) i, weightstation s
where i.stationid = s.stationid;
CREATE VIEW weekday_view AS
SELECT s.stationname, i.Stationid, i.Laneno, i.Month, i.Day, i.Year,
i.Hour, i.Minute, i.Second, to_date(datetime,'MM-DD-YY HH24:MI:SS') AS DateTime,
to_date(wim_date,'MM-DD-YY') as WimDate, i.VehicleNumber, i.VehicleClass, i.GrossWeight,
i.Length, i.Speed, i.ViolationCode
FROM (
SELECT Stationid, Laneno, VehicleNumber, VehicleClass, GrossWeight,Length, Speed,
ViolationCode, Month, Day, Year, Hour, Minute, Second,
Month||'-'||Day||'-'||Year||' '||Hour||':'||Minute||':'||Second AS datetime,
Month||'-'||Day||'-'||Year AS wim_date
FROM Wiminstance ) i, weightstation s
where s.stationid=i.stationid and to_char(to_date(month||'-'||day||'-'||year,'MM-DD-YY'),'Dy') not
57
in ('Sat','Sun');
CREATE VIEW weekend_view AS
SELECT s.stationname, i.Stationid, i.Laneno, i.Month, i.Day, i.Year, i.Hour, i.Minute, i.Second,
to_date(datetime,'MM-DD-YY HH24:MI:SS') AS DateTime, i.VehicleNumber, i.VehicleClass,
i.GrossWeight, i.Length, i.Speed, i.ViolationCode
FROM (
SELECT Stationid, Laneno, VehicleNumber, VehicleClass, GrossWeight,Length, Speed,
ViolationCode, Month, Day, Year, Hour, Minute, Second,
Month||'-'||Day||'-'||Year||' '||Hour||':'||Minute||':'||Second AS datetime
FROM Wiminstance ) i, weightstation s
where s.stationid=i.stationid
and to_char(to_date(month||'-'||day||'-'||year,'MM-DD-YY'),'Dy') in ('Sat','Sun');
CREATE VIEW axle_weight_view AS
SELECT
i.Stationid, i.LaneNo, i.VehicleClass, i.Month, i.Day, i.Year, i.Hour, i.Minute, i.Second,
to_date(datetime,'MM-DD-YY HH24:MI:SS') AS DateTime,
i.Axle1RightWeight, i.Axle1LeftWeight,
i.Axle2RightWeight, i.Axle2LeftWeight,
i.Axle3RightWeight, i.Axle3LeftWeight,
i.Axle4RightWeight, i.Axle4LeftWeight,
i.Axle5RightWeight, i.Axle5LeftWeight,
i.Axle6RightWeight, i.Axle6LeftWeight,
i.Axle7RightWeight, i.Axle7LeftWeight,
i.Axle8RightWeight, i.Axle8LeftWeight,
i.Axle9RightWeight, i.Axle9LeftWeight
FROM ( SELECT
Stationid, LaneNo, VehicleClass,
Axle1RightWeight, Axle1LeftWeight,
Axle2RightWeight, Axle2LeftWeight,
Axle3RightWeight, Axle3LeftWeight,
Axle4RightWeight, Axle4LeftWeight,
Axle5RightWeight, Axle5LeftWeight,
Axle6RightWeight, Axle6LeftWeight,
Axle7RightWeight, Axle7LeftWeight,
Axle8RightWeight, Axle8LeftWeight,
Axle9RightWeight, Axle9LeftWeight,
Month, Day, Year, Hour, Minute, Second,
Month||'-'||Day||'-'||Year||' '||Hour||':'||Minute||':'||Second AS
datetime
58
FROM Wiminstance) i;

create_indx.sql
create bitmap index bit_vehicle_class_index on wiminstance (vehicleclass) tablespace imwindx;
create index speed_index on wiminstance (speed) tablespace imwindx;
create bitmap index bit_year_index on wiminstance (year) tablespace imwindx;
create index datetime_index on wiminstance (Month,Day,Year,Hour,Minute,Second) tablespace
imwindx;
create index bit_hour_index on wiminstance (hour) tablespace imwindx;

create_mv.sql
-- Materialized view which containes one year of data. It refreshs automaticaly every other day.
CREATE MATERIALIZED VIEW mv_pmk_wiminstance
REFRESH FORCE
START WITH SYSDATE
NEXT SYSDATE + 1
WITH PRIMARY KEY
AS
SELECT Stationid, Stationname, Laneno, Month, Day, Year, Hour, Minute, Second,
to_date(datetime,'MM-DD-YY HH24:MI:SS') AS DateTime, VehicleNumber, VehicleClass,
GrossWeight, Length, Speed, ViolationCode, AxleSpace12, AxleSpace23, AxleSpace34,
AxleSpace45, AxleSpace56, AxleSpace67, AxleSpace78, AxleSpace89
FROM (
SELECT i.Stationid, w.Stationname, i.Laneno, i.VehicleNumber, i.VehicleClass, i.GrossWeight,
i.Length, i.Speed, i.ViolationCode, i.AxleSpace12, i.AxleSpace23, i.AxleSpace34,
i.AxleSpace45, i.AxleSpace56, i.AxleSpace67, i.AxleSpace78, i.AxleSpace89,
i.Month, i.Day, i.Year, i.Hour, i.Minute, i.Second, i.Month||'-'||i.Day||'-'||i.Year||'
'||i.Hour||':'||i.Minute||':'||i.Second AS datetime
FROM Wiminstance i, Weightstation w where i.Stationid = w.Stationid);
59
create index id_datetime_index on mv_pmk_wiminstance(stationid,datetime) tablespace
imwindx;
create bitmap index mv_bit_year_index on mv_pmk_wiminstance(year)tablespace imwindx;
create bitmap index mv_bit_class_index on mv_pmk_wiminstance(vehicleclass)tablespace
imwindx;
60
APPENDIX B
MySQL Database Queries

mysql_usr.sql
# Create user 'robert'@'localhost'
CREATE USER 'robert'@'localhost' IDENTIFIED BY 'robert';
# Create user 'robert'@'%'
CREATE USER 'robert'@'%' IDENTIFIED BY 'robert';
# Create user 'robert'@'calproj1-oracle.ecs.csus.edu'
CREATE USER 'robert'@'%' IDENTIFIED BY 'robert';

mysql_grants.sql
# Grant privileges for user 'robert'@'%'
GRANT ALL PRIVILEGES ON *.* TO 'robert'@'%' WITH GRANT OPTION;
# Grant privileges for user 'robert'@'calproj1-oracle.ecs.csus.edu'
GRANT ALL PRIVILEGES ON *.* TO 'robert'@'calproj1-oracle.ecs.csus.edu' WITH
GRANT OPTION;
# Grant privileges for user 'robert'@'localhost'
GRANT ALL PRIVILEGES ON *.* TO 'robert'@'localhost' WITH GRANT OPTION;
# Grant privileges for user 'root'@'127.0.0.1'
GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' WITH GRANT OPTION;
# Grant privileges for user 'root'@'calproj1-oracle.ecs.csus.edu'
GRANT ALL PRIVILEGES ON *.* TO 'root'@'calproj1-oracle.ecs.csus.edu' WITH
GRANT OPTION;
# Grant privileges for user 'root'@'localhost'
61
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;

msql_tables.sql
# Login table
CREATE TABLE `login` (
`username` varchar(20) CHARACTER SET ascii DEFAULT NULL,
`password` varchar(20) CHARACTER SET ascii DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
# Weightstation table
CREATE TABLE `Weightstation` (
`Stationid` int(3) NOT NULL,
`Stationname` varchar(30) CHARACTER SET ascii NOT NULL,
`Dialup` int(3) DEFAULT NULL,
`Contact` varchar(20) CHARACTER SET ascii DEFAULT NULL,
`Enabled` int(3) DEFAULT NULL,
`Batch` int(3) DEFAULT NULL,
`District` int(2) DEFAULT NULL,
`County` varchar(8) CHARACTER SET ascii DEFAULT NULL,
`Route` int(3) DEFAULT NULL,
`Postmile` varchar(3) CHARACTER SET ascii DEFAULT NULL,
`Latitude` decimal(10,4) DEFAULT NULL,
`Longitude` decimal(10,4) DEFAULT NULL,
PRIMARY KEY (`Stationid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
# WeightstationLane table
CREATE TABLE `Weight_Station_Lane` (
`Stationid` int(3) NOT NULL,
`Laneno` int(1) NOT NULL,
`Direction` varchar(2) CHARACTER SET ascii DEFAULT NULL,
PRIMARY KEY (`Stationid`,`Laneno`),
CONSTRAINT `stationfk` FOREIGN KEY (`Stationid`) REFERENCES `Weightstation`
(`Stationid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
62
# Wiminstance table
CREATE TABLE `Wiminstance` (
`Stationid` int(3) NOT NULL,
`Laneno` int(1) NOT NULL,
`Month` int(2) NOT NULL,
`Day` int(2) NOT NULL,
`Year` int(4) NOT NULL,
`Hour` int(2) NOT NULL,
`Minute` int(2) NOT NULL,
`Second` int(2) NOT NULL,
`VehicleNumber` int(5) NOT NULL,
`VehicleClass` int(3) DEFAULT NULL,
`GrossWeight` decimal(6,1) DEFAULT NULL,
`Length` decimal(6,1) DEFAULT NULL,
`Speed` decimal(5,1) DEFAULT NULL,
`ViolationCode` int(3) DEFAULT NULL,
`Axle1RightWeight` decimal(4,1) DEFAULT NULL,
`Axle1LeftWeight` decimal(4,1) DEFAULT NULL,
`Axle2RightWeight` decimal(4,1) DEFAULT NULL,
`Axle2LeftWeight` decimal(4,1) DEFAULT NULL,
`AxleSpace12` decimal(4,1) DEFAULT NULL,
`Axle3RightWeight` decimal(4,1) DEFAULT NULL,
`Axle3LeftWeight` decimal(4,1) DEFAULT NULL,
`AxleSpace23` decimal(4,1) DEFAULT NULL,
`Axle4RightWeight` decimal(4,1) DEFAULT NULL,
`Axle4LeftWeight` decimal(4,1) DEFAULT NULL,
`AxleSpace34` decimal(4,1) DEFAULT NULL,
`Axle5RightWeight` decimal(4,1) DEFAULT NULL,
`Axle5LeftWeight` decimal(4,1) DEFAULT NULL,
`AxleSpace45` decimal(4,1) DEFAULT NULL,
`Axle6RightWeight` decimal(4,1) DEFAULT NULL,
`Axle6LeftWeight` decimal(4,1) DEFAULT NULL,
`AxleSpace56` decimal(4,1) DEFAULT NULL,
`Axle7RightWeight` decimal(4,1) DEFAULT NULL,
`Axle7LeftWeight` decimal(4,1) DEFAULT NULL,
`AxleSpace67` decimal(4,1) DEFAULT NULL,
`Axle8RightWeight` decimal(4,1) DEFAULT NULL,
`Axle8LeftWeight` decimal(4,1) DEFAULT NULL,
`AxleSpace78` decimal(4,1) DEFAULT NULL,
`Axle9RightWeight` decimal(4,1) DEFAULT NULL,
63
`Axle9LeftWeight` decimal(4,1) DEFAULT NULL,
`AxleSpace89` decimal(4,1) DEFAULT NULL,
`ErrorCode` int(2) DEFAULT NULL,
PRIMARY KEY
(`Stationid`,`Laneno`,`Month`,`Day`,`Year`,`Hour`,`Minute`,`Second`,`VehicleNumber`),
CONSTRAINT `wt_FK_To_weightstation` FOREIGN KEY (`Stationid`) REFERENCES
`Weightstation` (`Stationid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

views.sql
CREATE ALGORITHM=UNDEFINED DEFINER=`robert`@`%` SQL SECURITY DEFINER
VIEW `Wiminstance_Date_Fmt` AS
select
`i`.`Stationid` AS `Stationid`,
`s`.`Stationname` AS `stationname`,
`i`.`Month` AS `Month`,
`i`.`Day` AS `Day`,
`i`.`Year` AS `Year`,
`i`.`Hour` AS `Hour`,
`i`.`Minute` AS `Minute`,
`i`.`Second` AS `Second`,
`i`.`Laneno` AS `Laneno`,
`i`.`VehicleNumber` AS `VehicleNumber`,
`i`.`VehicleClass` AS `VehicleClass`,
`i`.`GrossWeight` AS `GrossWeight`,
`i`.`Length` AS `Length`,
`i`.`Speed` AS `Speed`,
`i`.`ViolationCode` AS `ViolationCode`,
`i`.`AxleSpace12` AS `AxleSpace12`,
`i`.`AxleSpace23` AS `AxleSpace23`,
`i`.`AxleSpace34` AS `AxleSpace34`,
`i`.`AxleSpace45` AS `AxleSpace45`,
`i`.`AxleSpace67` AS `AxleSpace67`,
`i`.`AxleSpace78` AS `AxleSpace78`,
`i`.`AxleSpace89` AS `AxleSpace89`,
concat(`i`.`Month`,'-',`i`.`Day`,'-',`i`.`Year`,' ',`i`.`Hour`,':',`i`.`Minute`,':',`i`.`Second`) AS
`datetime`
from
(`Wiminstance` `i` join `Weightstation` `s`)
64
where
(`i`.`Stationid` = `s`.`Stationid`);
CREATE ALGORITHM=UNDEFINED DEFINER=`robert`@`%` SQL SECURITY DEFINER
VIEW `axle_weight_view` AS
select
`Wiminstance`.`Stationid` AS `Stationid`,
`Wiminstance`.`Laneno` AS `LaneNo`,
`Wiminstance`.`VehicleClass` AS `VehicleClass`,
`Wiminstance`.`Axle1RightWeight` AS `Axle1RightWeight`,
`Wiminstance`.`Axle1LeftWeight` AS `Axle1LeftWeight`,
`Wiminstance`.`Axle2RightWeight` AS `Axle2RightWeight`,
`Wiminstance`.`Axle2LeftWeight` AS `Axle2LeftWeight`,
`Wiminstance`.`Axle3RightWeight` AS `Axle3RightWeight`,
`Wiminstance`.`Axle3LeftWeight` AS `Axle3LeftWeight`,
`Wiminstance`.`Axle4RightWeight` AS `Axle4RightWeight`,
`Wiminstance`.`Axle4LeftWeight` AS `Axle4LeftWeight`,
`Wiminstance`.`Axle5RightWeight` AS `Axle5RightWeight`,
`Wiminstance`.`Axle5LeftWeight` AS `Axle5LeftWeight`,
`Wiminstance`.`Axle6RightWeight` AS `Axle6RightWeight`,
`Wiminstance`.`Axle6LeftWeight` AS `Axle6LeftWeight`,
`Wiminstance`.`Axle7RightWeight` AS `Axle7RightWeight`,
`Wiminstance`.`Axle7LeftWeight` AS `Axle7LeftWeight`,
`Wiminstance`.`Axle8RightWeight` AS `Axle8RightWeight`,
`Wiminstance`.`Axle8LeftWeight` AS `Axle8LeftWeight`,
`Wiminstance`.`Axle9RightWeight` AS `Axle9RightWeight`,
`Wiminstance`.`Axle9LeftWeight` AS `Axle9LeftWeight`,
concat(`Wiminstance`.`Month`,'-',`Wiminstance`.`Day`,'-',`Wiminstance`.`Year`,'
',`Wiminstance`.`Hour`,':',`Wiminstance`.`Minute`,':',`Wiminstance`.`Second`) AS `datetime`
from
`Wiminstance`;
CREATE ALGORITHM=UNDEFINED DEFINER=`robert`@`%` SQL SECURITY DEFINER
VIEW `mv_pmk_wiminstance` AS
select
`i`.`Stationid` AS `Stationid`,
`w`.`Stationname` AS `Stationname`,
`i`.`Laneno` AS `Laneno`,
`i`.`VehicleNumber` AS `VehicleNumber`,
`i`.`VehicleClass` AS `VehicleClass`,
`i`.`GrossWeight` AS `GrossWeight`,
65
`i`.`Length` AS `Length`,
`i`.`Speed` AS `Speed`,
`i`.`ViolationCode` AS `ViolationCode`,
`i`.`AxleSpace12` AS `AxleSpace12`,
`i`.`AxleSpace23` AS `AxleSpace23`,
`i`.`AxleSpace34` AS `AxleSpace34`,
`i`.`AxleSpace45` AS `AxleSpace45`,
`i`.`AxleSpace56` AS `AxleSpace56`,
`i`.`AxleSpace67` AS `AxleSpace67`,
`i`.`AxleSpace78` AS `AxleSpace78`,
`i`.`AxleSpace89` AS `AxleSpace89`,
`i`.`Month` AS `Month`,
`i`.`Day` AS `Day`,
`i`.`Year` AS `Year`,
`i`.`Hour` AS `Hour`,
`i`.`Minute` AS `Minute`,
`i`.`Second` AS `Second`,
concat(`i`.`Month`,'-',`i`.`Day`,'-',`i`.`Year`,' ',`i`.`Hour`,':',`i`.`Minute`,':',`i`.`Second`) AS
`datetime`
from
(`Wiminstance` `i` join `Weightstation` `w`)
where
(`i`.`Stationid` = `w`.`Stationid`);
CREATE ALGORITHM=UNDEFINED DEFINER=`robert`@`%` SQL SECURITY DEFINER
VIEW `weekday_view` AS
select
`s`.`Stationname` AS `stationname`,
`i`.`Stationid` AS `Stationid`,
`i`.`Laneno` AS `Laneno`,
concat(`i`.`Month`,'-',`i`.`Day`,'-',`i`.`Year`,' ',`i`.`Hour`,':',`i`.`Minute`,':',`i`.`Second`) AS
`DateTime`,
concat(`i`.`Month`,'-',`i`.`Day`,'-',`i`.`Year`) AS `WimDate`,
`i`.`VehicleNumber` AS `VehicleNumber`,
`i`.`VehicleClass` AS `VehicleClass`,
`i`.`GrossWeight` AS `GrossWeight`,
`i`.`Length` AS `Length`,
`i`.`Speed` AS `Speed`,
`i`.`ViolationCode` AS `ViolationCode`
from
(`Wiminstance` `i` join `Weightstation` `s`)
where
66
((`s`.`Stationid` = `i`.`Stationid`) and
(date_format(str_to_date(concat(`i`.`Month`,',',`i`.`Day`,',',`i`.`Year`),'%m,%d,%Y'),'%a') not in
('Sat','Sun')));
CREATE ALGORITHM=UNDEFINED DEFINER=`robert`@`%` SQL SECURITY DEFINER
VIEW `weekend_view` AS
select
`s`.`Stationname` AS `stationname`,
`i`.`Stationid` AS `Stationid`,
`i`.`Laneno` AS `Laneno`,
concat(`i`.`Month`,'-',`i`.`Day`,'-',`i`.`Year`,' ',`i`.`Hour`,':',`i`.`Minute`,':',`i`.`Second`) AS
`DateTime`,
concat(`i`.`Month`,'-',`i`.`Day`,'-',`i`.`Year`) AS `WimDate`,
`i`.`VehicleNumber` AS `VehicleNumber`,
`i`.`VehicleClass` AS `VehicleClass`,
`i`.`GrossWeight` AS `GrossWeight`,
`i`.`Length` AS `Length`,
`i`.`Speed` AS `Speed`,
`i`.`ViolationCode` AS `ViolationCode`
from
(`Wiminstance` `i` join `Weightstation` `s`)
where
((`s`.`Stationid` = `i`.`Stationid`) and
(date_format(str_to_date(concat(`i`.`Month`,',',`i`.`Day`,',',`i`.`Year`),'%m,%d,%Y'),'%a') in
('Sat','Sun')));
67
APPENDIX C
Execution Time for Oracle Database
Run 1
Run 2
Run 3
Run 4
Run 5
Run 6
Run 7
Run 8
Run 9
Run 10
Run 11
Run 12
Run 13
Run 14
Run 15
Run 16
Run 17
Run 18
Run 19
Run 20
Run 21
Run 22
Run 23
Run 24
Run 25
Run 26
Run 27
Run 28
Run 29
Run 30
Averag
e Value
Axle Load
by Class
Axle Load
by Hour
1159
166
65
64
62
37
36
59
37
90
35
56
70
36
53
34
37
62
64
37
35
55
53
62
65
39
66
59
56
37
52.1785714
3
356
161
156
145
163
147
147
137
196
149
166
157
150
154
160
190
155
146
145
161
162
155
156
163
192
153
147
132
148
151
163.333333
3
Axle
Relationship
s
839
372
243
295
276
283
252
301
228
294
282
289
261
262
268
277
328
370
244
291
229
253
261
268
251
293
285
263
255
227
294.6666667
Empty/Loade
d Trucks by
Hour
551
263
256
284
241
256
254
243
264
278
257
254
299
272
255
263
303
324
262
256
285
240
264
255
271
264
285
266
242
256
275.4333333
Empty/Loade
d Trucks by
Station
507
499
521
287
453
409
250
231
337
227
472
240
486
245
239
441
240
244
465
323
450
256
213
470
207
300
471
257
220
244
340.1333333
Exceptionall
y Heavy
Vehicles
50
16
13
19
19
16
13
12
13
12
16
21
13
15
14
17
14
16
13
14
15
21
17
19
22
21
16
13
11
12
16.76666667
68
Run 1
Run 2
Run 3
Run 4
Run 5
Run 6
Run 7
Run 8
Run 9
Run 10
Run 11
Run 12
Run 13
Run 14
Run 15
Run 16
Run 17
Run 18
Run 19
Run 20
Run 21
Run 22
Run 23
Run 24
Run 25
Run 26
Run 27
Run 28
Run 29
Run 30
Average
Value
Lane wise
Truck
Distribution
Speeds by
Classification
Speeds
by
Hour
339
183
176
178
156
192
283
179
164
160
179
183
190
176
166
158
203
168
177
159
161
160
171
167
163
183
157
187
201
179
183.2666667
1157
88
168
195
162
161
164
206
180
169
210
164
241
166
195
211
243
228
194
169
291
196
173
168
183
224
186
209
192
269
225.4
279
169
420
171
150
169
217
149
149
164
149
174
187
214
177
276
145
157
167
183
224
146
140
154
186
398
156
161
146
291
195.6
Volume and
Percentage of
Trucks by
Hour
273
1095
290
215
424
205
416
282
206
220
401
201
222
201
226
212
218
213
206
216
224
225
204
201
216
206
221
213
416
285
278.4333333
Volume by
Station and
Classification
194
122
225
154
111
118
125
119
109
123
148
108
104
111
120
121
112
109
128
116
111
122
224
143
157
109
122
108
148
107
130.9333333
Wheel
Load
Deviance
Ratio
286
50
54
40
30
32
55
43
27
43
29
30
49
40
49
50
54
40
31
41
33
30
44
43
50
51
29
32
51
49
49.5
69
APPENDIX D
Oracle Web Report Queries

Axle load by Class
select vehicleclass,count(Less_10), count(Less_20), count(Less_30) , count(Less_40),
count(Less_50) , count(Less_60), count(Less_70) , count(Less_80),
count(Less_90), count(Less_100), count(GT_100) from ( select vehicleclass, (case
when grossweight between 0.0 and 9.9 then vehiclenumber End) Less_10, (case
when grossweight between 10.0 and 19.9 then vehiclenumber End) Less_20, (case
when grossweight between 20.0 and 29.9 then vehiclenumber End) Less_30,(case
when grossweight between 30.0 and 39.9 then vehiclenumber End) Less_40,(case
when grossweight between 40.0 and 49.9 then vehiclenumber End) Less_50,(case
when grossweight between 50.0 and 59.9 then vehiclenumber End) Less_60, (case
when grossweight between 60.0 and 69.9 then vehiclenumber End) Less_70,(case
when grossweight between 70.0 and 79.9 then vehiclenumber End) Less_80, (case
when grossweight between 80.0 and 89.9 then vehiclenumber End) Less_90, (case
when grossweight between 90.0 and 99.9 then vehiclenumber End) Less_100, (case
when grossweight > 100.0 then vehiclenumber End) GT_100
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 4 and 14)
group by vehicleclass)
select count(Less_10), count(Less_20), count(Less_30) , count(Less_40),
count(Less_50) , count(Less_60), count(Less_70) , count(Less_80),
count(Less_90), count(Less_100),count(GT_100) from ( select (case
when grossweight between 0.0 and 9.9 then vehiclenumber End) Less_10, (case
when grossweight between 10.0 and 19.9 then vehiclenumber End) Less_20, (case
when grossweight between 20.0 and 29.9 then vehiclenumber "End) Less_30,(case
when grossweight between 30.0 and 39.9 then vehiclenumber End) Less_40,(case
when grossweight between 40.0 and 49.9 then vehiclenumber End) Less_50,(case
when grossweight between 50.0 and 59.9 then vehiclenumber End) Less_60, (case
when grossweight between 60.0 and 69.9 then vehiclenumber End) Less_70,(case
when grossweight between 70.0 and 79.9 then vehiclenumber End) Less_80, (case
when grossweight between 80.0 and 89.9 then vehiclenumber "End) Less_90, (case
when grossweight between 90.0 and 99.9 then vehiclenumber End) Less_100, (case
when grossweight > 100.0 then vehiclenumber End) GT_100
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('"+ start_datetime +"','MM-DD-YY HH24-MI-SS') and
70
to_date('"+end_datetime+"','MM-DD-YY HH24-MI-SS') and vehicleclass between 4 and 14)")

Axle load by Hour
select Hour,count(Less_10), count(Less_20), count(Less_30) , count(Less_40),
count(Less_50) , count(Less_60), count(Less_70) , count(Less_80),
count(Less_90), count(Less_100), count(GT_100) from ( select Hour, (case
when grossweight between 0.0 and 9.9 then vehiclenumber End) Less_10, (case
when grossweight between 10.0 and 19.9 then vehiclenumber End) Less_20, (case
when grossweight between 20.0 and 29.9 then vehiclenumber End) Less_30,(case
when grossweight between 30.0 and 39.9 then vehiclenumber End) Less_40,(case
when grossweight between 40.0 and 49.9 then vehiclenumber End) Less_50,(case
when grossweight between 50.0 and 59.9 then vehiclenumber End) Less_60, (case
when grossweight between 60.0 and 69.9 then vehiclenumber End) Less_70,(case
when grossweight between 70.0 and 79.9 then vehiclenumber End) Less_80, (case
when grossweight between 80.0 and 89.9 then vehiclenumber End) Less_90, (case
when grossweight between 90.0 and 99.9 then vehiclenumber End) Less_100, (case
when grossweight > 100.0 then vehiclenumber End) GT_100
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and Hour between "+intStartHour+"
and "+intEndHour+") group by Hour")
select count(Less_10), count(Less_20), count(Less_30) , count(Less_40),
count(Less_50) , count(Less_60), count(Less_70) , count(Less_80),
count(Less_90), count(Less_100), count(GT_100) from ( select (case
when grossweight between 0.0 and 9.9 then vehiclenumber End) Less_10, (case
when grossweight between 10.0 and 19.9 then vehiclenumber End) Less_20, (case
when grossweight between 20.0 and 29.9 then vehiclenumber End) Less_30,(case
when grossweight between 30.0 and 39.9 then vehiclenumber End) Less_40,(case
when grossweight between 40.0 and 49.9 then vehiclenumber End) Less_50,(case
when grossweight between 50.0 and 59.9 then vehiclenumber End) Less_60, (case
when grossweight between 60.0 and 69.9 then vehiclenumber End) Less_70,(case
when grossweight between 70.0 and 79.9 then vehiclenumber End) Less_80, (case
when grossweight between 80.0 and 89.9 then vehiclenumber End) Less_90, (case
when grossweight between 90.0 and 99.9 then vehiclenumber End) Less_100, (case
when grossweight > 100.0 then vehiclenumber End) GT_100
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('"+ start_datetime +"','MM-DD-YY HH24-MI-SS') and
71
to_date('"+end_datetime+"','MM-DD-YY HH24-MI-SS') and Hour between "+intStartHour+"
and "+intEndHour+" order by hour)")

Empty-loaded by Hour
select Hour,
count(Empty_5), count(Loaded_5), count(Empty_6),count(Loaded_6),
count(Empty_7), count(Loaded_7), count(Empty_8), count(Loaded_8),
count(Empty_9), count(Loaded_9), count(Empty_10), count(Loaded_10),
count(Empty_11),count(Loaded_11),count(Empty_12), count(Loaded_12),
count(Empty_13),count(Loaded_13), count(Empty_14), count(Loaded_14)
from ( select Hour,
(case when grossweight < 9.9 and vehicleclass = 5 then vehiclenumber
End) Empty_5,
(case when grossweight >= 9.9 and vehicleclass = 5 then vehiclenumber
End) Loaded_5,
(case when grossweight < 16.5 and vehicleclass = 6 then vehiclenumber
End) Empty_6,
(case when grossweight >= 16.5 and vehicleclass = 6 then vehiclenumber
End) Loaded_6,
(case when grossweight < 19.8 and vehicleclass = 7 then vehiclenumber
End) Empty_7,
(case when grossweight >= 19.8 and vehicleclass = 7 then vehiclenumber
End) Loaded_7,
(case when grossweight < 27.6 and vehicleclass = 8 then vehiclenumber
End) Empty_8,
(case when grossweight >= 27.6 and vehicleclass = 8 then vehiclenumber
End) Loaded_8,
(case when grossweight < 30.9 and vehicleclass = 9 then vehiclenumber
End) Empty_9,
(case when grossweight >= 30.9 and vehicleclass = 9 then vehiclenumber
End) Loaded_9,
(case when grossweight < 34.2 and vehicleclass = 10 then vehiclenumber
End) Empty_10,
(case when grossweight >= 34.2 and vehicleclass = 10 then vehiclenumber
End) Loaded_10,
(case when grossweight < 37.5 and vehicleclass = 11 then vehiclenumber
End) Empty_11,
(case when grossweight >= 37.5 and vehicleclass = 11 then vehiclenumber
72
End) Loaded_11,
(case when grossweight < 41.9 and vehicleclass = 12 then vehiclenumber
End) Empty_12,
(case when grossweight >= 41.9 and vehicleclass = 12 then vehiclenumber
End) Loaded_12,
(case when grossweight < 46.3 and vehicleclass = 13 then vehiclenumber
End) Empty_13,
(case when grossweight >= 46.3 and vehicleclass = 13 then vehiclenumber
End) Loaded_13,
(case when grossweight < 30.9 and vehicleclass = 14 then vehiclenumber
End) Empty_14,
(case when grossweight >= 30.9 and vehicleclass = 14 then vehiclenumber
End) Loaded_14
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 5 and 14 and
Hour between "+intStartHour+ " and "+ intEndHour + ")group by Hour
select
count(Empty_5), count(Loaded_5), count(Empty_6),count(Loaded_6),
count(Empty_7) , count(Loaded_7), count(Empty_8), count(Loaded_8),
count(Empty_9) , count(Loaded_9), count(Empty_10), count(Loaded_10),
count(Empty_11) ,count(Loaded_11),count(Empty_12), count(Loaded_12),
count(Empty_13),count(Loaded_13), count(Empty_14), count(Loaded_14)
from ( select
(case when grossweight < 9.9 and vehicleclass = 5 then vehiclenumber
End) Empty_5,
(case when grossweight >= 9.9 and vehicleclass = 5 then vehiclenumber
End) Loaded_5,
(case when grossweight < 16.5 and vehicleclass = 6 then vehiclenumber
End) Empty_6,
(case when grossweight >= 16.5 and vehicleclass = 6 then vehiclenumber
End) Loaded_6,
(case when grossweight < 19.8 and vehicleclass = 7 then vehiclenumber
End) Empty_7,
(case when grossweight >= 19.8 and vehicleclass = 7 then vehiclenumber
End) Loaded_7,
(case when grossweight < 27.6 and vehicleclass = 8 then vehiclenumber
End) Empty_8,
(case when grossweight >= 27.6 and vehicleclass = 8 then vehiclenumber
End) Loaded_8,
(case when grossweight < 30.9 and vehicleclass = 9 then vehiclenumber
End) Empty_9,
73
(case when grossweight >= 30.9 and vehicleclass = 9 then vehiclenumber
End) Loaded_9,
(case when grossweight < 34.2 and vehicleclass = 10 then vehiclenumber
End) Empty_10,
(case when grossweight >= 34.2 and vehicleclass = 10 then vehiclenumber
End) Loaded_10,
(case when grossweight < 37.5 and vehicleclass = 11 then vehiclenumber
End) Empty_11,
(case when grossweight >= 37.5 and vehicleclass = 11 then vehiclenumber
End) Loaded_11,
(case when grossweight < 41.9 and vehicleclass = 12 then vehiclenumber
End) Empty_12,
(case when grossweight >= 41.9 and vehicleclass = 12 then vehiclenumber
End) Loaded_12,
(case when grossweight < 46.3 and vehicleclass = 13 then vehiclenumber
End) Empty_13,
(case when grossweight >= 46.3 and vehicleclass = 13 then vehiclenumber
End) Loaded_13,
(case when grossweight < 30.9 and vehicleclass = 14 then vehiclenumber
End) Empty_14,
(case when grossweight >= 30.9 and vehicleclass = 14 then vehiclenumber
End) Loaded_14
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and to_date('"
+ end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 5 and 14 and Hour
between " + intStartHour + " and " + intEndHour + ")")

Empty-loaded by Station
select stationid,
count(Empty_5), count(Loaded_5), count(Empty_6),count(Loaded_6),
count(Empty_7), count(Loaded_7), count(Empty_8), count(Loaded_8),
count(Empty_9), count(Loaded_9), count(Empty_10), count(Loaded_10),
count(Empty_11),count(Loaded_11),count(Empty_12), count(Loaded_12),
count(Empty_13),count(Loaded_13), count(Empty_14), count(Loaded_14)
from ( select stationid,
(case when grossweight < 9.9 and vehicleclass = 5 then vehiclenumber
End) Empty_5,
(case when grossweight >= 9.9 and vehicleclass = 5 then vehiclenumber
74
End) Loaded_5,
(case when grossweight < 16.5 and vehicleclass = 6 then vehiclenumber
End) Empty_6,
(case when grossweight >= 16.5 and vehicleclass = 6 then vehiclenumber
End) Loaded_6,
(case when grossweight < 19.8 and vehicleclass = 7 then vehiclenumber
End) Empty_7,
(case when grossweight >= 19.8 and vehicleclass = 7 then vehiclenumber
End) Loaded_7,
(case when grossweight < 27.6 and vehicleclass = 8 then vehiclenumber
End) Empty_8,
(case when grossweight >= 27.6 and vehicleclass = 8 then vehiclenumber
End) Loaded_8,
(case when grossweight < 30.9 and vehicleclass = 9 then vehiclenumber
End) Empty_9,
(case when grossweight >= 30.9 and vehicleclass = 9 then vehiclenumber
End) Loaded_9,
(case when grossweight < 34.2 and vehicleclass = 10 then vehiclenumber
End) Empty_10,
(case when grossweight >= 34.2 and vehicleclass = 10 then vehiclenumber
End) Loaded_10,
(case when grossweight < 37.5 and vehicleclass = 11 then vehiclenumber
End) Empty_11,
(case when grossweight >= 37.5 and vehicleclass = 11 then vehiclenumber
End) Loaded_11,
(case when grossweight < 41.9 and vehicleclass = 12 then vehiclenumber
End) Empty_12,
(case when grossweight >= 41.9 and vehicleclass = 12 then vehiclenumber
End) Loaded_12,
(case when grossweight < 46.3 and vehicleclass = 13 then vehiclenumber
End) Empty_13,
(case when grossweight >= 46.3 and vehicleclass = 13 then vehiclenumber
End) Loaded_13,
(case when grossweight < 30.9 and vehicleclass = 14 then vehiclenumber
End) Empty_14,
(case when grossweight >= 30.9 and vehicleclass = 14 then vehiclenumber
End) Loaded_14
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 5 and 14
)group by stationid")
select
75
count(Empty_5), count(Loaded_5), count(Empty_6),count(Loaded_6),
count(Empty_7) , count(Loaded_7), count(Empty_8), count(Loaded_8),
count(Empty_9) , count(Loaded_9), count(Empty_10), count(Loaded_10),
count(Empty_11) ,count(Loaded_11),count(Empty_12), count(Loaded_12),
count(Empty_13),count(Loaded_13), count(Empty_14), count(Loaded_14)
from ( select
(case when grossweight < 9.9 and vehicleclass = 5 then vehiclenumber
End) Empty_5,
(case when grossweight >= 9.9 and vehicleclass = 5 then vehiclenumber
End) Loaded_5,
(case when grossweight < 16.5 and vehicleclass = 6 then vehiclenumber
End) Empty_6,
(case when grossweight >= 16.5 and vehicleclass = 6 then vehiclenumber
End) Loaded_6,
(case when grossweight < 19.8 and vehicleclass = 7 then vehiclenumber
End) Empty_7,
(case when grossweight >= 19.8 and vehicleclass = 7 then vehiclenumber
End) Loaded_7,
(case when grossweight < 27.6 and vehicleclass = 8 then vehiclenumber
End) Empty_8,
(case when grossweight >= 27.6 and vehicleclass = 8 then vehiclenumber
End) Loaded_8,
(case when grossweight < 30.9 and vehicleclass = 9 then vehiclenumber
End) Empty_9,
(case when grossweight >= 30.9 and vehicleclass = 9 then vehiclenumber
End) Loaded_9,
(case when grossweight < 34.2 and vehicleclass = 10 then vehiclenumber
End) Empty_10,
(case when grossweight >= 34.2 and vehicleclass = 10 then vehiclenumber
End) Loaded_10,
(case when grossweight < 37.5 and vehicleclass = 11 then vehiclenumber
End) Empty_11,
(case when grossweight >= 37.5 and vehicleclass = 11 then vehiclenumber
End) Loaded_11,
(case when grossweight < 41.9 and vehicleclass = 12 then vehiclenumber
End) Empty_12,
(case when grossweight >= 41.9 and vehicleclass = 12 then vehiclenumber
End) Loaded_12,
(case when grossweight < 46.3 and vehicleclass = 13 then vehiclenumber
End) Empty_13,
(case when grossweight >= 46.3 and vehicleclass = 13 then vehiclenumber
End) Loaded_13,
(case when grossweight < 30.9 and vehicleclass = 14 then vehiclenumber
76
End) Empty_14,
(case when grossweight >= 30.9 and vehicleclass = 14 then vehiclenumber
End) Loaded_14
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and to_date('"
+ end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 5 and 14 )

Lane-wise Truck Distribution
select Laneno, count(Class_4), count(Class_5), count(Class_6) , count(Class_7),
count(Class_8) , count(Class_9), count(Class_10) , count(Class_11),
count(Class_12) , count(Class_13), count(Class_14) from
( select Laneno,
(case when vehicleclass = 4 then vehiclenumber
End) Class_4,
(case when vehicleclass = 5 then vehiclenumber
End) Class_5,
(case when vehicleclass = 6 then vehiclenumber
End) Class_6,
(case when vehicleclass = 7 then vehiclenumber
End) Class_7,
(case when vehicleclass = 8 then vehiclenumber
End) Class_8,
(case when vehicleclass = 9 then vehiclenumber
End) Class_9,
(case when vehicleclass = 10 then vehiclenumber
End) Class_10,
(case when vehicleclass = 11 then vehiclenumber
End) Class_11,
(case when vehicleclass = 12 then vehiclenumber
End) Class_12,
(case when vehicleclass = 13 then vehiclenumber
End) Class_13,
(case when vehicleclass = 14 then vehiclenumber
End) Class_14
from mv_pmk_wiminstance where stationid = " + stationid + "
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS'))group by Laneno")
select count(Class_4), count(Class_5), count(Class_6) , count(Class_7),
count(Class_8) , count(Class_9), count(Class_10) , count(Class_11),
77
count(Class_12) , count(Class_13), count(Class_14) from
( select
(case when vehicleclass = 4 then vehiclenumber
End) Class_4,
(case when vehicleclass = 5 then vehiclenumber
End) Class_5,
(case when vehicleclass = 6 then vehiclenumber
End) Class_6,
(case when vehicleclass = 7 then vehiclenumber
End) Class_7,
(case when vehicleclass = 8 then vehiclenumber
End) Class_8,
(case when vehicleclass = 9 then vehiclenumber
End) Class_9,
(case when vehicleclass = 10 then vehiclenumber
End) Class_10,
(case when vehicleclass = 11 then vehiclenumber
End) Class_11,
(case when vehicleclass = 12 then vehiclenumber
End) Class_12,
(case when vehicleclass = 13 then vehiclenumber
End) Class_13,
(case when vehicleclass = 14 then vehiclenumber
End) Class_14
from mv_pmk_wiminstance where stationid = " + stationid + "
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 4 and 14)")

Speeds by Classification
select vehicleclass,
count(Less_35), count(Less_40), count(Less_45) , count(Less_50),
count(Less_55) , count(Less_60), count(Less_65) , count(Less_70),
count(Less_75), count(Less_80), count(Less_85), count(GT_85)
from ( select vehicleclass, (case
when speed < 35 then vehiclenumber
End) Less_35, (case when speed between 36 and 40 then vehiclenumber
End) Less_40, (case when speed between 41 and 45 then vehiclenumber
End) Less_45,(case when speed between 46 and 50 then vehiclenumber
78
End) Less_50,(case when speed between 51 and 55 then vehiclenumber
End) Less_55,(case when speed between 56 and 60 then vehiclenumber
End) Less_60, (case when speed between 61 and 65 then vehiclenumber
End) Less_65,(case when speed between 66 and 70 then vehiclenumber
End) Less_70, (case when speed between 71 and 75 then vehiclenumber
End) Less_75, (case when speed between 76 and 80 then vehiclenumber
End) Less_80, (case when speed between 81 and 85 then vehiclenumber
End) Less_85,(case when speed > 85 then vehiclenumber
End) GT_85 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 2 and 15)
group by vehicleclass")

Speeds by Hour
select Hour,
count(Less_35), count(Less_40), count(Less_45) , count(Less_50),
count(Less_55) , count(Less_60), count(Less_65) , count(Less_70),
count(Less_75), count(Less_80), count(Less_85), count(GT_85)
from ( select hour, (case when speed < 35 then vehiclenumber
End) Less_35, (case when speed between 36 and 40 then vehiclenumber
End) Less_40, (case when speed between 41 and 45 then vehiclenumber
End) Less_45,(case when speed between 46 and 50 then vehiclenumber
End) Less_50,(case when speed between 51 and 55 then vehiclenumber
End) Less_55,(case when speed between 56 and 60 then vehiclenumber
End) Less_60, (case when speed between 61 and 65 then vehiclenumber
End) Less_65,(case when speed between 66 and 70 then vehiclenumber
End) Less_70, (case when speed between 71 and 75 then vehiclenumber
End) Less_75, (case when speed between 76 and 80 then vehiclenumber
End) Less_80, (case when speed between 81 and 85 then vehiclenumber
End) Less_85,(case when speed > 85 then vehiclenumber
End) GT_85 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+"','MM-DD-YY HH24-MI-SS') and Hour between " + intStartHour + "
and " + intEndHour + ") group by Hour")
79

Volume by Hour by Class
select Hour,count(Class_2), count(Class_3), count(Class_4), count(Class_5),
count(Class_6) , count(Class_7), count(Class_8) , count(Class_9),
count(Class_10) , count(Class_11), count(Class_12) , count(Class_13),
count(Class_14), count(Class_15) from
( select Hour,
(case when vehicleclass = 2 then vehiclenumber
End) Class_2,
(case when vehicleclass = 3 then vehiclenumber
End) Class_3,
(case when vehicleclass = 4 then vehiclenumber
End) Class_4,
(case when vehicleclass = 5 then vehiclenumber
End) Class_5,
(case when vehicleclass = 6 then vehiclenumber
End) Class_6,
(case when vehicleclass = 7 then vehiclenumber
End) Class_7,
(case when vehicleclass = 8 then vehiclenumber
End) Class_8,
(case when vehicleclass = 9 then vehiclenumber
End) Class_9,
(case when vehicleclass = 10 then vehiclenumber
End) Class_10,
(case when vehicleclass = 11 then vehiclenumber
End) Class_11,
(case when vehicleclass = 12 then vehiclenumber
End) Class_12,
(case when vehicleclass = 13 then vehiclenumber
End) Class_13,
(case when vehicleclass = 14 then vehiclenumber
End) Class_14,
(case when vehicleclass = 15 then vehiclenumber
End) Class_15 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and Hour between "+intStartHour+"
and "+intEndHour+") group by Hour")
80
APPENDIX E
Execution Time for MySQL Database
Run 1
Run 2
Run 3
Run 4
Run 5
Run 6
Run 7
Run 8
Run 9
Run 10
Run 11
Run 12
Run 13
Run 14
Run 15
Run 16
Run 17
Run 18
Run 19
Run 20
Run 21
Run 22
Run 23
Run 24
Run 25
Run 26
Run 27
Run 28
Run 29
Run 30
Averag
e Value
Axle Load
by Class
Axle Load
by Hour
141
37
36
47
37
31
65
34
49
35
54
32
35
36
32
69
34
30
38
40
37
35
60
56
38
50
44
65
49
45
43.3214285
7
122
51
41
48
43
35
42
47
31
90
37
52
43
32
42
78
44
40
38
32
45
35
42
50
44
38
52
33
46
51
47.4666666
7
Axle
Relationship
s
239
420
228
214
237
240
374
226
207
289
209
245
241
225
210
241
257
247
230
238
227
215
296
250
244
201
322
242
241
231
249.5333333
Empty/Loade
d Trucks by
Hour
600
221
236
232
410
227
243
402
217
245
250
217
270
230
231
228
250
385
251
224
232
230
236
218
251
273
229
247
211
245
264.7
Empty/Loade
d Trucks by
Station
204
188
197
185
181
196
167
182
176
204
177
172
168
184
201
196
170
122
214
166
151
159
183
185
191
167
173
177
169
185
179.6666667
Exceptionall
y Heavy
Vehicles
14
23
14
12
20
10
13
11
12
16
10
11
12
11
16
11
10
16
11
10
13
14
17
16
11
20
14
13
12
10
13.43333333
81
Run 1
Run 2
Run 3
Run 4
Run 5
Run 6
Run 7
Run 8
Run 9
Run 10
Run 11
Run 12
Run 13
Run 14
Run 15
Run 16
Run 17
Run 18
Run 19
Run 20
Run 21
Run 22
Run 23
Run 24
Run 25
Run 26
Run 27
Run 28
Run 29
Run 30
Average
Value
Lanewise
Truck
Distribution
Speeds by
Clasification
Speeds
by
Hour
40
50
40
92
44
54
43
42
54
43
43
69
55
63
66
39
51
53
42
48
53
46
49
52
55
65
56
48
43
50
51.6
62
45
30
51
52
33
32
38
40
38
34
39
35
32
50
84
61
31
36
39
41
33
31
40
52
34
36
51
45
52
42.56666667
209
43
46
31
41
35
46
38
36
45
38
36
42
32
39
32
48
39
39
43
31
39
37
42
41
43
47
36
44
47
45.5
Volume and
Percentage of
Trucks by
Hour
47
39
38
33
41
42
30
33
29
28
19
45
42
20
36
23
26
51
25
29
37
20
44
25
41
34
51
23
38
28
33.9
Volume by
Station and
Classification
49
22
22
16
16
20
17
29
16
16
19
20
17
22
20
24
16
20
15
17
20
24
19
17
18
22
23
28
16
19
20.63333333
Wheel
Load
Deviance
Ratio
71
27
30
31
25
23
42
32
23
32
30
25
26
23
31
30
31
29
45
32
23
34
27
30
42
29
33
30
23
24
31.1
82
APPENDIX F
MySQL Web Report Queries

Axle load by Class
select vehicleclass,count(Less_10), count(Less_20), count(Less_30) , count(Less_40),
count(Less_50) , count(Less_60), count(Less_70) , count(Less_80),
count(Less_90), count(Less_100), count(GT_100)
from ( select vehicleclass, (case
when grossweight between 0.0 and 9.9 then vehiclenumber
End) Less_10, (case when grossweight between 10.0 and 19.9 then vehiclenumber
End) Less_20, (case when grossweight between 20.0 and 29.9 then vehiclenumber
End) Less_30,(case when grossweight between 30.0 and 39.9 then vehiclenumber
End) Less_40,(case when grossweight between 40.0 and 49.9 then vehiclenumber
End) Less_50,(case when grossweight between 50.0 and 59.9 then vehiclenumber
End) Less_60, (case when grossweight between 60.0 and 69.9 then vehiclenumber
End) Less_70,(case when grossweight between 70.0 and 79.9 then vehiclenumber
End) Less_80, (case when grossweight between 80.0 and 89.9 then vehiclenumber
End) Less_90, (case when grossweight between 90.0 and 99.9 then vehiclenumber
End) Less_100, (case when grossweight > 100.0 then vehiclenumber
End) GT_100 from mv_pmk_wiminstance where ( “+ strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 4 and 14)
group by vehicleclass");
select count(Less_10), count(Less_20),
count(Less_30) , count(Less_40), count(Less_50) , count(Less_60),
count(Less_70) , count(Less_80), count(Less_90), count(Less_100), count(GT_100)
from ( select (case when grossweight between 0.0 and 9.9 then vehiclenumber
End) Less_10, (case when grossweight between 10.0 and 19.9 then vehiclenumber
End) Less_20, (case when grossweight between 20.0 and 29.9 then vehiclenumber
End) Less_30,(case when grossweight between 30.0 and 39.9 then vehiclenumber
End) Less_40,(case when grossweight between 40.0 and 49.9 then vehiclenumber
End) Less_50,(case when grossweight between 50.0 and 59.9 then vehiclenumber
End) Less_60, (case when grossweight between 60.0 and 69.9 then vehiclenumber
End) Less_70,(case when grossweight between 70.0 and 79.9 then vehiclenumber
End) Less_80, (case when grossweight between 80.0 and 89.9 then vehiclenumber
End) Less_90, (case when grossweight between 90.0 and 99.9 then vehiclenumber
83
End) Less_100, (case when grossweight > 100.0 then vehiclenumber
End) GT_100 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('"+ start_datetime +"','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+"','MM-DD-YY HH24-MI-SS') and vehicleclass between 4 and 14)")

Axle load by Hour
select Hour,count(Less_10), count(Less_20), count(Less_30) , count(Less_40),
count(Less_50) , count(Less_60), count(Less_70) , count(Less_80),
count(Less_90), count(Less_100), count(GT_100)
from ( select Hour, (case when grossweight between 0.0 and 9.9 then vehiclenumber
End) Less_10, (case when grossweight between 10.0 and 19.9 then vehiclenumber
End) Less_20, (case when grossweight between 20.0 and 29.9 then vehiclenumber
End) Less_30,(case when grossweight between 30.0 and 39.9 then vehiclenumber
End) Less_40,(case when grossweight between 40.0 and 49.9 then vehiclenumber
End) Less_50,(case when grossweight between 50.0 and 59.9 then vehiclenumber
End) Less_60, (case when grossweight between 60.0 and 69.9 then vehiclenumber
End) Less_70,(case when grossweight between 70.0 and 79.9 then vehiclenumber
End) Less_80, (case when grossweight between 80.0 and 89.9 then vehiclenumber
End) Less_90, (case when grossweight between 90.0 and 99.9 then vehiclenumber
End) Less_100, (case when grossweight > 100.0 then vehiclenumber
End) GT_100 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and Hour between "+intStartHour+"
and "+intEndHour+") group by Hour");
select count(Less_10), count(Less_20), count(Less_30) , count(Less_40),
count(Less_50) , count(Less_60), count(Less_70) , count(Less_80),
count(Less_90), count(Less_100), count(GT_100)
from ( select (case when grossweight between 0.0 and 9.9 then vehiclenumber
End) Less_10, (case when grossweight between 10.0 and 19.9 then vehiclenumber
End) Less_20, (case when grossweight between 20.0 and 29.9 then vehiclenumber
End) Less_30,(case when grossweight between 30.0 and 39.9 then vehiclenumber
End) Less_40,(case when grossweight between 40.0 and 49.9 then vehiclenumber
End) Less_50,(case when grossweight between 50.0 and 59.9 then vehiclenumber
End) Less_60, (case when grossweight between 60.0 and 69.9 then vehiclenumber
End) Less_70,(case when grossweight between 70.0 and 79.9 then vehiclenumber
End) Less_80, (case when grossweight between 80.0 and 89.9 then vehiclenumber
End) Less_90, (case when grossweight between 90.0 and 99.9 then vehiclenumber
84
End) Less_100, (case when grossweight > 100.0 then vehiclenumber
End) GT_100 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('"+ start_datetime +"','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+"','MM-DD-YY HH24-MI-SS') and Hour between "+intStartHour+"
and "+intEndHour+")")

Empty-loaded by Hour
select Hour,
count(Empty_5), count(Loaded_5), count(Empty_6),count(Loaded_6),
count(Empty_7), count(Loaded_7), count(Empty_8), count(Loaded_8),
count(Empty_9), count(Loaded_9), count(Empty_10), count(Loaded_10),
count(Empty_11),count(Loaded_11),count(Empty_12), count(Loaded_12),
count(Empty_13),count(Loaded_13), count(Empty_14), count(Loaded_14)
from ( select Hour,
(case when grossweight < 9.9 and vehicleclass = 5 then vehiclenumber
End) Empty_5,
(case when grossweight >= 9.9 and vehicleclass = 5 then vehiclenumber
End) Loaded_5,
(case when grossweight < 16.5 and vehicleclass = 6 then vehiclenumber
End) Empty_6,
(case when grossweight >= 16.5 and vehicleclass = 6 then vehiclenumber
End) Loaded_6,
(case when grossweight < 19.8 and vehicleclass = 7 then vehiclenumber
End) Empty_7,
(case when grossweight >= 19.8 and vehicleclass = 7 then vehiclenumber
End) Loaded_7,
(case when grossweight < 27.6 and vehicleclass = 8 then vehiclenumber
End) Empty_8,
(case when grossweight >= 27.6 and vehicleclass = 8 then vehiclenumber
End) Loaded_8,
(case when grossweight < 30.9 and vehicleclass = 9 then vehiclenumber
End) Empty_9,
(case when grossweight >= 30.9 and vehicleclass = 9 then vehiclenumber
End) Loaded_9,
(case when grossweight < 34.2 and vehicleclass = 10 then vehiclenumber
End) Empty_10,
(case when grossweight >= 34.2 and vehicleclass = 10 then vehiclenumber
End) Loaded_10,
85
(case when grossweight < 37.5 and vehicleclass = 11 then vehiclenumber
End) Empty_11,
(case when grossweight >= 37.5 and vehicleclass = 11 then vehiclenumber
End) Loaded_11,
(case when grossweight < 41.9 and vehicleclass = 12 then vehiclenumber
End) Empty_12,
(case when grossweight >= 41.9 and vehicleclass = 12 then vehiclenumber
End) Loaded_12,
(case when grossweight < 46.3 and vehicleclass = 13 then vehiclenumber
End) Empty_13,
(case when grossweight >= 46.3 and vehicleclass = 13 then vehiclenumber
End) Loaded_13,
(case when grossweight < 30.9 and vehicleclass = 14 then vehiclenumber
End) Empty_14,
(case when grossweight >= 30.9 and vehicleclass = 14 then vehiclenumber
End) Loaded_14 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 5 and 14 and
Hour between "+intStartHour+ " and "+ intEndHour + ")group by Hour");
select count(Empty_5), count(Loaded_5), count(Empty_6),count(Loaded_6),
count(Empty_7) , count(Loaded_7), count(Empty_8), count(Loaded_8),
count(Empty_9) , count(Loaded_9), count(Empty_10), count(Loaded_10),
count(Empty_11) ,count(Loaded_11),count(Empty_12), count(Loaded_12),
count(Empty_13),count(Loaded_13), count(Empty_14), count(Loaded_14)
from ( select
(case when grossweight < 9.9 and vehicleclass = 5 then vehiclenumber
End) Empty_5,
(case when grossweight >= 9.9 and vehicleclass = 5 then vehiclenumber
End) Loaded_5,
(case when grossweight < 16.5 and vehicleclass = 6 then vehiclenumber
End) Empty_6,
(case when grossweight >= 16.5 and vehicleclass = 6 then vehiclenumber
End) Loaded_6,
(case when grossweight < 19.8 and vehicleclass = 7 then vehiclenumber
End) Empty_7,
(case when grossweight >= 19.8 and vehicleclass = 7 then vehiclenumber
End) Loaded_7,
(case when grossweight < 27.6 and vehicleclass = 8 then vehiclenumber
End) Empty_8,
(case when grossweight >= 27.6 and vehicleclass = 8 then vehiclenumber
End) Loaded_8,
(case when grossweight < 30.9 and vehicleclass = 9 then vehiclenumber
86
End) Empty_9,
(case when grossweight >= 30.9 and vehicleclass = 9 then vehiclenumber
End) Loaded_9,
(case when grossweight < 34.2 and vehicleclass = 10 then vehiclenumber
End) Empty_10,
(case when grossweight >= 34.2 and vehicleclass = 10 then vehiclenumber
End) Loaded_10,
(case when grossweight < 37.5 and vehicleclass = 11 then vehiclenumber
End) Empty_11,
(case when grossweight >= 37.5 and vehicleclass = 11 then vehiclenumber
End) Loaded_11,
(case when grossweight < 41.9 and vehicleclass = 12 then vehiclenumber
End) Empty_12,
(case when grossweight >= 41.9 and vehicleclass = 12 then vehiclenumber
End) Loaded_12,
(case when grossweight < 46.3 and vehicleclass = 13 then vehiclenumber
End) Empty_13,
(case when grossweight >= 46.3 and vehicleclass = 13 then vehiclenumber
End) Loaded_13,
(case when grossweight < 30.9 and vehicleclass = 14 then vehiclenumber
End) Empty_14,
(case when grossweight >= 30.9 and vehicleclass = 14 then vehiclenumber
End) Loaded_14 from mv_pmk_wiminstance where ( “+ strWhereStations + “)
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and to_date('"
+ end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 5 and 14 and Hour
between " + intStartHour + " and " + intEndHour + ")");

Empty-loaded by Station
select stationid,
count(Empty_5), count(Loaded_5), count(Empty_6),count(Loaded_6),
count(Empty_7), count(Loaded_7), count(Empty_8), count(Loaded_8),
count(Empty_9), count(Loaded_9), count(Empty_10), count(Loaded_10),
count(Empty_11),count(Loaded_11),count(Empty_12), count(Loaded_12),
count(Empty_13),count(Loaded_13), count(Empty_14), count(Loaded_14)
from ( select stationid,
(case when grossweight < 9.9 and vehicleclass = 5 then vehiclenumber
End) Empty_5,
(case when grossweight >= 9.9 and vehicleclass = 5 then vehiclenumber
87
End) Loaded_5,
(case when grossweight < 16.5 and vehicleclass = 6 then vehiclenumber
End) Empty_6,
(case when grossweight >= 16.5 and vehicleclass = 6 then vehiclenumber
End) Loaded_6,
(case when grossweight < 19.8 and vehicleclass = 7 then vehiclenumber
End) Empty_7,
(case when grossweight >= 19.8 and vehicleclass = 7 then vehiclenumber
End) Loaded_7,
(case when grossweight < 27.6 and vehicleclass = 8 then vehiclenumber
End) Empty_8,
(case when grossweight >= 27.6 and vehicleclass = 8 then vehiclenumber
End) Loaded_8,
(case when grossweight < 30.9 and vehicleclass = 9 then vehiclenumber
End) Empty_9,
(case when grossweight >= 30.9 and vehicleclass = 9 then vehiclenumber
End) Loaded_9,
(case when grossweight < 34.2 and vehicleclass = 10 then vehiclenumber
End) Empty_10,
(case when grossweight >= 34.2 and vehicleclass = 10 then vehiclenumber
End) Loaded_10,
(case when grossweight < 37.5 and vehicleclass = 11 then vehiclenumber
End) Empty_11,
(case when grossweight >= 37.5 and vehicleclass = 11 then vehiclenumber
End) Loaded_11,
(case when grossweight < 41.9 and vehicleclass = 12 then vehiclenumber
End) Empty_12,
(case when grossweight >= 41.9 and vehicleclass = 12 then vehiclenumber
End) Loaded_12,
(case when grossweight < 46.3 and vehicleclass = 13 then vehiclenumber
End) Empty_13,
(case when grossweight >= 46.3 and vehicleclass = 13 then vehiclenumber
End) Loaded_13,
(case when grossweight < 30.9 and vehicleclass = 14 then vehiclenumber
End) Empty_14,
(case when grossweight >= 30.9 and vehicleclass = 14 then vehiclenumber
End) Loaded_14
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 5 and 14
)group by stationid")
select
88
count(Empty_5), count(Loaded_5), count(Empty_6),count(Loaded_6),
count(Empty_7) , count(Loaded_7), count(Empty_8), count(Loaded_8),
count(Empty_9) , count(Loaded_9), count(Empty_10), count(Loaded_10),
count(Empty_11) ,count(Loaded_11),count(Empty_12), count(Loaded_12),
count(Empty_13),count(Loaded_13), count(Empty_14), count(Loaded_14)
from ( select
(case when grossweight < 9.9 and vehicleclass = 5 then vehiclenumber
End) Empty_5,
(case when grossweight >= 9.9 and vehicleclass = 5 then vehiclenumber
End) Loaded_5,
(case when grossweight < 16.5 and vehicleclass = 6 then vehiclenumber
End) Empty_6,
(case when grossweight >= 16.5 and vehicleclass = 6 then vehiclenumber
End) Loaded_6,
(case when grossweight < 19.8 and vehicleclass = 7 then vehiclenumber
End) Empty_7,
(case when grossweight >= 19.8 and vehicleclass = 7 then vehiclenumber
End) Loaded_7,
(case when grossweight < 27.6 and vehicleclass = 8 then vehiclenumber
End) Empty_8,
(case when grossweight >= 27.6 and vehicleclass = 8 then vehiclenumber
End) Loaded_8,
(case when grossweight < 30.9 and vehicleclass = 9 then vehiclenumber
End) Empty_9,
(case when grossweight >= 30.9 and vehicleclass = 9 then vehiclenumber
End) Loaded_9,
(case when grossweight < 34.2 and vehicleclass = 10 then vehiclenumber
End) Empty_10,
(case when grossweight >= 34.2 and vehicleclass = 10 then vehiclenumber
End) Loaded_10,
(case when grossweight < 37.5 and vehicleclass = 11 then vehiclenumber
End) Empty_11,
(case when grossweight >= 37.5 and vehicleclass = 11 then vehiclenumber
End) Loaded_11,
(case when grossweight < 41.9 and vehicleclass = 12 then vehiclenumber
End) Empty_12,
(case when grossweight >= 41.9 and vehicleclass = 12 then vehiclenumber
End) Loaded_12,
(case when grossweight < 46.3 and vehicleclass = 13 then vehiclenumber
End) Empty_13,
(case when grossweight >= 46.3 and vehicleclass = 13 then vehiclenumber
End) Loaded_13,
(case when grossweight < 30.9 and vehicleclass = 14 then vehiclenumber
89
End) Empty_14,
(case when grossweight >= 30.9 and vehicleclass = 14 then vehiclenumber
End) Loaded_14
from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and to_date('"
+ end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 5 and 14 )

Lane-wise Truck Distribution
select Laneno, count(Class_4), count(Class_5), count(Class_6) , count(Class_7),
count(Class_8) , count(Class_9), count(Class_10) , count(Class_11),
count(Class_12) , count(Class_13), count(Class_14) from
( select Laneno,
(case when vehicleclass = 4 then vehiclenumber
End) Class_4,
(case when vehicleclass = 5 then vehiclenumber
End) Class_5,
(case when vehicleclass = 6 then vehiclenumber
End) Class_6,
(case when vehicleclass = 7 then vehiclenumber
End) Class_7,
(case when vehicleclass = 8 then vehiclenumber
End) Class_8,
(case when vehicleclass = 9 then vehiclenumber
End) Class_9,
(case when vehicleclass = 10 then vehiclenumber
End) Class_10,
(case when vehicleclass = 11 then vehiclenumber
End) Class_11,
(case when vehicleclass = 12 then vehiclenumber
End) Class_12,
(case when vehicleclass = 13 then vehiclenumber
End) Class_13,
(case when vehicleclass = 14 then vehiclenumber
End) Class_14
from mv_pmk_wiminstance where stationid = " + stationid + "
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS'))group by Laneno")
select count(Class_4), count(Class_5), count(Class_6) , count(Class_7),
90
count(Class_8) , count(Class_9), count(Class_10) , count(Class_11),
count(Class_12) , count(Class_13), count(Class_14) from
( select
(case when vehicleclass = 4 then vehiclenumber
End) Class_4,
(case when vehicleclass = 5 then vehiclenumber
End) Class_5,
(case when vehicleclass = 6 then vehiclenumber
End) Class_6,
(case when vehicleclass = 7 then vehiclenumber
End) Class_7,
(case when vehicleclass = 8 then vehiclenumber
End) Class_8,
(case when vehicleclass = 9 then vehiclenumber
End) Class_9,
(case when vehicleclass = 10 then vehiclenumber
End) Class_10,
(case when vehicleclass = 11 then vehiclenumber
End) Class_11,
(case when vehicleclass = 12 then vehiclenumber
End) Class_12,
(case when vehicleclass = 13 then vehiclenumber
End) Class_13,
(case when vehicleclass = 14 then vehiclenumber
End) Class_14
from mv_pmk_wiminstance where stationid = " + stationid + "
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 4 and 14)")

Speeds by Classification
select vehicleclass,
count(Less_35), count(Less_40), count(Less_45) , count(Less_50),
count(Less_55) , count(Less_60), count(Less_65) , count(Less_70),
count(Less_75), count(Less_80), count(Less_85), count(GT_85)
from ( select vehicleclass, (case
when speed < 35 then vehiclenumber
End) Less_35, (case when speed between 36 and 40 then vehiclenumber
End) Less_40, (case when speed between 41 and 45 then vehiclenumber
91
End) Less_45,(case when speed between 46 and 50 then vehiclenumber
End) Less_50,(case when speed between 51 and 55 then vehiclenumber
End) Less_55,(case when speed between 56 and 60 then vehiclenumber
End) Less_60, (case when speed between 61 and 65 then vehiclenumber
End) Less_65,(case when speed between 66 and 70 then vehiclenumber
End) Less_70, (case when speed between 71 and 75 then vehiclenumber
End) Less_75, (case when speed between 76 and 80 then vehiclenumber
End) Less_80, (case when speed between 81 and 85 then vehiclenumber
End) Less_85,(case when speed > 85 then vehiclenumber
End) GT_85 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and vehicleclass between 2 and 15)
group by vehicleclass")

Speeds by Hour
select Hour,
count(Less_35), count(Less_40), count(Less_45) , count(Less_50),
count(Less_55) , count(Less_60), count(Less_65) , count(Less_70),
count(Less_75), count(Less_80), count(Less_85), count(GT_85)
from ( select hour, (case when speed < 35 then vehiclenumber
End) Less_35, (case when speed between 36 and 40 then vehiclenumber
End) Less_40, (case when speed between 41 and 45 then vehiclenumber
End) Less_45,(case when speed between 46 and 50 then vehiclenumber
End) Less_50,(case when speed between 51 and 55 then vehiclenumber
End) Less_55,(case when speed between 56 and 60 then vehiclenumber
End) Less_60, (case when speed between 61 and 65 then vehiclenumber
End) Less_65,(case when speed between 66 and 70 then vehiclenumber
End) Less_70, (case when speed between 71 and 75 then vehiclenumber
End) Less_75, (case when speed between 76 and 80 then vehiclenumber
End) Less_80, (case when speed between 81 and 85 then vehiclenumber
End) Less_85,(case when speed > 85 then vehiclenumber
End) GT_85 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+"','MM-DD-YY HH24-MI-SS') and Hour between " + intStartHour + "
and " + intEndHour + ") group by Hour")
92

Volume by Hour by Class
select Hour,count(Class_2), count(Class_3), count(Class_4), count(Class_5),
count(Class_6) , count(Class_7), count(Class_8) , count(Class_9),
count(Class_10) , count(Class_11), count(Class_12) , count(Class_13),
count(Class_14), count(Class_15) from
( select Hour,
(case when vehicleclass = 2 then vehiclenumber
End) Class_2,
(case when vehicleclass = 3 then vehiclenumber
End) Class_3,
(case when vehicleclass = 4 then vehiclenumber
End) Class_4,
(case when vehicleclass = 5 then vehiclenumber
End) Class_5,
(case when vehicleclass = 6 then vehiclenumber
End) Class_6,
(case when vehicleclass = 7 then vehiclenumber
End) Class_7,
(case when vehicleclass = 8 then vehiclenumber
End) Class_8,
(case when vehicleclass = 9 then vehiclenumber
End) Class_9,
(case when vehicleclass = 10 then vehiclenumber
End) Class_10,
(case when vehicleclass = 11 then vehiclenumber
End) Class_11,
(case when vehicleclass = 12 then vehiclenumber
End) Class_12,
(case when vehicleclass = 13 then vehiclenumber
End) Class_13,
(case when vehicleclass = 14 then vehiclenumber
End) Class_14,
(case when vehicleclass = 15 then vehiclenumber
End) Class_15 from mv_pmk_wiminstance where (" + strWhereStations + ")
and datetime between to_date('" + start_datetime + "','MM-DD-YY HH24-MI-SS') and
to_date('"+end_datetime+ "','MM-DD-YY HH24-MI-SS') and Hour between "+intStartHour+"
and "+intEndHour+") group by Hour")
93
REFERENCES
[1] Gaurang B Patel, “Database Administration for Truck Data-Warehouse System”,
Master’s Project, California State University, Sacramento, Spring 2008
[2] History of Virtualization. [Online]. Available:
http://www.vmware.com/virtualization/history.html
[3] About Virtualization. [Online]. Available:
http://www.vmware.com/virtualization/what-is-virtualization.html
[4] Concept of Virtual Machine. [Online]. Available:
http://www.vmware.com/virtualization/virtual-machine.html
[5] Copy of VMware ESXi 4.0. [Online]. Available:
https://www.vmware.com/tryvmware/p/activate.php?p=free-esxi&lp=1
[6] Complete Documentation about installation, configuration and usage of ESXi 4.0.
[Online]. Available:
http://www.vmware.com/support/pubs/vs_pages/vsp_pubs_esxi40_u1_i_vc40_u1.ht
ml
[7] Oracle Enterprise Linux Installation Procedure. [Online]. Available:
http://www.oracle-base.com/articles/linux/OracleEnterpriseLinux5Installation.php
[8] Copy of Oracle Application Server 10g Release 2 (10.1.2.0.2). [Online].
Available:
http://www.oracle.com/technology/software/products/ias/htdocs/101202.html
94
[9] Oracle Application Server Installation Guide 10g Release 2 (10.1.2) for Linux
x86. [Online]. Available:
http://downloaduk.oracle.com/docs/cd/B14099_19/linux.1012/install.1012/install/toc.htm
[10] About MySQL. [Online]. Available: http://www.mysql.com/about/
[11] Copy of MySQL Community Server. [Online]. Available:
http://www.mysql.com/downloads/mysql/#downloads
[12] MySQL 5.0 Reference Manual. [Online]. Available:
http://dev.mysql.com/doc/refman/5.0/en/installation-layouts.html
Download