Based Sun Servers to Dell Servers Running Linux, Part 1

Migrating Sun-based
®
Oracle Databases to Dell™
PowerEdge™ Servers
Part 1: Dell PowerEdge 6450 and 8450
with Red Hat Linux Advanced Server 2.1
Enterprise Systems Group (ESG)
Dell White Paper
By Dave Jaffe and Todd Muirhead
dave_jaffe@dell.com
todd_muirhead@dell.com
May 2002
Contents
Executive Summary ...................................................................................................................... 3
Introduction ................................................................................................................................... 4
The Database Servers................................................................................................................... 5
The Hardware ......................................................................................................................... 5
The Database Software................................................................................................................ 7
Oracle9i .................................................................................................................................... 7
The Queries ............................................................................................................................. 8
Migrating the Database ........................................................................................................ 9
The Tests ...................................................................................................................................... 11
Conclusions ................................................................................................................................. 13
Acknowledgements.................................................................................................................... 14
Bibliography ................................................................................................................................ 15
Appendices .................................................................................................................................. 16
Appendix A Baseball Database Organization ................................................................ 16
Database Tables ................................................................................................................... 16
Master .................................................................................................................................................. 16
Teammaster ........................................................................................................................................ 16
Batting ................................................................................................................................................. 17
Pitching ............................................................................................................................................... 17
Fielding ............................................................................................................................................... 18
Appendix B Test Script ....................................................................................................... 19
run8.sh ................................................................................................................................................. 19
Appendix C Sample Queries ............................................................................................. 20
5yr_b1.sql – Best individual stats over 5 sequential years ........................................................... 20
bs.sql – Best individual seasons all time ......................................................................................... 20
yr_best_al.sql – Best offensive players per year in American League ........................................ 21
Table 1: Database Server Comparison: PowerEdge 6450 and 8450 vs. Sun Enterprise
4500 .......................................................................................................................................... 5
Table 2: RAID Organization for Three Configurations ....................................................... 6
Table 3: Oracle Database Layout .............................................................................................. 7
Table 4: Oracle9i Tuning Parameters....................................................................................... 8
Table 5: Oracle Pricing................................................................................................................ 8
Table 6: 4-CPU Test Results: PowerEdge 6450 vs. Sun E4500 w/ 4 CPUs ....................... 11
Table 7: 8-CPU Test Results: PowerEdge 8450 vs. Sun E4500 w/ 8 CPUs ....................... 11
May 2002
Page 2
Dell Enterprise Systems Group
Section
1
Executive Summary
Oracle9i data mining performance was studied using the Dell PowerEdge 6450
with 4 CPUs, the Dell PowerEdge 8450 with 8 CPUs, both running Red Hat®
Linux 2.1 Advanced Server, and the Sun Enterprise 4500, with either 4- or 8CPUs, running Solaris 8.0. A database of baseball statistics was built on the Sun
database server and easily migrated to the Dell servers.
A set of eight intensive queries was developed and run against this database on
all four configurations. The PowerEdge 6450 ran the queries 69% faster than the
comparably equipped Sun E4500, and cost over six times less, giving the Dell
system a price/performance advantage of over 10X. The same queries on the
PowerEdge 8450 ran 55% faster than on the E4500 with 8 CPUs. The PowerEdge
8450 was over four times less expensive than the E4500, giving the PowerEdge
8450 a price/performance advantage of almost 7X.
May 2002
Page 3
Dell Enterprise Systems Group
Section
2
Introduction
In our previous Sun to Dell migration study with Oracle9i on Windows® 2000
Advanced Server (Paper 5 in the Bibliography, Section 8), we built an online
query engine using Oracle Portal on Oracle9i Applications Server to handle
many simultaneous small requests (Top 10 lists for various baseball statistics for
a given year and league). We showed that 4- and 8-CPU Dell PowerEdge servers
running Oracle9i database under Windows 2000 Advanced Server could handle
a large number of simultaneous users more easily than a comparably configured
database server from Sun Microsystems, Inc., the Enterprise 4500.
In this study, to compare pure system performance for data mining on the Sun
system running Solaris 8.0 against Dell servers running Red Hat Linux
Advanced Server 2.1, we designed eight very intensive queries against the same
baseball database. In order to simulate multiple analysts pounding on the
database, we ran the eight queries simultaneously against each database server.
The queries used Oracle analytical features to answer questions such as “who
had the best five straight years in home runs, batting average, earned run
average, etc.”
Oracle was set up nearly identically on the Sun E4500 with either four or eight
450 MHz UltraSPARC II CPUs as well as on a Dell PowerEdge 6450 with four
700 MHz CPUs, and a Dell PowerEdge 8450 with eight 700 MHz CPUs. SCSI disk
arrays were used on all systems. The identical queries were run and timed the
same on all four configurations.
It was found that the 4-CPU Dell PowerEdge 6450 ran the queries 69% faster than
the 4–CPU Sun E4500 while the 8-CPU PowerEdge 8450 ran them 55% faster than
the E4500 with 8 CPUs. Furthermore, as configured, the PE6450 was six times
less expensive than the 4-CPU E4500 and the PE8450 was over four times less
expensive than the 8-CPU E4500. Complete results are shown in Table 6: 4-CPU
Test Results: PowerEdge 6450 vs. Sun E4500 w/ 4 CPUs and Table 7: 8-CPU
Test Results: PowerEdge 8450 vs. Sun E4500 w/ 8 CPUs. Pricing is shown in
Table 5: Oracle Pricing.
May 2002
Page 4
Dell Enterprise Systems Group
Section
3
The Database Servers
The Hardware
The Sun server for both the 4-CPU and 8-CPU configurations was an Enterprise
4500 midrange server running the July 2001 version of Solaris 8.0. In both
configurations the E4500 used 64-bit UltraSPARC-II 450 MHz CPUs. Both the
Dell 4-CPU PowerEdge 6450 and the Dell 8-CPU PowerEdge 8450 ran Red Hat
Linux Advanced Server 2.1 on 700 MHz Intel® Xeon™ processors based on the
Intel 32 bit architecture. See Table 1 for details.
Dell PowerEdge 6450
Dell PowerEdge 8450
Sun Enterprise 4500
Operating System
Red Hat Linux Advanced
Server 2.1
Red Hat Linux Advanced
Server 2.1
Solaris 8.0 7/01
CPU
4x 700 MHz Pentium III
Xeon
8x 700 MHz Pentium III
Xeon
4-CPU: 4 x 450 MHz
8-CPU: 8 x 450 MHz
UltraSPARC-II
CPU L2 Cache
2 MB
2 MB
8MB
Memory
4 GB
8 GB
4-CPU: 4 GB
8-CPU: 8 GB
Internal Disk
4x 18 GB*
2x 36 GB*
2x 36 GB*
External Disk
PowerVault 210S - 10x
18 GB*
PowerVault 210S – 10x
18 GB*
StorEdge D1000 – 8 x 36
GB*
NICs
2x 100 Mb/s (1 internal, 1
PCI card)
2x 100 Mb/s (1 PCI card)
1x 100 Mb/s (I/O card)
RAID Controller
2x PERC/2 Dual Channel
2x PERC/2 Dual Channel
A3500FC RAID Controller
Video
On-board
On-board
Remote console
Height
4 Rack Units (4U) or
7-inches
7 Rack Units (7U) or
12.25-inches
8 Rack Units (8U) or 14inches
Price as configured
$23,827
$52,310
4-CPU: $147,085
8-CPU: $228,885
Source
http://www.dell.com
5/7/02
http://www.dell.com
5/7/02
http://www.sun.com
5/7/02
*For hard drives, GB means 1 billion bytes; total accessible capacity varies depending on operating environment.
Table 1: Database Server Comparison: PowerEdge 6450 and 8450 vs. Sun
Enterprise 4500
May 2002
Page 5
Dell Enterprise Systems Group
The Sun and the Dell database servers were configured with similar external
SCSI storage. The Sun server was attached via fibre channel to a Sun StorEdge
A3500FC controller that drove a single StorEdge D1000 disk pod containing 8
36GB SCSI disks. The Dell PowerEdge 6450 and 8450 were attached to a Dell
PowerVault 210S SCSI disk pod through Dell PowerEdge RAID Controller/2
(PERC/2) PCI cards. Each PV210S was configured with 10 18GB disks. The RAID
configuration on the disks, shown in Table 2, was created to be as similar to each
other as possible, but due to differing numbers of internal disks on each server
there were slight differences in the RAID configurations.
Logical Disk
Dell PowerEdge 6450
Dell PowerEdge 8450
Sun Enterprise 4500
root
RAID 1 – Internal Disks 0,1
RAID 1 – Internal Disks 0,1
Internal Disk 0
0
RAID 1 – Internal Disks 2,3
RAID 1 – 210S Disks 0,1
Internal Disk 0
1
RAID 1 – 210S Disks 0,1
RAID 1 – 210S Disks 2,3
RAID 1 – D1000 Disks 0,1
2
RAID 1 – 210S Disks 2,3
RAID 1 – 210S Disks 4,5
RAID 1 – D1000 Disks 2,3
3
RAID 1/0 – 210S Disks
4,5,6,7,8,9
RAID 1/0 – 210S Disks
6,7,8,9
RAID 1/0 – D1000 Disks
4,5,6,7
Table 2: RAID Organization for Three Configurations
May 2002
Page 6
Dell Enterprise Systems Group
Section
4
The Database Software
Oracle9i
Oracle9i Database was installed using the Oracle Universal Installer on both Red
Hat Linux Advanced Server 2.1 and Solaris 8. The same options were selected on
both. Oracle9i installation was completed without creating an initial database.
The Oracle Database Creation Assistant (DBCA) was then used to create a new
database instance using similar settings on the two platforms. The control files,
log files, and data files were placed on different partitions of the external storage
and the shared server option was used (see Table 3). We also applied the
appropriate patch set on each platform to take 9i to the 9.0.1.1.2 level.
Logical
Disk
Oracle
Use
Linux
Solaris
Partition
Size (GB)
Partition
Size (GB)
0
Oracle
Binaries
/u01
16.60
/u01
6.33
1
Control files,
Logs, Misc.
/u02
16.60
/u02
33.36
2
Undo
tablespace
/u03
16.60
/u03
33.36
3
Users
tablespace,
/u04
49.82 (6450)
/u04
66.71
33.21 (8450)
Indexes
Table 3: Oracle Database Layout
The database initialization parameters are listed in Table 4. For the most part the
Sun E4500 and the PowerEdge 8450 were set up the same way to facilitate 8-CPU
comparison, and the PowerEdge 6450 database was scaled down from this. The
number of DB_writer_processes was set equal to the number of processors.
May 2002
Page 7
Dell Enterprise Systems Group
Parameter
Dell
PowerEdge
Dell
PowerEdge
Sun
Enterprise
4500
6450
8450
DB_BLOCK_SIZE
8192
8192
8192
DB_CACHE_SIZE
134217728
134217728
117440512
DB_WRITER_PROCESSES
4
8
8
DISPATCHERS
16
16
16
LARGE_POOL_SIZE
209715200
400000000
400000000
MAX_DISPATCHERS
40
40
40
MAX_SHARED_SERVERS
80
160
160
OPEN_CURSORS
400
400
400
PROCESSES
200
200
200
SESSIONS
225
300
300
SHARED_POOL_SIZE
234881024
419430400
400000000
SHARED_SERVER_SESSIONS
210
285
285
SHARED_SERVERS
80
40
80
SORT_AREA_SIZE
67108864
67108864
64000000
Table 4: Oracle9i Tuning Parameters
Oracle pricing is per CPU and is the same on all platforms. Some sample list
pricing from Oracle’s web site is provided in Table 5.
4 CPUs
8 CPUs
Oracle9i Database Server
Enterprise Edition
$136,000
$256,000
Source
http://oraclestore.oracle.com 5/7/02
Table 5: Oracle Pricing
The Queries
A database of baseball statistics, Baseball Archive Database 4.0, was obtained
from Sean Lahman at http://www.baseball1.com/statistics in Microsoft Access
form, exported as comma-separated values, and then loaded into Oracle tables
with the sqlldr command. The database contains batting, pitching and fielding
data for 15,558 players going back to 1886 (See Appendix A, Baseball Database
Organization).
May 2002
Page 8
Dell Enterprise Systems Group
A set of eight data mining queries was written using Oracle’s SQL for Analysis
functions. The queries are representative of fairly CPU-intensive queries (each
takes at least 20 seconds on an otherwise unloaded PowerEdge 6450) that
baseball analysts would typically make.
The queries are of three types. The first type determines sustained performance
over five consecutive years (see 5yr_b1.sql – Best individual stats over 5
sequential years in Appendix C). The sum(column) function is used over the
batting table partitioned by the unique player identification and ordered by year,
with a five year moving window, to generate totals for each of several statistics
(home runs, batting average, earned run average) for each player for each year
plus the four previous years. These results are then ordered and the top 10 best
five years in each category are printed.
The second type of query calculates which player had the best overall seasons
based on a mixture of batting or pitching statistics (see bs.sql – Best individual
seasons all time). The Oracle analytical function rank() is used to generate a new
database view in which the all-time rank of several statistics are included for
each player for each year. The ranks are then summed and ordered by lowest
first, thus generating lists of best seasons all time. For overall offensive
performance, for example, the home runs, runs batted in, hits, runs scored and
batting average are all factored in so the leader in this category would have the
lowest sum of the all-time rank for these five statistics for that season.
The third query (see yr_best_al.sql – Best offensive players per year in
American League) uses Oracle’s Procedure Language/Structured Query
Language (PL/SQL) to loop through the years 1901 – 2000 to generate Top 10 lists
of overall offensive prowess for each year using the rank() function. The players
are listed in order of lowest total rank in home runs, runs batted in and batting
average – the so-called “Triple Crown.”
The eight queries used in the test are all variations of these three queries. The full
set of queries is available from the authors.
Migrating the Database
Migrating the baseball statistics database from the Sun database server to the two
Dell servers was easily accomplished using Oracle’s export and import
commands. On the source database (the Sun system in this case), a database
dump file is created through the following command:
% exp baseball/password parfile=exp.params
where user baseball is the owner of the baseball database and the export
parameter file exp.params contains
TABLES=(MASTER, TEAMMASTER, BATTING, PITCHING, FIELDING)
May 2002
Page 9
Dell Enterprise Systems Group
FILE=baseball.dmp
The baseball.dmp file was copied to the two Dell systems and then the import
command was run:
% imp baseball/password parfile=imp.params
where the import parameter file imp.params contains:
FILE=baseball.dmp
IGNORE=Y
FULL=Y
The import/export process can also be done through Oracle Enterprise Manager,
Oracle’s graphical management tool.
May 2002
Page 10
Dell Enterprise Systems Group
Section
5
The Tests
The workload consisted of simultaneously running the eight queries and
measuring the elapsed time with the Oracle timing function. Simultaneous
execution was achieved by starting each query in background mode in a simple
shell script using the SQLPLUS command (see run8.sh in Appendix B). The
scripts were run directly on the database servers. Three runs were performed on
each system, with the results averaged.
Four- and eight-CPU test results are shown in Table 6 and Table 7, respectively.
System
Average
Query Time
(sec)
Performance:
Dell
Advantage
Price as
Configured
(see Table 1)
Price:
Dell
Advantage
Price/|
Performance:
Dell
Advantage
Sun Enterprise 4500
w/ 4 CPUs
66.85
1
$147,085
1
1
Dell PowerEdge
6450 w/ 4 CPUs
39.58
1.69X
$23,827
6.17X
10.43X
Table 6: 4-CPU Test Results: PowerEdge 6450 vs. Sun E4500 w/ 4 CPUs
In the 4-CPU comparison, the Dell PowerEdge 6450 completed the eight queries
in an average time of 39.58 seconds, 69% faster than the Sun E4500’s 66.85
seconds. The Dell system tested was 6.17 times less expensive than the Sun,
giving Dell an overall price/performance advantage of 10.43X.
System
Average
Query Time
(sec)
Performance:
Dell
Advantage
Price as
Configured
(see Table 1)
Price:
Dell
Advantage
Price/
Performance:
Dell
Advantage
Sun Enterprise 4500
w/ 8 CPUs
35.54
1
$228,885
1
1
Dell PowerEdge
8450 w/ 8 CPUs
22.92
1.55X
$52,310
4.38X
6.79X
Table 7: 8-CPU Test Results: PowerEdge 8450 vs. Sun E4500 w/ 8 CPUs
May 2002
Page 11
Dell Enterprise Systems Group
The 8-CPU comparison between the Dell PowerEdge 8450 and the Sun E4500 is
similar: the eight queries take an average of 22.92 seconds on the Dell system,
55% faster than the 35.54 seconds on the 8-way Sun. With a price 4.38 times less
than that of the comparably equipped Sun E4500, the PowerEdge 8450 has a
6.79X price/performance advantage.
May 2002
Page 12
Dell Enterprise Systems Group
Section
6
Conclusions
Large databases built on state-of-the-art database management systems like
Oracle9i are vital to modern enterprises. The ability to quickly retrieve
information useful to a corporation/organization from these databases is
paramount.
In this test, a database of baseball statistics was deployed on a Sun/Solaris
database server, the Enterprise 4500, with either 4 or 8 CPUs, and migrated to
two Dell PowerEdge servers running Red Hat Linux Advanced Server 2.1: the 4CPU PowerEdge 6450 and the 8-CPU PowerEdge 8450. The industry standard
Dell servers, running the open-source Linux operating system, are as much as six
times less expensive than the comparably equipped proprietary Sun server. Yet
the Dell servers outperformed their competitor by as much as 69%, resulting in
over ten times the performance per dollar in the case of the 4-CPU systems and
almost seven times for the 8-CPU systems.
For those who are fans of sustained performance and baseball, Mark McGwire
had the best five year stretch with the long ball, averaging 56.8 home runs per
year from 1995 to 1999, Austinite Rogers Hornsby batted .402 between 1921 and
1925, Lou Gehrig averaged almost 163 runs batted in per year from 1930 to 1934,
and Sandy Koufax had an earned run average of 1.949 from 1962 to 1966, leading
all pitchers after 1920.
THIS WHITE PAPER IS FOR INFORMATIONAL PURPOSES ONLY, AND MAY CONTAIN TYPOGRAPHICAL
ERRORS AND TECHNICAL INACCURACIES. THE CONTENT IS PROVIDED AS IS, WITHOUT EXPRESS OR
IMPLIED WARRANTIES OF ANY KIND.
Dell, PowerEdge, and PowerVault are trademarks of Dell Computer Corporation. Oracle is a registered trademark and
Oracle9i is a trademark of Oracle Corporation. Microsoft and Windows are registered trademarks of Microsoft
Corporation.
Other trademarks and trade names may be used in this document to refer to either the entities claiming the marks and
names or their products. Dell disclaims proprietary interest in the marks and names of others.
©Copyright 2002 Dell Computer Corporation. All rights reserved. Reproduction in any manner whatsoever without the
express written permission of Dell Computer Corporation is strictly forbidden. For more information, contact Dell.
Information in this document is subject to change without notice.
May 2002
Page 13
Dell Enterprise Systems Group
Section
7
Acknowledgements
The authors would like to thank Sean Lahman for use of his baseball data.
May 2002
Page 14
Dell Enterprise Systems Group
Section
8
Bibliography
1) Migrating Sun-Based ISPs to Dell Web Server Appliances. Part 1: Dell PowerApp.web
100 With RedHat Linux
 Power Solutions:
