Professional Documents
Culture Documents
(SQL Plus)
19 Feb, 2004
What are the similarity and differences between SQL Server 2000 and Oracle 8i (SQL Plus)
Which is the Best with vb 6.0
Hi sunil,
1. Oracle runs on many platforms, SQL on Windows only 2. Oracle includes IFS (Internet File System),
Java integration, SQL is more of a pure database 3. Oracle requires client install and setup (Not difficult,
but very UNIX-like for Windows users) 4. SQL is #1 in Cost/Performance and overall Performance,
although Oracle will refute that 5. Replication is much easier in SQL (I have been at clients where even
the Oracle consultant couldn't get it working w/oracle) 6. Failover support in SQL is much, much easier
7. JDBC support is much better in Oracle, although Microsoft is working on it 8. ODBC support in both 9.
SQL is ANSI-SQL '92 compliant, making it easier to convert to another ANSI compliant database,
theoretically anyway (truth is every database has proprietary extensions). Oracle is generally more
proprietary and their main goal is to keep their customers locked-in. 10. SQL natively supports ODBC,
OLEDB, XML, XML Query, XML updates. Oracle natively supports proprietary connections, JDBC. Not
sure about XML support though. 11. SQL Server is much easier to administrate, with GUI and
command- line tools. Most of Oracle is command-line (Back in SQL 6.5 days I had a customer who was
so proud that after a day's worth of work he had managed to script his database. I showed him how it
was a 3 click operation in SQL ;-) 12. Oracle requires add-ons for transaction monitors, failover, etc.
SQL has COM+, uses NT clustering and generally has everything built-in 13. SQL Analysis Services is
included (A very powerful OLAP server). For Oracle it is a separate purchase.
Platform dependancy SQL Server is only operable on the Windows platform, a major limitation for it to
be an enterprise solution. Oracle is available on multiple platforms such as Windows, all flavors of Unix
from vendors such as IBM, Sun, Digital, HP, Sequent, etc. and VAX-VMS, as well as MVS. The multi-
platform nature of Oracle makes it a true enterprise solution. Locking and concurrency SQL Server has
no multi-version consistency model, which means that "writers block readers and readers block writers"
to ensure data integrity. In contrast, with Oracle, the rule is "readers don't block writers and writers don't
block readers." This is possible without compromising data integrity because Oracle will dynamically re-
create a read-consistent image for a reader of any requested data that has been changed but not yet
committed. In other words, the reader will see the data as it was before the writer began changing it
(until the writer commits). SQL Server's locking scheme is much simpler (less mature) and will result in a
lot of delays/waits in a heavy OLTP environment. Also, SQL Server will escalate row locks to page level
locks when too many rows on a page are locked. This locks rows which are uninvolved in any updates
for no good reason. Performance and tuning a. In SQL Server, the DBA has no "real" control over
sorting and cache memory allocation. The memory allocation is decided only globally in the server
properties memory folder, and that applies for ALL memory and not CACHING, SORTING, etc. b. All
pages (blocks) are always 8k and all extents are always 8 pages (64k). This means you have no way to
specify larger extents to ensure contiguous space for large objects. c. No range partioning of large
tables and indexes. In Oracle, a large 100 GB table can be seamlessly partitioned at the database level
into range partitions. For example, an invoice table can be partitioned into monthly partitions. Such
partitioned tables and partitioned indexes give performance and maintenance benefits and are
transparent to the application. d. There is no partitioning in SQL Server. e. There are no bitmap indexes
in SQL Server. f. There are no reverse key indexes in SQL Server. g. There are no function-based
indexes in SQL Server. h. There is no star query optimization in SQL Server. Object types Here are
some object types missing in SQL Server that exist in Oracle. a. You cannot declare public or private
synonyms. b. There is no such thing as independent sequence objects. c. There are no packages; i.e.,
collections of procedures and functions. d. No "before" event triggers (only "after" event triggers) and no
row triggers (only statement). e. No object types like in PL/SQL. PL/SQL versus T-SQL a. In T-SQL there
are significant extensions to the ANSI SQL-92 standard which means converting applications to a
different database later will be a code challenge re-write. The INNER JOIN, LEFT OUTER, RIGHT
OUTER JOIN syntax differs from the classic JOIN. b. No Java database engine as in Oracle. c. Stored
procedures in SQL Server are not compiled until executed (which means overhead, late binding and
finding errors at execution time only!). d. No ability to read/write from external files from a stored
procedure. e. PL/SQL has many DBMS system packages, where T-SQL relies only on a limited number
of extended and system stored procedures in the master database. f. PL/SQL is better in error exception
handling, and there is no such thing as exceptions in T-SQL (T-SQL uses @@error -- not elegant!). g. T-
SQL does not have the MINUS operator, that makes finding schema differences more difficult in SQL
Server. h. In SQL Server there is no "dead connection detection". Clients who lose their connection may
still hold locks until a DBA is notified to kill their server side processes. i. In SQL Server there is no such
thing as SQL*NET aliases/service names! This means applications have to hard code the actual server
name into their apps, making it difficult to move databases later to load balance across servers.
Clustering technology In clustering technology, Oracle is light years ahead, since SQL Server has
nothing like Oracle Parallel Server/RAC -- two instances acting on the same data in active-active
configurations. And with the new version of Parallel Server in Oracle 9i, renamed as the Oracle Real
Application Clusters, there is diskless contention handling of read-read, read-write, write-read, and
write-write contention between the instances. This diskless contention handling is called Cache Fusion,
and it means for the first time, any application can be placed in a cluster without any changes, and it
scales upwards by just adding another machine to the cluster. Microsoft has nothing like this. Reliability
a. In SQL Server Standard Edition there is no ability to mirror the transaction log files. In Enterprise
Edition there is a log shipping process that is not so reliable. b. If the logs fill up the disk, the database
will crash hard. c. Sometimes this requires the server itself to be rebooted. Summary SQL Server is
clearly positioned between Microsoft Access and Oracle in terms of functionality, performance and
scalability. It is a good workgroup-level solution, a very quick time to market solution, and is very simple
to use and administer. Oracle is much more advanced and has more to offer for larger applications with
both OLTP and data warehouse applications. Its new clustering features are ideal for Application Service
Providers (ASPs) on the Internet, who can now start with a cluster of two small servers and grow by just
adding a server when they need to.
It is always better to use SQL Server for Microsoft Technologies like VB6.0
Regards,
Sashi.
SQL Server is usually easier to setup/configure, and get going - especially in terms of
integrating into other Microsoft applications.
Security is high in Oracle. And it will work fine in any environments like UNIX,
SOLARIES OR WINDOWS-NT. Where as SQL SERVER performs more on
WINDOWS-NT only. There are certain futures which one will miss, if he uses SQL
SERVER without Windiws-NT server.
What always amazes me is how many Oracle folks say SQL Server does not have this
and that and our Oracle does all of this. Most of this is bullshit. The true is that many
things can be accomplished differently in different databases and environments and it
does not make sense to compare apples and oranges. Just to give you some ideas,
when they say SQL server does not read/write files they forget to say that SQL Server
does support extended stored procedures, using these procedures you can do file/write
and virtually anything else that you can do in Windows and beyond. When they say
SQL Server does not support Java, they forget to say that virtually nobody running
SQL Servers wants to have slow and ugly Java (defeating the relational database
concept) in their database and so on. This comparison is endless and has no real sense.
Do not compare apples and oranges just because all of them are called fruits.
I favour SQL Server for small quick business solutions on a budget, and Oracle for
large scalable big budget solutions
A few "corrections" from a long-time SQL Server user... - Bitmap indexing is rarely
ever missed in SQL server, due to other indexing/optimizing techniques - Stored
procedure plans are indeed retained in a compiled state, it is blatantly false to say that
they are recompiled every time - Statistics are much easier to manage in SQL, but you
can get far more fine-grained control in Oracle - Generally speaking, SQL query
optimizer is far far more reliable in SQL; query hints are used rarely, if ever. That
said, every database will have at least some optimizer glitches, and it is up to the
database developer to discover and fix them (usually with hints) - Generally testing
performance is easy in SQL, with easily accessible query plans and statistics. These
can be obtained from Oracle but are much more challenging. Same for profile/trace of
database activity. - Very generally speaking, SQL uses far less memory and performs
noticably better out of the box than Oracle. But because of Oracle's fine-tuning
capabilities, a *skilled* DBA can get better performance out of Oracle. - SQL can
indeed do range partitioning, but it must be done manually (where I think for example
DB2 can do it automatically by hash) - see "partitioned views"
Helpful wins for Oracle: - runs on *nix (for many, this ends the debate immediately) -
exception handling in pl/sql dialect - functon based indexes are occasionally very
useful - but hard to rely upon (must write queries to exactly match the function usage)
- can be heavily tuned for specific use cases; you rarely hit a dead-end optimizing
oracle (if you have a very very skilled dba) - readers never block - standalone
sequences are sometimes more useful than SQL IDENTITY - oracle supports more
efficient constructs for fetching resultant data values during insert/update operations,
and for advanced bulk operations
Helpful wins for SQL: - runs great out of the box - free excellent management,
profiling, monitoring tools - excellent query optimizer - rarely needs any tuning at all
(but when you do, the options are few; wysiwyg) - included top-notch OLAP tool and
full-text search; competitive with much more expensive solutions - much less memory
and compute intensive (probably due to cheaper concurrency model and lighter
configuration options!) - SQL also caches query plans of recent statements in an LRU
cache - frequently used statements do not need recompiles, even without procedures
Big difference: very different concurrency model between SQL and Oracle. Oracle
operates against point-in-time(log) snapshots of the data (using SCNs), but acquires
those on demand. Therefore readers never block. In SQL, you have more choices of
isolation/concurrency, but the more aggressive settings will have writers block
readers, and the most aggressive can have readers block writers. In classic RDBMS
this is not too bad - but in complex deep relations such as OORDBMS-over-RDBMS
or other object-graph storage solutions, deadlocks can really hurt your project unless
you can scale some queries back to Read Committed isolation level.
The article was written by Faulkner, Kent - USA and updated by Havewala, Porus -
Australia.
SQL Server is only operable on the Windows platform, and this is a major limitation
for it to be an enterprise solution. Oracle is available on multiple platforms such as
Windows, all flavors of Unix from vendors such as IBM, Sun, Digital, HP, Sequent,
etc. and VAX- VMS as well as MVS. The multi-platform nature of Oracle makes it a
true enterprise solution.
2. LOCKING / CONCURRENCY
SQL Server has no multi-version consistency model which means that "writers block
readers and readers block writers" to ensure data integrity. In contrast, with Oracle the
rule is "readers don?t block writers and writers don?t block readers". This is possible
without compromising data integrity because Oracle will dynamically re-create a
read-consistent image for a reader of any requested data that has been changed but not
yet committed.
In other words, the reader will see the data as it was before the writer began changing
it (until the writer commits). SQL Server's locking scheme is much simpler (less
mature) and will result in a lot ff delays/waits in a heavy OLTP environment.
Also, SQL Server will escalate row locks to page level locks when too many rows on
a page are locked. This locks rows which are uninvolved in any updates for no good
reason.
In SQL Server 2000, a long uncommitted transaction can stop other transactions
which queue behind it in the single transaction log, and this can stop all activity on the
database, whereas in Oracle, if there is a long uncommitted transaction, only the
transaction itself will stop when it runs out of rollback space, because of the use of
different rollback segments for transactions.
Oracle allocates transactions randomly to any of its multiple rollback segments and
areas inside that rollback segment. When the transaction is committed, that space is
released for other transactions, however Sql server allocates transactions sequentially
to its single transaction log, the space occupied by committed transactions is not
released to new transactions until the recycling of the transaction log is complete (in a
circular round-robin manner).
This means if there is an uncommitted transaction in the middle, and the transaction
log cannot grow by increasing the file size, no new transactions will be allowed. This
is the potential of a single uncommitted transaction to halt database activity.
a. No control of sorting (memory allocation) in SQL Server. Oracle can fully control
the sort area size and allows it to be set by the DBA.
d. No range partioning of large tables and indexes in SQL Server, whereas in Oracle a
large table (eg. 100 GB or more) can be seamlessly partitioned at the database level
into range partitions, for eg. an invoice table can be partitioned into monthly
partitions.
Such partitioned tables and partitioned indexes give performance and maintenance
benefits and are transparent to the application.
e. No Log miner facility in SQL Server. Oracle 8i and 9i supply a Log Miner which
enables inspection of archived redo logs. This comes free with the database. But in the
case of SQL Server, external products from other companies have to be purchased to
do this important DBA task.
f. A SQL Server DBA claimed that fully qualifying the name of an object in SQL
Server code would lead to performance gains of 7% to 10%. There are no dictionary
performance problems like that in Oracle. Oracle would have some gains if it fully
qualified all names - say 0.01 percent.
This actually shows the difference in the internal database technology between Oracle
and Microsoft and implies that the technology of resolving object names via the
dictionary is more advanced in the case of Oracle, ie. Oracle seems to better access its
internal dictionary and resolve names, unlike SQL server.
6. PROGRAMMING
a. Significant extensions to the ANSI SQL-92 standard in SQL Server, which means
converting applications to a different database later will be a challenge (code re-
write).
b. Sql Server has no inbuilt JAVA database engine as in Oracle. In Oracle, Java classes
can be loaded and executed in the database itself, thus adding the database's security
and scalability to Java applications.
c. In SQL Server, stored Procedures are not compiled until executed (overhead). In
Oracle, packages and procs/functions are compiled before execution.
In Oracle 9i it is also possible to translate Pl/Sql into C code and then compile/link the
code, which gives very good performance gains for numeric intensive operations.
SQL Server has no such ability.
d. In SQL server, there is no ability to read/write from external files from a stored
procedure. Oracle has this ability.
On the other hand, Oracle uses standard English-like SQL commands to do the same:
This one statement does all, in simple English, what the cryptic SQL Server command
does.
f. Oracle SQL and PL/SQL syntax is more powerful and can do things more
intuitively than Microsoft Transact-SQL. Try to sum up a column by each month, and
show the totals for the month, in SQL Server you do it in T-SQL by grouping on
strings, in Oracle it is possible to do this grouping by the trunc(,'month') function.
This method in Oracle is more intuitive, it understands the dates, the method in SQL
Server does not.
g. In SQL Server, you cannot issue a "create or replace" for either procedures or
views, in Oracle you can. This one facility simplifies code writing, since in Sql Server
the procedure or view must be dropped first if present and then recreated ie. two
commands, in Oracle there is no need - a single command "create or replace" is
enough.
i. A recompile reuses the code that is in the Oracle database, the actual command is
"alter procedure compile". This is applicable to procedures/functions/packages/views.
This concept of recompiling is not there in SQL Server where you have to resubmit
the whole code if you want to recompile a procedure.
Triggers in SQL Server also can start transactions of their own which is not very good
and shows lack of maturity of the language.
7. STANDBY DIFFERENCES
SQL Server and Oracle have differences regarding standby databases. A standby is a
database set up on a second server and to which logs are applied ie. all database
changes, so that the standby can be activated and used in the case of a failover.
a. In the case of Sql server, when there is a failover, the "master" and "msdb"
databases have to be restored from backup or copied over from the primary to the
standby and then the standby is activated after all logs are applied. In Oracle, there is
no need for a restore to be done, the standby can be activated at any time after all logs
are applied.
This difference exists because of the fact that in SQL server, new users/roles added to
the primary are not carried over to the standby (these users/roles go in the
master/msdb) and backups have to be done continuously of the master and msdb,
these backups are then restored when the time comes for a failover.
In the case of Oracle, users/roles when created in the primary are automatically
carried over to the standby. So when the failover time arrives, all that is needed is to
activate the standby.
b. In the case of Sql Server, if the standby is opened as read only, to switch it back to
standby again, a restore from backup has to be done. In the case of Oracle, from 8i
version onwards, if a standby database is opened as read only, it can be reopened as a
standby without restoring from backup.
c. The time delay to apply logs between the primary and the standby can be varied,
but it can never be 0 minutes in the case of SQL Server.
d. SQL Server's log shipping mechanism also happens at the OS level, whereas
Oracle's mechanism can take place directly at the Net8 level where logs are
automatically applied to standbys without any scripts or OS batch files, this
mechanism in Oracle is called managed standby.
e.One deficiency of Oracle in the standby was that datafiles, if created on the primary,
had to be manually created on the standby whereas SQL Server does this
automatically. However, in 9i, this deficiency is fixed and data files are created
automatically at the standby.
f. Another deficiency of Oracle in the standby is that direct loads, if using the
unrecoverable facility to bypass redo logging, require the data files of the primary
database to be manually copied across to the standby. This is not fixed in 9i. SQL
Server's version of log shipping and direct loads do not require this copying across.
8. CLUSTER TECHNOLOGY
In clustering technology, in the case of SQL Server, two nodes cannot work on the
same database, they "share nothing". At the best, to utilize the power of both nodes,
the application must be manually spit up and redistributed between the hosts, working
on different sets of data, and it is not possible to seamlessly scale upwards by adding
another node to the cluster in the case of SQL Server.
Most cluster configurations in Sql Server use the power of only one node, leaving the
other node to take over only if there is a problem with the first node.
In the case of Oracle Parallel server, it is possible to have two or more instances of the
database on different nodes acting on the SAME data in active-active configurations.
Lock management is handled by the Oracle Parallel server. With the new version of
Parallel Server in Oracle 9i, renamed as the Oracle real application cluster (9i RAC),
there is diskless contention handling of read-read, read- write, write-read, and write-
write contention between the instances.
This diskless contention handling is called Cache Fusion and it means for the first
time, any application can be placed in a cluster without any changes, and it scales
upwards by just adding another machine to the cluster.
Microsoft has nothing like this clustering technology of Oracle, which can best be
described as "light years ahead".
9. REPLICATION DIFFERENCES
In Oracle's simple replication, changes to a single table are stored in a snapshot log
and copied across, there is no need to check all the archive logs.
10. SECURITY
SQL Server and Internet articles of the magazine are only available with paid
subscription. Whereas, Oracle has given its magazine free for many years, all articles
are free on the internet, and the Oracle Technical network (OTN) is also free on the
internet.
12. USABILITY
Some people say Microsoft SQL Server tools, like Enterprise manager, are easy to
use. Oracle Enterprise Manager is a huge tool and seems daunting to inexperienced
people. This is true to an extent, however ease of use cannot be compared with the
many features in Oracle, and its industrial-level strength, and its many technical
advantages.
March 2002 Benchmarks from TPC.org show that Oracle 9i is seen in the majority of
top benchmarks in "non-clustered" TPC-C for performance (OLTP), whereas SQL
Server is seen in the majority of entries for "clustered" TPC-C for performance
(OLTP).
This gives the strange impression that SQL server is faster in a cluster than in a non-
cluster, which is misleading. The fact is that this result is due to the use of "federated
databases" in clusters by Microsoft in which pieces of the application are broken up
and placed on separate active-active servers, each working on separate pieces of the
application.
While excellent for theoretical benchmarks, this is not a practical approach in the real
life IT world because it requires massive changes to any application, and also ongoing
changes to the application when new servers are added to the cluster (each server has
a view that sees the data in the other servers, adding a new server would mean
rewriting the views for all tables on all servers) and would be rejected by any practical
headed manager.
Also, Oracle leads the way for Tpc benchmarks for Decision Support Systems with
1,000 Gb and 3,000 Gb sizes (TPC-H by performance per scale), whereas SQL Server
is only seen to a small extent in the 300GB range.
To provide a more native support for XML, the first release of Oracle9i Database
introduced the XMLType datatype and associated XML specific behavior. In addition,
built in XML generation and aggregation operators greatly increase the throughput of
XML processing.
With the second release of Oracle9i, Oracle significantly adds to XML support in the
database server. This fully absorbs the W3C XML data model into the Oracle
database, and provides new standard access methods for navigating and querying
XML - creating a native integrated XML database within the Oracle RDBMS.
The key XDB technologies can be grouped into two major classes - XMLType that
provides a native XML storage and retrieval capability strongly integrated with SQL,
and an XML Repository that provides foldering, access control, versioning etc. for
XML resources. The integration of a native XML capability within the database
brings a number of benefits.
In contrast to this, Microsoft SQL Server 2000 only has limited ways to read and
write xml from its tables.
SUMMARY
Oracle is much more advanced and has more to offer for larger applications with both
OLTP and Data Warehouse applications. Its new clustering features are ideal for
Application Service Providers (ASPs) on the Internet who can now start with a cluster
of 2 small servers and grow by just adding a server when they need to. Besides,
Oracle's multi-platform capability makes it the most convincing argument for an
enterprise.
Related links ? More about Oracle Tips & Ideas ? News by Administrator
--------------------------------------------------------------------- -----------
Most read story in Oracle Tips & Ideas: 127 Oracle DBA job interview questions
Most users don't care what the database is. Often they will be a MS or Oracle shop
and that's that, you wont change them. So usually there is no choice or even
comparison of technologies, it's just "we have an Oracle licence, use it" and that's it.
There is more to speed than the database.
The raw grunt of the database is rarely a problem. You are far more likely to find
speed issues that come from poor database design, crappy data models, slow
networks, poor application architecture or just plain bad software design than from the
actual speed of the database. When you get to the really high end, sure it matters, but
the time and effort spent changing from RDBMS to the other to get extra speed (if
there is any, and marginal at best) could be better spent on a gruntier box, you'll need
one next year anyway.
Once an MS shop, always an MS shop. MS has the "integration" of its products down
pat. If you implement an MS solution from end-to-end, likely you will never get out.
Their products are so dependent upon each other that to replace one component is just
too hard. You can build similar implementations in Oracle by embedding logic in the
database, but you don't have to.
Oracle is far more OPEN to different clients and platforms. If you want an SQLserver
system to run at optimal performance, it's MS end- to-end.
With all the hype, MSFT still can't keep locks from escalating and DB reads clean.
Until MSFT, SYBS, and IBM do so they will not be taken seriously in the high OLTP
world demanded by the web.
Check the stats, 10 of the top 10 web sites in the world use Oracle. As far as the TPC
benchmarks are concerned, IBM and MSFT are using smoke and mirrors. It took
TWELVE separate databases to be only twice as fast as ONE Oracle database.
Oracle has been able to use federations of databases (used by MSFT and IBM) for
benchmarks for five years. Oracle could beat IBM numbers 10 times over using a
federation, but won't because any real DBA would never consider using this useless
configuration in a real situation. Shared disk is the cluster configuration of every
major system on the web, MSFT, IBM and everybody else can't yet do it so they use
Shared nothing, which is good for just that, NOTHING. If you buy into the hype, be
sure to keep your receipt! by vikram lashkari
Thank you all for these great answers, I have been looking for a succinct precis like
this for a while, you have saved me much wading through sales material.
Ex: update emp set (empname,sal)=( select empname,sal from emp where
empcode=10000)
a) oracle , you can catch exception where you want, even a the end of procedure and
then trapping all cases.
b) sql2000, yu need to write your own code AFTER EACH statement, heavy,
heavy,heavy.
--------------------------------------------------------------------- -----------
--------------------------------------------------------------------- -----------
Introduction Often people in newsgroups ask about some comparison of Oracle and
Microsoft SQL Server. In this article, I compare SQL Server 2000 with Oracle 9i
Database regarding price, performance, platforms supported, SQL dialects and
products limits.
Hardware requirements To install SQL Server 2000, you should have the Intel or
compatible platforms and the following hardware:
To install Oracle 9i under the Intel or compatible platforms, you should have the
following hardware:
Hardware Requirements Processor Pentium 166 MHz or higher Memory RAM: 128
MB (256 MB recommended) Virtual Memory: Initial Size 200 MB, Maximum Size
400 MB Hard disk space 140 MB on the System Drive plus 4.5 GB for the Oracle
Home Drive (FAT) or 2.8 GB for the Oracle Home Drive (NTFS)
To install Oracle 9i Database under the UNIX Systems, such as AIX- Based Systems,
Compaq Tru64 UNIX, HP 9000 Series HP-UX, and Sun Solaris, you should have the
following hardware:
Software requirements SQL Server 2000 comes in six editions: Enterprise, Standard,
Personal, Developer, Desktop Engine, and SQL Server CE (a compatible version for
Windows CE) and requires the following software:
Oracle 9i Database comes in three editions: Enterprise, Standard and Personal and
requires the following software:
The TPC produces benchmarks that measure transaction processing and database
performance in terms of how many transactions a given system and database can
perform per unit of time, e.g., transactions per second or transactions per minute.
The TPC organization made the specification for many tests. There are TPC-C, TPC-
H, TPC-R, TPC-W and some old tests, such as TPC-A, TPC-B and TPC-D. The most
popular test is the TPC-C test (OLTP test).
At the moment the article was wrote, SQL Server 2000 held the top TPC-C by
performance results with Distributed Partitioned Views- based cluster systems. See
Top Ten TPC-C by Performance Version 5 Results
At the moment the article was wrote, SQL Server 2000 held the top TPC-C by
price/performance results. See Top Ten TPC-C by Price/Performance Version 5
Results
Note. Because most organizations really do not run very large databases, so the key
points on which SQL Server 2000 won the TPC-C benchmarks do not really matter to
the vast majority of companies.
Price comparison One of the main Microsoft SQL Server 2000 advantage in
comparison with Oracle 9i Database is that SQL Server is cheaper. Other SQL Server
advantage is that Microsoft includes the Online analytical processing (OLAP) and
Data Mining as standard features in SQL Server 2000 Enterprise Edition. So, you can
save up to four times with SQL Server 2000 Enterprise Edition if you use OLAP and
Data Mining.
The price comparisons below were based on the Oracle and SQL Server 2000 Price
Comparison article from Microsoft.
Compare pricing for SQL Server 2000 Standard Edition and Oracle9i Standard
Edition:
Number of CPUs Oracle9i Standard Edition SQL Server 2000 Standard Edition 1
$15,000 $4,999 2 $30,000 $9,998 4 $60,000 $19,996 8 $120,000 $39,992 16
$240,000 $79,984 32 $480,000 $159,968
Compare pricing for SQL Server 2000 Enterprise Edition (which include OLAP and
Data Mining) and Oracle9i Enterprise Edition with OLAP and/or Data Mining:
Number of CPUs Oracle9i Enterprise Edition Oracle9i Enterprise Edition with OLAP
or Data Mining Oracle9i Enterprise Edition With OLAP and Data Mining SQL Server
2000 Enterprise Edition 1 $40,000 $60,000 $80,000 $19,999 2 $80,000 $120,000
$160,000 $39,998 4 $160,000 $240,000 $320,000 $79,996 8 $320,000 $480,000
$640,000 $159,992 16 $640,000 $960,000 $1,280,000 $319,984 32 $1,280,000
$1,920,000 $2,560,000 $639,968
Note. This is not a full price comparison between SQL Server 2000 and Oracle 9i
Database. It is only a brief comparison. You can have any discounts and the prices can
be increased or decreased in the future. See Microsoft and Oracle to get more
information about the price of their products.
Features comparison Both SQL Server 2000 and Oracle 9i Database support the ANSI
SQL-92 entry level and do not support the ANSI SQL-92 intermediate level. In the
Features comparison section of this article I want to make the brief comparison of the
Transact-SQL with PL/SQL and show some SQL Server 2000 and Oracle 9i Database
limits.
T-SQL vs PL/SQL The dialect of SQL supported by Microsoft SQL Server 2000 is
called Transact-SQL (T-SQL). The dialect of SQL supported by Oracle 9i Database is
called PL/SQL. PL/SQL is more powerful language than T- SQL
Introduction In this article, I compare SQL Server 2000 with Oracle 9i Database
regarding price, performance, platforms supported, SQL dialects and products limits.
Hardware requirements To install SQL Server 2000, you should have the Intel or
compatible platforms and the following hardware: Hardware Requirements Processor
Pentium 166 MHz or higher Memory 32 MB RAM (minimum for Desktop
Engine),64 MB RAM (minimum for all other editions),128 MB RAM or more
recommended Hard disk space 270 MB (full installation),250 MB (typical),95 MB
(minimum),Desktop Engine: 44 MBAnalysis Services: 50 MB minimum and 130 MB
typicalEnglish Query: 80 MB
To install Oracle 9i under the Intel or compatible platforms, you should have the
following hardware: Hardware Requirements Processor Pentium 166 MHz or higher
Memory RAM: 128 MB (256 MB recommended)Virtual Memory: Initial Size 200
MB, Maximum Size 400 MB Hard disk space 140 MB on the System Driveplus 4.5
GB for the Oracle Home Drive (FAT)or 2.8 GB for the Oracle Home Drive (NTFS)
To install Oracle 9i Database under the UNIX Systems, such as AIX- Based Systems,
Compaq Tru64 UNIX, HP 9000 Series HP-UX, and Sun Solaris, you should have the
following hardware: Hardware Requirements Memory A minimum of 512 MB RAM
Swap Space A minimum of 2 x RAM or 400 MB, whichever is greater Hard disk
space 4.5 GB
Software requirements SQL Server 2000 comes in six editions: Enterprise, Standard,
Personal, Developer, Desktop Engine, and SQL Server CE (a compatible version for
Windows CE) and requires the following software:
Windows NT 4.0 Server with Service Pack 5 Yes Yes Yes Yes Yes No
Windows NT 4.0 Server Enterprise Edition with Service Pack 5 Yes Yes Yes Yes Yes
No
Windows 2000 Professional No No Yes Yes Yes No Windows 2000 Server Yes Yes
Yes Yes Yes No Windows 2000 Advanced Server Yes Yes Yes Yes Yes No Windows
2000 DataCenter Yes Yes Yes Yes Yes No Windows XP Professional No No Yes Yes
Yes No
The TPC produces benchmarks that measure transaction processing and database
performance in terms of how many transactions a given system and database can
perform per unit of time, e.g., transactions per second or transactions per minute.
The TPC organization made the specification for many tests. There are TPC-C, TPC-
H, TPC-R, TPC-W and some old tests, such as TPC-A, TPC-B and TPC-D. The most
popular test is the TPC-C test (OLTP test).
At the moment the article was wrote, SQL Server 2000 held the top TPC- C by
performance results with Distributed Partitioned Views-based cluster systems. See
Top Ten TPC-C by Performance Version 5 Results
At the moment the article was wrote, SQL Server 2000 held the top TPC- C by
price/performance results. See Top Ten TPC-C by Price/Performance Version 5
Results
Note. Because most organizations really do not run very large databases, so the key
points on which SQL Server 2000 won the TPC-C benchmarks do not really matter to
the vast majority of companies. Price comparison One of the main Microsoft SQL
Server 2000 advantage in comparison with Oracle 9i Database is that SQL Server is
cheaper. Other SQL Server advantage is that Microsoft includes the Online analytical
processing (OLAP) and Data Mining as standard features in SQL Server 2000
Enterprise Edition. So, you can save up to four times with SQL Server 2000
Enterprise Edition if you use OLAP and Data Mining.
The price comparisons below were based on the Oracle and SQL Server 2000 Price
Comparison article from Microsoft. Compare pricing for SQL Server 2000 Standard
Edition and Oracle9i Standard Edition: Number of CPUs Oracle9i Standard Edition
SQL Server 2000 Standard Edition 1 $15,000 $4,999 2 $30,000 $9,998 4 $60,000
$19,996 8 $120,000 $39,992 16 $240,000 $79,984 32 $480,000 $159,968
Features comparison Both SQL Server 2000 and Oracle 9i Database support the ANSI
SQL-92 entry level and do not support the ANSI SQL-92 intermediate level. In the
Features comparison section of this article I want to make the brief comparison of the
Transact-SQL with PL/SQL and show some SQL Server 2000 and Oracle 9i Database
limits.
Conclusion It is not true that SQL Server 2000 is better than Oracle 9i or vice versa.
Both products can be used to build stable and efficient system and the stability and
effectiveness of your applications and databases depend rather from the experience of
the database developers and database administrator than from the database's provider.
But SQL Server 2000 has some advantages in comparison with Oracle 9i and vice
versa.
The SQL Server 2000 advantages: ? SQL Server 2000 is cheaper to buy than Oracle
9i Database. ? SQL Server 2000 holds the top TPC-C performance and
price/performance results. ? SQL Server 2000 is generally accepted as easier to
install, use and manage. The Oracle 9i Database advantages: ? Oracle 9i Database
supports all known platforms, not only the Windows-based platforms. ? PL/SQL is
more powerful language than T-SQL. ? More fine-tuning to the configuration can be
done via start- up parameters.
Bristle Software
SQL Tips
This page is offered as a service of Bristle Software, Inc. New tips
are sent to an associated mailing list when they are posted here.
Please send comments, corrections, any tips you'd like to
contribute, or requests to be added to the mailing list, to
tips@bristle.com.
Table of Contents:
1. Oracle Tips
1. SQL Tips
1. SELECT * and more
2. Materialized View
3. Search Source Code of Stored Procedures
2. PL/SQL Tips
3. SQL Navigator Tips
4. See Also
2. MS SQL Server Tips
1. SQL Tips
1. Dynamic SQL in a Stored Procedure
2. Search Source Code of Stored Procedures
2. SQL Enterprise Manager Tips
1. Keyboard Shortcuts
2. SQL Generating SQL
3. See Also
3. Differences Between Oracle and MS SQL Server
1. Concepts and Terminology
2. Data Types
3. Limits
4. Operators
5. Built-In Functions
6. Differences in SQL Syntax
7. Differences in SQL Semantics
8. Differences in Managing Databases
9. Differences in Managing Database Objects
10. Differences in Managing Users
11. Differences in Integration with MS ADO, RDO, etc.
12. Miscellaneous Differences
13. See Also
Details of Tips:
1. Oracle Tips
1. SQL Tips
--Fred
2. Materialized View
--Fred
SELECT *
FROM all_source
WHERE LOWER(text) LIKE '%table_name%'
SELECT *
FROM all_source
WHERE LOWER(text) LIKE '%table\_name%' ESCAPE
'\'
--Fred
2. PL/SQL Tips
4. See Also
--Fred
Warnings:
Thanks to:
--Fred
SELECT *
FROM syscomments c,
sysobjects o
WHERE o.id = c.id
AND c.text LIKE '%table_name%'
--Fred
1. Keyboard Shortcuts
Key Function
F1 Help on SQL Enterprise Manager
Shift-F1 Help on syntax of current SQL statement
F4 Search for objects by name, type, etc.
Ctrl-E Execute selected text in Query Analyzer
Ctrl-R Hide/show results pane in Query Analyzer
Ctrl- Comment the currently selected text in Query
Shift-C Analyzer
Ctrl-
Uncomment
Shift-R
Ctrl- Show the estimated query plan for the
Shift-L currently selected text.
Hide/show "Show execution plan, as executed".
Ctrl-K (The query has to be run for the query plan to
be returned to Query Analyzer.)
--Fred
--Fred
3. See Also
--Fred
MS SQL
Concept/Ter
Oracle Server MS SQL Server 7+
m
6.5
Database
engine Databas
Database Instance
(collection of e server
databases)
Database
(collection of Schema Database
tables)
Roles/Groups Roles Groups Roles
Member of
Database appropriate server or
administrator dba sa database role
account
Also: sa (deprecated)
Database Member of db_owner
dba dbo
owner role
Databas
e
Catalog
Data - one per
Data about Dictionary database INFORMATION_SCHE
the database - one per MA views
server "Master"
database
- one per
server
Blocks and Blocks and
Pages and extents
extents extents
Not
Tablespace
Tablespaces supporte File Groups
s
d
Network
SQL*Net Net-library
software
Data stream Transparen Tabular Data Stream (TDS)
protocol t Network
Substrate
(TNS)
Case
sensitivity of Depends on character sort
Case-
names of order, default is case-
insensitive
tables, insensitive
columns, etc.
Synonyms Supported Not supported
Readonly
Supported Not supported
transaction
--Fred
2. Data Types
Data
Oracle MS SQL Server
Type
Fixed CHAR(n), CHARACTER(n)
CHAR(n)
Length - limit 255 (6.5)
- limit 2KB
String - limit 8KB (7.0)
VARCHAR2(n),
VARCHAR(n)
VARCHAR(n), CHAR
- limit 4KB in a
Variable VARYING(n), CHARACTER
column
Length VARYING(n)
- limit 32KB in a
String - limit 255 (6.5)
variable
- limit 8KB (7.0)
- VARCHAR is
obsolete
INTEGER (4 bytes),
INTEGER, INT (4 bytes),
Integer INTEGER(n), SMALLINT (2 bytes),
SMALLINT TINYINT (1 byte),
BIT (1 bit)
Fixed Point NUMBER, NUMERIC, NUMERIC(n),
NUMBER(n), NUMERIC(n,d),
NUMBER(n,d), DECIMAL, DECIMAL(n),
FLOAT, FLOAT(n), DECIMAL(n,d),
DEC, DEC(n), DEC(n,d),
FLOAT(n,d)
MONEY, SMALLMONEY
FLOAT, FLOAT(n), DOUBLE
Floating
DECIMAL PRECISION,
Point
REAL,
DATETIME,
SMALLDATETIME,
Date DATE TIMESTAMP
- TIMESTAMP auto-
updated
BINARY(n),
VARBINARY(n), BINARY
RAW(n)
Binary VARYING(n)
- limit 255 bytes
- limit 255 (6.5)
- limit 8KB (7.0)
LONG, LONG
VARCHAR
- limit 2GB
Large TEXT
- limit one per
String - limit 2GB
table row
CLOB
- limit 4GB
LONG RAW
- limit 2GB
Large - limit one per IMAGE
Binary table row - limit 2GB
BLOB
- limit 4GB
NCHAR(n), NATIONAL
CHAR(n), NATIONAL
NCHAR(n) CHARACTER(n)
NVARCHAR(n) NVARCHAR(n), NATIONAL
Multi-byte NCLOB CHAR VARYING(n),
chars - same limits as NATIONAL CHARACTER
CHAR, VARCHAR, VARYING(n)
CLOB NTEXT, NATIONAL TEXT
- same limits as CHAR,
VARCHAR, TEXT
OS File BFILE <not supported>
Row implicit ROWID
(use an IDENTITY column)
Identifier column
Secure OS MLSLABEL, RAW
<not supported>
Label MLSLABEL
128-bit <not supported> UNIQUEIDENTIFIER
Unique
Number
(version 7.0 only)
(UUID,
GUID)
--Fred
3. Limits
MS SQL
MS SQL Server
Description Oracle Server
7+
6.5
Columns per
1000 250 1024
table
8060 bytes
- Includes
pointers, but not
data, for TEXT
1962
Row size Unlimited and IMAGE
bytes
columns
- With 2000,
some text can
be stored in-row
LONG and LONG 1 (must be
Unlimited (16-byte pointer
RAW columns last
per)
per row column)
LOB, TEXT, and Unlimited (16-byte pointer per)
IMAGE columns
per row
Clustered
indexes per 1
table
Non-clustered
indexes per unlimited 249
table
Columns per
16
index
Index row size 2K bytes 900 bytes
Identifier Length 30 chars 128 chars
Tables per
unlimited 16 256
SELECT
Source code per
stored 64KB 250MB
procedure
Data type limits (see Data Types)
--Fred
4. Operators
--Fred
5. Built-In Functions
Thanks to:
--Fred
Descriptio
Oracle MS SQL Server
n
Left Outer FROM table1 LEFT FROM table1 LEFT
Join OUTER JOIN table2 ON OUTER JOIN
(table1.column1 =
table2.column2)
table2 ON
table1.column1 =
Note: The following
table2.column2
syntax is also supported,
and was the only syntax
Note: The
prior to version 9i:
following syntax is
WHERE column1 =
also supported, but
column2(+)
is no longer
recommended:
All rows from the right
WHERE column1
plus nulls to match
*= column2
additional rows from the
left.
FROM table1 RIGHT
OUTER JOIN table2 ON
FROM table1
( table1.column1 =
RIGHT OUTER
table2.column2)
JOIN table2 ON
table1.column1 =
Note: The following
table2.column2
syntax is also supported,
Right Outer and was the only syntax
Note: The
Join prior to version 9i:
following syntax is
also supported, but
WHERE column1(+) =
is no longer
column2
recommended:
WHERE column1
All rows from the left plus
=* column2
nulls to match additional
rows from the right.
As of Oracle 9i: FROM table1 FULL
FROM table1 FULL OUTER JOIN
Full Outer
OUTER JOIN table2 ON table2 ON
Join
(table1.column1 = table1.column1 =
table2.column2) table2.column2
SELECT
SELECT 'hello world' SELECT 'hello
without
FROM DUAL world'
FROM
SELECT
CREATE TABLE AS
data into a SELECT ... INTO
SELECT ...
table
Intersectio SELECT ... WHERE
SELECT ... INTERSECT
n of 2 EXISTS (SELECT
SELECT ...
SELECTS ...)
Subtraction SELECT ... MINUS SELECT ... WHERE
of 2 NOT EXISTS
SELECT ...
SELECTS (SELECT ...)
INSERT Create a VIEW and
INSERT INTO SELECT ...
into a JOIN INSERT INTO it.
UPDATE
Create a VIEW and
data in a UPDATE SELECT...
INSERT INTO it.
JOIN
UPDATE table1 t1
SET field1 =
(SELECT ...
FROM table2 t2
UPDATE
WHERE <condition
one table
involving both t1 and
based on UPDATE table
t2>)
criteria in FROM ...
WHERE EXISTS
another
(SELECT ...
table
FROM table2
WHERE <condition
involving both t1 and
t2>)
DELETE DELETE FROM table1 t1
rows from WHERE EXISTS
one table (SELECT ...
DELETE FROM table
based on FROM table2
FROM ...
criteria in WHERE <condition
another involving both t1 and
table t2>)
DROP a As of Oracle 8i: ALTER TABLE
column ALTER TABLE table_name table_name DROP
from a DROP COLUMN COLUMN
table column_name column_name
Readonly CREATE VIEW ... WITH
GRANT SELECT ...
VIEW READONLY
SAVE
Save point SAVEPOINT
TRANSACTION
LOCK TABLE...IN SHARE SELECT...table_na
Table lock
MODE me (TABLOCK)
Exclusive LOCK TABLE...IN SELECT...table_na
table lock EXCLUSIVE MODE me (TABLOCKX)
Reserving
index PCTFREE=0 FILLFACTOR=100
space
Declaring a DECLARE varname type; DECLARE
local @varname type
variable
Initializing
DECLARE varname type
a local <not supported>
:= value;
variable
DECLARE varname
Declaring a
CONSTANT type := <not supported>
constant
value;
SET @varname =
Assigning varname := value
value
to a SELECT value INTO
SELECT @varname
variable varname
= value
Assigning
to a FETCH NEXT FROM
FETCH cursorname INTO
variable cursorname INTO
varname
from a varname
cursor
CURSOR curname DECLARE curname
Declaring a
(params) CURSOR FOR
cursor
IS SELECT ...; SELECT ...
IF ... THEN IF ...
If ELSIF ... THEN BEGIN ... END
statement ELSE ELSE BEGIN ...
ENDIF END
WHILE ... LOOP WHILE ...
While loop
END LOOP BEGIN ... END
FOR ... END LOOP
Other loops <not supported>
LOOP ... END LOOP
Loop exit EXIT, EXIT WHEN BREAK, CONTINUE
Print
DBMS_OUTPUT.PUT_LINE PRINT
output
RAISE_APPLICATION_ER
Raise error RAISERROR
ROR
None required, but
semi-colons are
tolerated as of
Statement
Semi-colon (;) 2000. GO is used
terminator
to terminate a
batch of
statements.
INSERT As of SQL Server
As of Oracle 9i:
with some 2000 (perhaps 7):
columns
getting
their INSERT INTO table1 VALUES (123,
default DEFAULT, 'a string', NULL)
values
UPDATE As of SQL Server
As of Oracle 9i:
resetting 2000 (perhaps 7):
some
columns
back to UPDATE table1 SET col1 = 123, col2 =
their DEFAULT, col3 = 'a string', col4 = NULL
default
values
Thanks to:
--Fred
--Fred
--Fred
Descriptio
Oracle MS SQL Server
n
[schema.]ta [[[server.][database].][owner].]
Fully
ble table
qualified
[schema.]vie [[[server.][database].][owner].]
name
w view
Temp Pre 8i: #table -- Any table named
tables Temporary starting with a pound sign (#) is
tables must automatically dropped when the
be deleted user logs off or the procedure
explicitly ends.
##table -- Same as above,
8i+: except that the table is
CREATE accessible to other users and is
GLOBAL dropped when the last user who
TEMPORAR referenced it logs off.
Y TABLE
You have to choose which action
Re- CREATE OR to take. If it doesn't already
creating an REPLACE ... exist, use:
object that (Oracle CREATE ...
may or chooses If is does exist, use:
may not correctly ALTER ...
already which action or the sequence:
exist to take.) DROP ...
CREATE ...
Create
view CREATE Not supported. Tables used by
before FORCE view must exist before view can
dependent VIEW be created.
tables
--Fred
MS SQL MS SQL
Description Oracle
Server 6.5 Server 7+
Each user Each user can Each user
can be a be a member can be a
Membership
member of of only one member of
in groups
any number group other any number
of groups. than "public". of roles.
--Fred
Differences in Integration with MS
ADO, RDO, etc.
MS SQL
Description Oracle
Server
Return a handle to a
SELECT with no
cursor.
INTO clause;
Return a For more info: See MS
Multiple such
recordset to KB article Q174679.
SELECTs return
the caller Can return multiple
multiple
recordsets as multiple
recordsets
output parameters.
--Fred
Miscellaneous Differences
MS SQL
MS SQL
Description Oracle Server
Server 7+
6.5
Generate unique CREATE IDENTITY column of a
numbers SEQUENCE table
DELETE DELETE
(use
Cascaded DELETE CASCADE CASCADE
triggers)
... ...
Call a user-defined Supported Not Supported
function from a supported
SQL statement (as
column of SELECT
or expression in
WHERE clause)
--Fred
See Also
--Fred
The most commonly asked question is, "Is there a tool that I can use, to translate
my PL/SQL scripts, stored procedures, triggers and functions into T-SQL?" Sadly,
the answer is No. There is no magic tool that can convert all your PL/SQL code to
T-SQL. Even if such a tool exists, I can guarantee that it will not work in all
situations. So, migrating or porting your PL/SQL code to T-SQL is a painfully
manual process. The more standard (ANSI SQL) SQL you write, the more easier it
is to translate, as ANSI SQL is more likely to work independant of the RDBMS.
However, it need not be that manual anymore. I recently learned about a tool
from DBBest.com. Do check it out! Also, do not forget to check out SwisSQL
Database Migration tools.
At the end of this article, I will provide you with more links to books, that are
useful for Oracle DBAs and developers, entering the Microsoft SQL Server world.
The following table addresses the most frequently asked questions (FAQ), related
to migrating from Oracle to SQL Server. This is list is by no means complete and
will be updated periodically.
%TYPE data type No The %TYPE data type of Oracle, lets you
equivalent create a variable and have that variable's
data type be defined by a table or view
column or a PL/SQL package variable.
SELECT Sport,
CASE Sport
WHEN 'Cricket' THEN 'England'
WHEN 'Hockey' THEN 'India'
WHEN 'Base Ball' THEN 'America'
ELSE NULL
END AS 'Originating Country'
FROM Sports
SELECT 'Something'
FROM DUAL
SELECT 'Something'
SELECT table_name
FROM TABS