920 likes | 1.27k Vues
Twin Cities Oracle Users Group. A Comparison of SQL Server 2000 and Oracle 9i Databases. Fred Potthoff, Adjunct Faculty Jerry Heath, Resident Faculty Metropolitan State Univ - MIS Dept. January 15, 2004. Introduction. Why Compare the databases?
E N D
Twin Cities Oracle Users Group A Comparison of SQL Server 2000 and Oracle 9i Databases Fred Potthoff, Adjunct Faculty Jerry Heath, Resident Faculty Metropolitan State Univ - MIS Dept January 15, 2004
Introduction • Why Compare the databases? • We often run both databases at one site • SQL Server is growing up - size / installs
Introduction • Who I am - fred.potthoff@metrostate.edu • Community Faculty - MIS Dept • MBA from UCLA - Computer Info Systems • 20+ years with relational databases • Developer and DBA • Ingres, Teradata/Sharebase, Oracle, SQL Server • Who I am - jerry.heath@metrostate.edu • Resident Faculty, Associate Professor • Formerly at Univ of Washington and Hawaii • 15+ years teaching • Set Up SQL Server and Oracle Databases
Overview Oracle Had 11% increase in DB sales in 2003 Microsoft had 18% increase in DB sales 2003
Overview - 2002 ERP Apps • % of Installations Oracle SQLServer • SAP 76% 3% • PeopleSoft 72% 7% • Siebel 81% 4% • ERP Market Share 2001 50% 21% 2002 54% 21%
Topics of Discussion 1. Architecture 2. Installation 3. Transactions and Record Locking 4. Performance Tuning 5. Database Management 6. Backup and Recovery 7. Cost and Licensing Arrangements
1 - Architecture • Definition of Database / Instance • Memory Configuration • Threads • Background Processes • File Structure
1a - Instances • Details about this topic • Supporting information and examples • How it relates to your audience
1b - Memory Configuration Oracle SQL Server
1d - Background Processes Oracle
1e - File Structure SQL Server For Backup Information
2 - Installation • Release Notation • Product Types • Platforms • Install Comparison • Oracle • SQL Server 2000
2a - Release Notation • Oracle • 9.2.0.1.0 • Major release • Maintenance release • Application server release • Component specific release • Platform specific release • SQL Server 2000 • 8.0 • Major release • Minor release • Apply service packs - sp3a
2b - Product Types • Enterprise • Standard • Licensing: • Per Processor • Units • Oracle - Named User • SQL Server 2000 - Client Access License
2c - Oracle Platforms • Operating System • UNIX - IBM’s AIX, HP-UX, Sun Solaris • LINUX • Windows NT 4.0, service pack 5 • Windows 2000, service pack 1 • Windows 2003 • Windows XP • Hardware - IBM, HP, Sun, + Intel • Pentium 166 MHz or higher • 128 MB RAM - 256 MB better • Hard Disk: 140 MB System 4.5 GB Home (FAT) or 2.8 GB Home (NTFS)
2c - SQL Server 2000 Platforms • Operating System • Windows NT 4.0, service pack 5 • Windows 2000 Server • Windows 2003 Server • Hardware • Pentium 166 MHz or higher • 64 MB RAM - 128 MB better • Hard Disk: 95-270 MB (250 usual) 50 MB min Analysis Serv 80 MB English Query
2d - Oracle DB Creation • Oracle Command Line Script or GUI • Command Line Script on NT • oradim.exe • SQL*Plus • SQLNet Config • GUI • Database Configuration Assistant
2d - SQL Server 2000 DB Creation • Installation CD • Installation wizard on the CD
2d - Oracle Steps 1. Plan database tables, indexes, estimate space 2. Plan layout of OS files that make DB 3. Consider Oracle Managed Files 4. Select Global Database Name 5. Create / modify server parameter file(s)
2d - Oracle Steps 6. Select DB Character Set 7. Determine time zones supported 8. Set up undo tablespace 9. Develop backup / recovery strategy 10. Startup and shutdown databases
2d - SQL Server 2000 Steps 1. Plan database tables, indexes, estimate space 2. Plan layout of OS files that make DB Possible Layout: Drive RAID Contents C: 1 OS+installed apps E: 1or 10 System DB Files F: 1 Filegroup “Data” Files G: 1 Filegroup “Index” Files H: 1 Transaction Log Files
2d - SQL Server 2000 Steps 3. Select Instance name or Default name 4. Set up account in which services run 5. Install Collation (language), sort order 6. Is Full Text Search and English Query Required?
2d - SQL Server 2000 Steps 7. Determine Authentication Mode 8. Set up Networking Services 9. Develop backup / recovery strategy 10. Startup and shutdown databases 11. Option - Install OLAP, Data Mining Analysis Services
3 - Transactions / Record Locking • Rollback Segments / Redo Logs • Record Locks • T-SQL vs SQL-Plus Transactions
3a - Rollback Segments / Redo Logs Oracle • Undo Tablespace in 9i • Redo Logs Note: DBA can still use Rollback Segments, if desired
3a - Rollback Segments / Redo Logs SQL Server • Transaction Log is present in each Database of each Instance • Equivalent of Oracle undo and redo logs
3b - Record Locks • SQL Server more complex than Oracle • Caused by lack of rollback segments • Additional isolation levels to maintain read consistency • Possible for writers to block readers • Increased possibility for: • deadlocking • long-sustained blocking • Keep transactions as short as possible • Oracle never escalates locks
3b - Record Locks Lock Types Resources Status • INTENT (I) • SHARED (S) • UPDATE (U) • EXCLUSIVE (X) • SCHEMA (Sch-[M,S]) • BULK UPDATE (BU) • RANGE[I]_[S,U,X,N] • RID • PAGE • EXT • TAB • IDX • FIL • KEY • DB • GRANT • WAIT • CNVRT
3b - Record Locks • The transaction isolation levels are: SQL Server Oracle Read Uncommitted N/A Read Committed (default) Read Committed (default) Repeatable Read N/A Serializable Serializable N/A Read Only (ANSI)
3c - T-SQL vs SQL-Plus Transactions • T-SQL command: SET TRANSACTION ISOLATION LEVEL [ READ COMMITTED, READ UNCOMMITTED REPEATABLE READ, SERIALIZABLE ] • You can view the isolation level via the command: DBCC USEROPTIONS • SQL-Plus command: SET TRANSACTION ISOLATION LEVEL [READ COMMITTED , SERIALIZABLE]
3c - T-SQL vs SQL-Plus Transactions Example: set transaction isolation level serializable begin transaction select * from mytable exec sp_lock @@spid commit transaction
3c - T-SQL vs SQL-Plus Transactions • The key difference - inability for SQL Server to pause or re-start transactions as Oracle can • Can have savepoints like Oracle
4 - Performance Tuning • TPC Benchmarks • Trace • Explain Plan • Performance Monitor • Indexing • Index Tuning • Stored Procedures
4 - TPC Benchmarks • TPC - Transaction Processing Performance Council www.tpc.org • TPC-C Benchmark - Order Entry • Established in 1992 • 5 transaction types • New Order • Payment • Delivery • Order Status • Stock Level
4 - Oracle Trace PLUS: UTLBSTAT, UTLESTAT, STATSPACK
4 - SQL Server Profiler • GUI that allows you to trace: • Cursors • Database - data and log file changes • Errors and Warnings • Locks • Performance • Security audit - like password changes • Stored Procedures • Transactions • T-SQL Commands
4 - Oracle Explain Plan Rows Execution Plan -------- ---------------------------------------------------- 12 SORT AGGREGATE 2 SORT GROUP BY 76563 NESTED LOOPS 76575 NESTED LOOPS 19 TABLE ACCESS FULL CN_PAYRUNS_ALL 76570 TABLE ACCESS BY INDEX ROWID CN_POSTING_DETAILS_ALL 76570 INDEX RANGE SCAN (object id 178321) 76563 TABLE ACCESS BY INDEX ROWID CN_PAYMENT_WORKSHEETS_ALL 11432983 INDEX RANGE SCAN (object id 186024)
4 - Oracle Performance Manager Different from NT Performance Monitor
4 - Performance Monitor (perfmon.exe) • Each SQL Server Instance installed has performance monitor counters • Statistics for: • CPU Usage • CPU Context Switches • Disk I/O • Memory and Paging • SQL Server Cache, Buffer Manager, Trans/Sec, Page Splits, Full Scans, Wait Times