http://www.dell.com/us/en/biz/topics/power_ps4q00-jaffe.htm
 Tech Report (approved for external distribution):
http://inside.us.dell.com/products/systems/appliances/pappfamilywp_toc.htm
2) Migrating Sun-Based ISPs to Dell Web Server Appliances. Part 2: Dell PowerApp.web
120 Microsoft Windows Powered
 Power Solutions:
http://www.dell.com/us/en/biz/topics/power_ps1q01-jaffe.htm
 Tech Report (approved for external distribution):
http://inside.us.dell.com/products/systems/appliances/pappfamilywp_toc.htm
3) Migrating Sun-Based BEA WebLogic Application Servers to Dell PowerEdge Servers.
Part 1: Dell PowerEdge 1550 with Microsoft Windows 2000 Server
 Power Solutions:
http://www.dell.com/us/en/esg/topics/power_ps2q01-jaffe.htm
 Tech Report:
http://www.dell.com/us/en/esg/topics/products_bea_papers_pedge_software_be
a_papers.htm
4) Migrating Sun-Based BEA WebLogic Application Servers to Dell PowerEdge Servers.
Part 2: Dell PowerEdge 1550 with Red Hat Linux
 Power Solutions:
http://www.dell.com/us/en/esg/topics/power_ps3q01-jaffe.htm
 Tech Report:
http://www.dell.com/us/en/esg/topics/products_bea_papers_pedge_software_be
a_papers.htm
5) Migrating Sun-Based Oracle Databases to Dell PowerEdge Servers.
Part 1: Dell PowerEdge 6450 and 8450 with Microsoft Windows 2000 Advanced Server
 Power Solutions:
http://www.dell.com/us/en/esg/topics/power_ps2q02-jaffe.htm
 Tech Report:
http://www.dell.com/us/en/esg/topics/products_oracle_papers_pedge_software_
oracle_papers.htm
May 2002
Page 15
Dell Enterprise Systems Group
Appendices
Appendices
Appendix A Baseball Database Organization
Database Tables
Master
15538 Rows
Name
Datatype
Size
Scale
Nulls?
LAHMANID
VARCHAR2
10
0
No
LASTNAME
VARCHAR2
25
0
Yes
FIRSTNAME
VARCHAR2
25
0
Yes
BATS
VARCHAR2
1
0
Yes
THROWS
VARCHAR2
1
0
Yes
BIRTHMONTH
NUMBER
2
0
Yes
BIRTHDAY
NUMBER
2
0
Yes
BIRTHYEAR
NUMBER
4
0
Yes
DEBUT
NUMBER
4
0
Yes
Teammaster
149 Rows
Name
Datatype
Size
Scale
Nulls?
TEAM
VARCHAR2
4
0
No
LEAGUE
VARCHAR2
3
0
Yes
START_YEAR
NUMBER
4
0
Yes
END_YEAR
NUMBER
4
0
Yes
CITY
VARCHAR2
15
0
Yes
NICKNAME
VARCHAR2
20
0
Yes
May 2002
Page 16
Dell Enterprise Systems Group
Batting
80435 Rows
Name
Datatype
Size
Scale
Nulls?
LAHMANID
VARCHAR2
10
0
No
YEAR
NUMBER
4
0
No
TEAM
VARCHAR2
4
0
No
LG
VARCHAR2
3
0
Yes
G
NUMBER
3
0
Yes
AB
NUMBER
4
0
Yes
R
NUMBER
4
0
Yes
H
NUMBER
4
0
Yes
2B
NUMBER
4
0
Yes
3B
NUMBER
4
0
Yes
HR
NUMBER
4
0
Yes
RBI
NUMBER
4
0
Yes
SH
NUMBER
4
0
Yes
SF
NUMBER
4
0
Yes
SB
NUMBER
4
0
Yes
CS
NUMBER
4
0
Yes
BB
NUMBER
4
0
Yes
IBB
NUMBER
4
0
Yes
HBP
NUMBER
4
0
Yes
SO
NUMBER
4
0
Yes
POS
VARCHAR2
25
0
Yes
BA
NUMBER
5
3
Yes
DOUBLES
NUMBER
4
0
Yes
TRIPLES
NUMBER
4
0
Yes
Pitching
33574 Rows
Name
Datatype
Size
Scale
Nulls?
LAHMANID
VARCHAR2
10
0
No
YEAR
NUMBER
4
0
No
TEAM
VARCHAR2
4
0
No
LG
VARCHAR2
3
0
Yes
May 2002
Page 17
Dell Enterprise Systems Group
W
NUMBER
4
0
Yes
L
NUMBER
4
0
Yes
G
NUMBER
4
0
Yes
GS
NUMBER
4
0
Yes
CG
NUMBER
4
0
Yes
SH
NUMBER
4
0
Yes
SV
NUMBER
4
0
Yes
IP
NUMBER
7
3
Yes
H
NUMBER
4
0
Yes
ER
NUMBER
4
0
Yes
HR
NUMBER
4
0
Yes
BB
NUMBER
4
0
Yes
SO
NUMBER
4
0
Yes
ERA
NUMBER
7
3
Yes
Fielding
113571 Rows
Datatype Name Size
Scale
Nulls?
LAHMANID
VARCHAR2
10
0
No
YEAR
NUMBER
4
0
No
TEAM
VARCHAR2
4
0
No
LG
VARCHAR2
3
0
Yes
POS
VARCHAR2
3
0
Yes
G
NUMBER
4
0
Yes
PO
NUMBER
4
0
Yes
A
NUMBER
4
0
Yes
E
NUMBER
4
0
Yes
DP
NUMBER
4
0
Yes
May 2002
Page 18
Dell Enterprise Systems Group
Appendix B Test Script
run8.sh
sqlplus
sqlplus
sqlplus
sqlplus
sqlplus
sqlplus
sqlplus
sqlplus
May 2002
baseball/baseball
baseball/baseball
baseball/baseball
baseball/baseball
baseball/baseball
baseball/baseball
baseball/baseball
baseball/baseball
@5yr_b1
@5yr_b2
@5yr_r
@5yr_p
@5yr_f
@bs
@yr_best_al
@yr_best_nl
>
>
>
>
>
>
>
>
Page 19
5yr_b1.out &
5yr_b2.out &
5yr_r.out &
5yr_p.out &
5yr_f.out &
bs.out &
yba.out &
ybn.out &
Dell Enterprise Systems Group
Appendix C Sample Queries
5yr_b1.sql – Best individual stats over 5 sequential years
ttitle skip 1 left
"*** Best 5 Straight Years Home Run Production All Time ***" skip 2;
select ROWNUM "Rank", FIRSTNAME||' '||LASTNAME "Player", AVG_HR "Avg HR",
YEAR-4||' - '||YEAR "Years"
from
(
select FIRSTNAME, LASTNAME, YEAR,
.2*SUM(HR) over (partition by B.LAHMANID order by YEAR range 4 preceding) as AVG_HR
from MASTER M, BATTING B
where M.LAHMANID=B.LAHMANID
order by AVG_HR desc
)
where rownum < 11;
(repeat for H, RBI, RUNs, etc.)
bs.sql – Best individual seasons all time
create or replace view br as select B.LAHMANID, FIRSTNAME, LASTNAME, YEAR, HR, RBI, BA,
R, H,
rank() over (order by HR desc) as HR_RANK,
rank() over (order by RBI desc) as RBI_RANK,
rank() over (order by BA desc) as BA_RANK,
rank() over (order by R desc) as R_RANK,
rank() over (order by H desc) as H_RANK
from MASTER M, BATTING B
where M.LAHMANID=B.LAHMANID
and AB > 400;
ttitle skip 1 left "*** Best Batting Seasons (HR, RBI, BA, RUNS, HITS) - Alltime ***"
skip 2;
select ROWNUM "Rank", FIRSTNAME||' '||LASTNAME "Player", YEAR "Year", HR "HR", HR_RANK
"HR Rank", RBI "RBI", RBI_RANK "RBI Rank", BA "BA", BA_RANK "BA Rank", R "Runs", R_RANK
"Run Rank", H "Hits", H_RANK "Hits Rank"
from
(
select * from br order by HR_RANK + RBI_RANK + BA_RANK + R_RANK + H_RANK
)
where rownum < 11;
(repeat for other offensive and defensive combinations)
May 2002
Page 20
Dell Enterprise Systems Group
yr_best_al.sql – Best offensive players per year in American League
DECLARE
input_year integer;
res_firstname VARCHAR2(25);
res_lastname VARCHAR2(25);
res_hr integer;
res_hr_rank integer;
res_rbi integer;
res_rbi_rank integer;
res_ba real;
res_ba_rank integer;
CURSOR c1 IS select FIRSTNAME, LASTNAME, HR, HR_RANK, RBI, RBI_RANK, BA, BA_RANK from
yrba order by HR_RANK + RBI_RANK + BA_RANK;
BEGIN
dbms_output.enable(200000);
dbms_output.put_line('Top 10 Batters Per Year Based on Rank of HR, RBI, BA');
for input_year in 1901..2000 loop
dbms_output.put_line('Year
BA_RANK ');
Rank
Name
HR
HR_RANK
RBI
RBI_RANK
BA
execute immediate 'create or replace view yrba as select B.LAHMANID, FIRSTNAME,
LASTNAME, YEAR, LG, HR, RBI, BA,
rank() over (order by HR desc) as HR_RANK,
rank() over (order by RBI desc) as RBI_RANK,
rank() over (order by BA desc) as BA_RANK
from MASTER M, BATTING B
where M.LAHMANID=B.LAHMANID
and YEAR = '|| input_year ||'
and LG = ''AL''
and AB > 400';
open c1;
for i in 1..10 loop
fetch c1 into res_firstname, res_lastname, res_hr, res_hr_rank, res_rbi, res_rbi_rank,
res_ba, res_ba_rank;
dbms_output.put_line(input_year||' '||i||' '||res_firstname||' '||res_lastname||'
'||res_hr||' '||res_hr_rank||' '||res_rbi||' '||res_rbi_rank||' '||res_ba||'
'||res_ba_rank);
end loop;
close c1;
end loop;
execute immediate 'drop view yrba';
END;
May 2002
Page 21
Dell Enterprise Systems Group