Twin Cities Oracle Users Group
Upcoming SlideShare
Loading in...5
×
 

Twin Cities Oracle Users Group

on

  • 1,440 views

 

Statistics

Views

Total Views
1,440
Views on SlideShare
1,440
Embed Views
0

Actions

Likes
1
Downloads
12
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Total Dollars: Top 3 are 75% of total database sales Source: IDC Competitive Analysis: The RDBMS Top 10: License Sales Analysis and Market Forecast, 2002 - 2007 Nov 2003 Unix Windo Linux Ot Main Oth Total Maint Total Totals: 2605 3327 225 16 1370 372 7916 4725 12641
  • License revenue only. Microsoft did not have any maintenance revenue in 2002 and 2001 for SQL Server 2000, but it now has maintenance available. Oracle and IBM’s 2001 maintenance revenue is not in the study 2003 increase is from Oracle press release Oracle Looking for more Linux sales, migration from lesser players - Sybase, Progress, Informix, plus new 10g database MS Annual Report 2003 - Server and Tools revenue was $5.84 billion, $6.16 billion, and $7.14 billion in 2001, 2002, and 2003. Server and Tools consists of server software licenses and client access licenses (CALs) for Windows Server, SQL Server, Exchange Server, and other servers. It also includes developer tools, training, certification, Microsoft Press, Premier product support services, and Microsoft consulting services. Total Server and Tools revenue grew $983 million or 16% in fiscal 2003, driven by an increase in Windows-based server shipments and growth in SQL Server and Exchange revenue. Server revenue, including CALs, grew $787 million or 18% from fiscal 2002 as a result of increased new and anniversary multi-year licensing agreements.
  • http://www.oracle.com/features/insider/index.html?1115_oi_msftco.html Install data - FactPoint survey in 2002 Market share - AMR Research, The Enterprise Application Spending Report 2001-2006 released Sep 2002
  • DBCC - database checking and consistency command
  • Oracle - database the physical files and instance as the memory structures and processes to interact with the database. Undo tablespace is new for 9i SQL Server 2k an instance is a complete, near independent installation of SQL Server that includes: 1. Binaries and associated options (mandatory and optionally installed) 2. Windows Services and associated registry entries 3. System databases, their physical database files, log files and other example databases associated with the instance. The control file is critical to an Oracle instance, it stores a variety of information such as: Database name Timestamp of DB creation Names and locations of database files and redo logs Tablespace information Archive Log history Checkpoint information SQLServer-The control file is basically the master database. Without it the instance will not be able to start as it consists of all the information about other system and user databases. The master database can also be viewed the system tablespace to some degree, but it distributes its data dictionary objects with other system and user databases (such as MSDB). The data dictionary within SQL Server is a series of system tables with the sys prefix owned by the internal user dbo Back up all master, msdb, model system dbs. An Oracle tablespace can have one of more data files. Within SQL Server, a file-group can have one or more datafiles. Objects can span multiple data files in its file-group as they can do within Oracle tablespace data files. If there is more than one data file per file-group, then SQL Server will stripe (store) data evenly across each of the datafiles (based on the % free space within each data file). The DBA cannot Offline/Online a file-group like you can an Oracle tablespace. As an Oracle database has two or more redo logs, so each database within a SQL Server instance has a transaction log file that is further divided into smaller logical log files. There are no rollback segments in a SQL Server database. Because of this, writers can block readers and SQL Server’s locking mechanism is much more complex that Oracle’s with a higher probability of locking problems with long running, non-committed transactions.
  • Think of a SQL Server instance as a new installation of SQL Server. Multiple installations of SQL Server on the same server - introduced named instances . 16 per server max. Allows you to have, say, a SQL Server 2k instance running Service Pack 2 installed and other running Service Pack 1 on the same server. In context to Oracle, its like having v8.1.5 and v8.1.6 running on the same server. Common Files: COM (DLL’s) Replication Full text search Directory service integration Import OLEDB provider etc Tools: Enterprise Manager Command line and GUI query analyser tools BCP, Bulk Insert etc DTS Run command line Rebuild Master DB utility Wizards Books online (BOL) SQL Templates Each instance maintains what is left over, namely their data files and complete set of executable files. It is important to remember that the MDAC (Microsoft Data Access Components, is not instance dependent, it is a server wide API for all data access (ADO, OLE-DB, ODBC). Therefore, care must be taken between service packs and even other SQL Server installations as they may inadvertently “break” existing products. When a new user database is created within an instance, its structure is modelled from the MODEL system database. The DBA may customise selected properties of MODEL to reflect these within any new database created. When a SQL Server DBA talks about “SQL”, some are actually referring to the product “SQL Server” rather than the SQL language. No equivalent of INIT.ORA in SQLServer - use registry entries, settings in master database, service startup parameters (sqlsrvr.exe). Also, no environment variables in SQL Server - only registry entries for each instance
  • Oracle provides fine grain control over virtually all aspects of the memory (and storage) engine, whereas SQL Server provides very little control. This is not necessarily a bad thing in a majority of cases. SQL Server runs with a similar architecture to that of its underlying operating system, via a pool of threads that asynchronously perform a variety of tasks on behalf of the DBMS and its related engine components (storage, relational etc). SGA (SQLServerAddress Space)-The maximum address space for SQL Server is 2Gb, this can be extended via the /3GB switch in the operating systems boot.ini file. Each instance has own address space and memory pool. View threads under sqlsrvr.exe with DBCC SQLPERF (UMSSTATS) and DBCC SQLPERF(THREADS). This memory allocation is controlled via the –g parameter on instance startup and defaults to 128Mb. DBA only sets startup, min, max memory. Consider setting the maximum RAM by 10 to 20% less that the total server memory for dedicated database servers. The buffer cache is a dynamic pool of buffers (8k pages) read from the physical data files and is equivalent to the Oracle buffer cache. All subsequent reads/writes to physical data files occur via the buffer cache. The cache itself consists of: Linked list - to all free buffer pages Each buffer page has a header that, among other things, contains a reference pointer that is incremented when SQL statements reference the page. The increment may differ internally. A value of zero on the reference counter marks the page as dirty. A write is then scheduled. A global pool of worker threads via the user connection will manage writes and reads from the cache. The Oracle buffer cache goes many steps further than SQL Server in terms of configureability and control, for example: Default, Keep or Recycle pools (multiple buffer pools), sizing, different block-size buffers. SQLServer - no control on block size of buffers. The redo log buffer in Oracle is a circular buffer of redo entries (which are any changes made by any insert, delete, update, create, alter, drop statement) stored sequentially in the SGA and controlled via the log buffer parameter. The background process lgwr writes the redo log buffer entries to the current active online redo log file. In a SQL Server instance we have a single log cache memory structure for all databases within the instance; there is a series of cache buffers for each database within the instance. For every change made to a buffer cache page a log cache entry is made recording the change, this must be written to the databases transaction log before the dirty buffer cache record is written (flushed) to disk. This process is essential to ensure effective rollback during database or user transaction recovery. Due to this write-ahead strategy of log-cache transaction log buffer cache flush the transaction log is at times called the write-ahead log.
  • In a UNIX environment, most Oracle processes are part of one master Oracle process, rather than being individual processes. On Windows NT, all processes consist of at least one thread. A thread is an individual execution within a process. Threads enable concurrent operations within a process so that a process can run different parts of its program simultaneously on different processors. A thread is the most fundamental component that can be scheduled on Windows NT. LMS- Lock Process RECO- Recoverer Process PMON- Process Monitor SMON- System monitor CKPT - Checkpoint ARC0 - Archiver (numbered) DBW0 - Database writer (numbered) LGWR - Log Writer D000 - Dispatcher Process
  • Each database connection is managed via a worker thread no matter the underlying DB-Library provider. In SQL Server, each connection is through a database instance login , which defines instance wide privileges, language and other basic properties for the associated process (SPID) managed via a worker thread. The connection itself is controlled via the UMS (user mode schedular) as described in the Memory Structures section. The properties of each SPID can be monitored via the sp_who and sp_who2 stored procedures or by querying the master..sysprocesses table. The DBA determines which of the databases within the instance the login can access, these are called database users ; The login to user mapping exists separately for each instance database with their own database level privileges (i.e. 1 login to many database users within the instance). The sysprocesses table has a variety of information that the DBA may be interested in, namely the ECID (execution context ID in which threads are running under for the SPID, KPID (current NT thread managing the SPID), CMD (command being executed) and much more. Such information may be present in the server error logs on occasions.
  • SQLServer does not support multiple block sizes or variable extents. In Oracle, we have the logical allocation of space based on blocks extents segments , with blocks being the finest level of granularity for storage. Oracle allows the DBA to specify different block sizes for each tablespace (up to 5 standard sizes in 9i) SELECT SEGMENT_NAME, BYTES, BLOCKS FROM DBA_EXTENTS WHERE SEGMENT_TYPE = 'ROLLBACK'; SEGMENT_NAME BYTES BLOCKS --------------- --------- -------- RS1 10240 5 RS1 10240 5 SYSTEM 51200 25 SYSTEM 51200 25 SYSTEM 51200 25 Notice that the rs1 rollback segment is comprised of two extents, both 10K, while the SYSTEM rollback segment is comprised of three equally sized extents of 50K. There are eight different page types in SQL Server : data index text/image global and secondary allocation map – what extents (64k contiguous) are allocation page free space – information about page free space index allocation map – extent information about index allocation bulk change map – lists extents modified from bulk operations since last log backup differential change map - extents modified since last backup database command Since SQL Server has fixed page sizes the extent size is also fixed at 64k (8x8k pages) and is contiguous in its storage. This is the smallest IO call SQL Server will make. The idea of the DBA pre-allocating extents to objects or change extent size is non-existent in SQL Server. The fillfactor option is used in place of pctused in Oracle. You cannot use this option in create table command though, it is only used when indexes(clustered or non-clustered) are created. When DBA’s of SQLServer talk about defragmentation, it is usually in context with indexes and rebuilding them to resolve storage issue and page splitting. The default fill factor is zero, this is similar to 100% but with space for one record left at the higher level of the index nodes.
  • It is worth mentioning that in Oracles’ locally managed tablespace, the tablespace manages its own extents via a bitmap structure for each datafile to track free or used blocks. As the uniform extents are allocated and deallocated the bitmap entries for the associated blocks are also altered. On top of this, there is no requirement for coalescing free extents to consolidate fragmented free space as all extents are uniform in size (unlike dictionary managed tablespaces). In SQL Server, “free space management” in terms of a ‘free-list’ entries consists of two page types: GAM – global allocation map page Tracks extent allocation 1 x GAM = 64k extents (4Gb data) One bit for each extent 1 = free, 0 = allocated SGAM – shared global allocation map page Tracks those extents that have mixed pages and have at least one unused page 1 x SGAM = 64k extents (4Gb data) 1 = extent is mixed and has free pages 0 = not used as mixed, or, is a mixed extent whose pages are all in use. A PFS (page free space) page records individual page allocations within the data file. The page itself is a bitmap structure similar to the GAM and SGAM but only covers 8000 pages at a time. The value of the bit denotes the percentage full within the pages for an extent, for example: Empty 1 - 50% 51 - 80% 81 - 95% 96 - 100% The PFS bitmap is constructed as extents are allocated. Finally, we need to discuss IAM’s (Index Allocation Maps). These are critical as they map the extents in a database file used by the heaps (non-indexes tables), indexes (including clustered indexed tables) and blob objects (ntext, image, text pages). Each object has at least one IAM so long as: the object has data allocated the object did have data, but it was “deleted” rather than truncated. The IAM’s are linear linked lists and are scattered throughout the data file as the objects within it acquire space. If the file-group has more than one data file then remember that storage will be allocated evenly over the data files based on the total % free space in the data files, therefore IAM linked lists will span the physical data files within the logical file-group.
  • Oracle query: COL PRODUCT FORMAT A35 COL VERSION FORMAT A15 COL STATUS FORMAT A15 SELECT * FROM PRODUCT_COMPONENT_VERSION; PRODUCT VERSION STATUS ----------------------------------- --------------- ---------- NLSRTL 9.2.0.1.0 Production Oracle9i Enterprise Edition 9.2.0.1.0 Production PL/SQL 9.2.0.1.0 Production TNS for Solaris: 9.2.0.1.0 Production SQL Server 2000 - now at service pack 3
  • Section 7 - Pricing - More Detail Enterprise - more features than standard, often relating to managability and analytics for BI (business intelligence) SQL Server - Standard - one instance per license; Enterprise - as many instances on same server as you like Per Processor - flat fee, good for large number of users - compare to units pricing SQL Server - user and device CALs - cost is same per CAL To see SQL Server license type, use Query Analyzer (isql or wsql): select SERVERPROPERTY('LicenseType') select SERVERPROPERTY('NumLicenses')
  • FAT - file access table NTFS - NT file system Virtual Memory - 200 MB start, 400 MB max Source - Alexander Chigrik article mssqlcity.com
  • Windows 2003 Server - service pack 3 must be applied to SQL Server 2000 Analysis Services - 130 MB typical Source - Microsoft Web Pages
  • oradim.exe Create instance of the NT service svrmgrl / SQL*Plus To run our hand written DB script and run cat%.sql files to build dictionary. SQLNet Config Configure network connectivity and listener or Database Configuration Assistant (GUI) 1 Place binaries in ORACLE_HOME 2 Create 1 or more databases with script or GUI
  • Install is automated with wizard. Answer the questions to create database and instances. Wizard first creates “SQL Server 2000 Licensing Setup” on Settings-Control Panel Select PerSeat - enter # of CALs, or Processor - enter # of processors
  • 2 - redo logs on separate disks; RAID0 - striped, RAID 1 (mirror), RAID 10 mirrorred then striped, RAID0+1-striped then mirrored; control # rows in datablock 3 - Oracle Managed Files - automatically maintain tablespaces, redo logs, control files. Good for logical file systems - striped (RAID), and large, extensible files 4 - used for name and location of database in network structure. DB_NAME & DB_DOMAIN initialization parameters 5 - used at startup. Ex: spfile.ora - for Real Application Clusters - all instances use this
  • 6 - character set, alt char set, character superset if mult 7 - to include more time zones 8 - use rather than rollback segments; faster and managed for you User sys, system, create users 2 sets of privileges: sysdba - can create databases, be duplicate of sys user sysoper - everything but create databases, can’t see user data Startup/Shutdown;Alter database;Archivelog & Recovery;restricted session
  • Concept of Filegroup Be aware of SQL Server data striping. If you have two or more database files for a single file-group, SQL Server will automatically stipe data across these based on the percentage of free space with each data file. Tend to see very little IO activity around the master , msdb and model system databases. So place in one location. The tempdb database, used for temporary sort, group-by and other operations like the temp tablespace in Oracle, may need to be placed on its own array. The issue with the tempdb is its size and trying to justify its own disks (the minimum is typically 18Gb or 36Gb). A server with large amounts of RAM and very short transactions manipulating small amounts of data will rarely use the tempdb. As an example, Chris Kemper’s 2Gb production database with over 900 online users, 4Gb of RAM, sees the maximum tempdb of 800Mb.
  • 3 - Will you have named instance or default instance? 4 - As with Oracle installation under NT, the NT account you are using on installation is called the service account in which associated DBMS services and further installation and administrative tasks will occur under. In many cases (the quick and dirty method), the DBA will use the administrator account as it provides complete access to the server and its resources, reducing the possibility of any flow on issues related to the system privileges. Alternate way - create NT user, assign admin group priv, do install as new user, login as administrator, give new user exclusive rights to installed db, remove user’s admin group priv Windows 2000 - can set up encrypted file system for database and/or backup files
  • Authentication mode for the instance i. Mixed mode (windows and SQL Server authentication) ii. Windows authentication The Windows Authentication mode is the same as OPS$ (external Oracle authentication) only, and Mixed is both Database and Windows Authentication. Mixed mode will require you to enter the sa account password to complete mixed authentication, guard this login/password religiously, it is equivalent to the sys login with Oracle. The service account in which SQL Server is installed will be the Windows Authentication user, and you will be able to connect to the instance with no password (OS managed). The BUILTIN/Administrators SQL Server login will provide this seamless authentication via the equivalent OS group that can be removed to provide better security. I recommend Mixed Mode where possible with a complex SA password that is rarely used. This ensures that a DBA inadvertently locking themselves out when altering windows authentication privileges or server configuration is not a completely lost cause. To complete the installation, the setup will finally prompt you for the default server network (listener) properties and the supported network libraries that can be used. Thestandard libraries include named pipes and TCP/IP (a port of 0 equates to port 1433 or SQL Server will pick a random port on first ever connection and retain it). The named pipe will be \. pipeMSSQL[$] . The server will not be hidden from the network.
  • In SQL Server, one of the biggest problems related to overall system performance and stability is the poor handling of transactions, especially long running ones. Remember that it is critically important for your OLTP systems under SQL Server to keep transactions as short as possible to ensure blocking and lock escalation is kept to an absolute minimum.
  • undo is optional in 9i, Release 2 - users can still choose to use rollback segments if they want to. Also, the underlying technology has not changed with the introduction of Undo - Undo is nothing other than the DB managing the rollback segments instead of the DBA. DBA's can choose to retain that responsibility if they think it would be more beneficial, simply by the setting in the parameter file Oracle moving away from rollback segments within a rollback segment tablespace, to an undo tablespace with automatic undo management . At the start of a transaction, the DBMS assigns it a rollback segment and records the current SCN (last completed commit point). As the transaction continues with any variety of DML, the DBMS uses the rollback segment to: store before image of altered (updated or deleted) data, store newly inserted data, assist the DBMS in constructing a read-consistent view of the database objects as at the start of the transaction (defined by SCN). To do this, the DBMS will look up existing and other rollback segments to construct a read-consistent view. Programmer can start a transaction, issue a commit or rollback on it. The Oracle 9i flashback option requires AUM. For redo management. Oracle utilises two or more redo log groups, consisting of one or more physical files (members) per redo group. The redo logs store all changes (there are some variations to this) made to blocks in the buffer cache and are key for recovering committed data that has yet to be written to the actual database files. Within the Oracle DBMS, a checkpoint is a database event that synchronises altered data blocks in the buffer cache with the physical data files. The DBWR process on certain conditions, such as every 3 seconds, on a redo log switch or how full the buffer cache is with committed dirty buffers, manages the write event. The CKPT process will update the control file and data files to indicate the last completed checkpoint with the SCN (system change number). Oracle DBA has a lot of control over this.
  • The key to rollback and redo for SQL Server is the transaction log that is present in each database within the instance. The transaction log is a serial record of all transactions (DML and DDL) executed against the database and is used to store:a) start of each transaction b) before and after changes made by the transaction c) allocation and de-allocation of pages and extents d) commit and rollback of transactions e) all DDL and DML The transaction log itself consists of one or more physical database files, the size of the first must be greater than or equal to 512Kb in size. SQL Server breaks down the physical file into 2 or more logical transaction logs. The size of the file and its auto-growth settings will influence the number of virtual logs and their size. The DBA cannot control the number of or sizing of virtual logs. The log writer thread manages the writing of records to the transaction log. When the database is using a full or bulk-logged recovery model, the non-active portion of the log will only become “free” (can be overwritten) when a full backup or transaction log (archived log backup in Oracle) backup is executed. This ensures that recovery is possible if need be via the backup and the DBMS can happily continue and overwrite the now free log space. If the database is using the simple recovery model at a database checkpoint, any committed (and check pointed) or rollback transactions log space will become immediately free for other records to use. Therefore, point in time recovery is impossible. The checkpoint process is key to completing the committed transactions and writing the dirty buffers back to disk. In relation to the transaction log, this will:a) write log entry for the start of the checkpoint b) write the start LSN (log seq #)for the checkpoint chain to the database book record for subsequent recovery on instance failure c) write list of active (outstanding) transactions d) write all dirty log and data pages to disk e) writes a log file record marking the end of the checkpoint DBA cannot control checkpoint, other than recovery interval and mode. Automatic checkpoints occur: based on the recovery interval parameter and the number of associated log entries to fulfil the parameters setting. Database transaction log becomes >=70% full , Result of a manual CHECKPOINT, Selected DBCC commands are run, Backup command issued, Instance shutdown, offline database, read-only the database. NT service stopped
  • SQL Server - the locks are taken out against the database,and also against the master and tempdb databases. See Next Page: Oracle never escalates locks. The SQL Server locking schemes are completely automatic in context with the isolation level, with lock escalation as needed be to fulfill the request Where possible, SQL Server will start at the lowest granularity of locking and in terms of exclusiveness, then use a variety of other lock types at higher levels to pre-empt future intentions and escalations on the underlying object.
  • Locks: INTENT (I) – future intention to acquire other locks SHARED (S) – allows many concurrent reads, blocks updates until share is released, there is always 1 shared lock on the DB for the connection. UPDATE (U) – prior to data modification, is upgraded to exclusive on change EXCLUSIVE (X) – complete lock of the resource SCHEMA (Sch-[M,S]) – Schema modifications, DDL, schema stability lock BULK UPDATE (BU) – Bulk copy of data (bcp) with TABLOCK hint RANGE[I]_[S,U,X,N] – Key range lock, used in serialized transactions, covers index keys and the ranges of the index rows. Resources: RID Row Identifier PAGE Page (data or index) EXT Extent (8 contiguous pages, data or index) TAB Table IDX Index FIL File KEY Key (row lock with index) DB Database Status against a resource: GRANT Lock obtained WAIT Blocking due to another process CNVRT In processes of being converted (escalation)
  • Oracle includes the following lock types (may not be definitive): a) DDL a. Protect the schema objects and their definition. b) DML a. Ensures only one row can be updated at any one time. b. Objects cant be dropped whilst transactions are pending c. Row or table level i. TX – row level lock 1. readers do not wait for writers for the same data 2. writers not wait for readers (for update excluded) 3. writers wait for other writers over the same row 4. table level shared lock is also taken. ii. TM – table level locks 1. RS (SS) – row share 2. RX (SX) – row exclusive 3. SRX – share row exclusive lock 4. X – exclusive c) Latches d) Distributed (OPS) e) PCM (parallel cache management) used in the shared server configuration. The SQL Server programmer can alter the databases default isolation level on connect (ADO, OLEDB, ODBC property), T-SQL or via a SQL hint.
  • KEY locks are shown when the table has a clustered index rather than showing rowlocks. For non-clustered indexes the KEY locks exist for the leaf nodes. Locks may be retained until the transaction is complete; this is especially the case with shared locks over a repeatable read isolation level.
  • Transactions operate against a database of nine tables. Transactions do update, insert, delete, and abort;primary and secondary key access. Response time requirement: 90% of each type of transaction must have a response time  5 seconds, except stock-level which is  20 seconds. Tests included to demonstrate ACID properties met. Atomicity -Verify that all changes within a transaction commit or abort. Consistency Isolation ANSI Repeatable reads for all but Stock-Level transactions. Committed reads for Stock-Level. Durability Must demonstrate recovery from Loss of power Loss of memory Loss of media (e.g., disk crash)
  • We don’t know whether Microsoft tests are for Access or SQL Server, don’t know what hardware / Windows OS We don’t know version(s) of Oracle and hardware / OS
  • These results were on www.tpc.org on Jan 8, 2004 These configurations cost approx $5 million -multiply tpcC * cost per tpcC
  • The SQL Server 2000 configurations cost about $50K The Oracle configuration did not make the top ten for price / performance - it costs about $500K; no Oracle configurations shown were for Windows Operating Systems The real question is what configuration can an enterprise run on Vendors can choose to submit whatever configurations they want to TPC Organization The New-Order transaction response time set at 5 seconds. Therefore, for a 710 tpmC number, a system is generating 710 New-Order transactions per minute while fulfilling the rest of the TPC-C transaction mix workload. In general, TPC benchmarks are system-wide benchmarks, encompassing almost all cost dimensions of an entire system environment the user might purchase, including terminals, communications equipment, software (transaction monitors and database software), computer system or host, backup storage, and three years maintenance cost. Therefore, if the total system cost is $859,100 and the throughput is 1562 tpmC, the price/performance is derived by taking the price of the entire system ($859,100) divided by the performance (1562 tpmC), which equals $550 per tpmC.
  • Oracle Trace is a general-purpose data collection product and is part of the Oracle Enterprise Manager systems management product family. The Oracle server uses Oracle Trace to collect performance and resource utilization data, such as SQL Parse, Execute, Fetch statistics, and Wait statistics. UTLBSTAT,UTLESTAT,STATSPACK are PL/SQL routines and packages. You can use Oracle Trace to collect workload data for use in the Oracle Expert application While using Data Viewer, you can select one or more rows in the top portion of the Data View window to save to a file. When you choose SQL (SQL Analyze Format) from File/Save, a file containing query text is saved. You can then import this *. sql file into Oracle SQL Analyze for tuning of the selected statements. Oracle SQL Analyze can show you the execution plan for individual queries and let you experiment with various optimizer modes and hints. The Oracle server has been coded with Oracle Trace API calls to collect both SQL and Wait statistics with a minimum of overhead. Using the Oracle Trace Manager graphical user interface you can: Schedule collections. Filter collections by user. Filter collections by type of Wait event. Format collected data to database tables to preserve historical data. View SQL and Wait statistics using Oracle Trace Data Viewer.
  • Tracing database events and users sessions in SQL Server is done via the profiler utility. This is a powerful GUI tool that allows the DBA to: a) trace a range of database events a. including grouping of events and selectively picking data columns to be used b. apply filtering rules to further define the events you are after c. save output to a file (can set max size) or a database table (set max rows) and optionally enable trace stop time. b) edit and define trace templates c) replay saved traces (including break-points and stepping through a trace) d) scripting a trace e) running trace file results through the index wizard f) assist with auditing and of course performance tuning g) error tracing and blocking/locking detection
  • The SQL Trace facility and TKPROF let you accurately assess the efficiency of the SQL statements an application runs. For best results, use these tools with EXPLAIN PLAN rather than using EXPLAIN PLAN alone. Set Trace on through calls in PL/SQL. The EXPLAIN PLAN statement displays execution plans chosen by the Oracle optimizer for SELECT, UPDATE, INSERT, and DELETE statements. A statement's execution plan is the sequence of operations Oracle performs to run the statement. The row source tree is the core of the execution plan. It shows the following information: An ordering of the tables referenced by the statement An access method for each table mentioned in the statement A join method for tables affected by join operations in the statement Data operations like filter, sort, or aggregation In addition to the row source tree, the plan table contains information about the following: Optimization, such as the cost and cardinality of each operation Partitioning, such as the set of accessed partitions Parallel execution, such as the distribution method of join inputs
  • SQL Server automatically creates and updates query statistics on indexed columns (as long as automatic query statistic updating is not disabled). Additionally, statistics can be updated on nonindexed columns either manually, using SQL Server Query Analyzer or the UPDATE STATISTICS statement, or automatically, if the auto update statistics database option is set to true . Up-to-date statistics are not dependent upon date or time data. If no UPDATE operations have taken place, then the query statistics are still up-to-date. Microsoft SQL Server offers three ways to present information on how it navigates tables and uses indexes to access the data for a query: Graphically displaying the execution plan using SQL Server Query Analyzer In SQL Server Query Analyzer, click Query and select Display Execution Plan . After executing a query, you can select the Execution Plan tab to see a graphical representation of execution plan output. For more information, see "Graphically Displaying the Execution Plan Using SQL Server Query Analyzer" in this volume. SET SHOWPLAN_TEXT ON After this statement is executed, SQL Server returns the execution plan information for each query. For more information, see "SET SHOWPLAN_TEXT" in Microsoft SQL Server Transact-SQL and Utilities Reference . SET SHOWPLAN_ALL ON This statement is similar to SET SHOWPLAN_TEXT, except that the output is in a concise format. For more information, see "SET SHOWPLAN_ALL" in Microsoft SQL Server Transact-SQL and Utilities Reference .
  • On NT, use Microsoft’s Performance Monitor to examine CPU utilization - statistics on processor time, user time, privileged time, interrupt time, and DPC time. Performance Manager is part of Oracle Enterprise Manager Diagnostics Pack The Diagnostics Pack can automatically analyze this performance data, display it in a graphical interface, and use alerts to immediately direct you to any performance problems. You can be alerted automatically through email or page when a problem is detected. Oracle Enterprise Manager also includes an integrated diagnostics methodology that uses guided drilldowns and expert advice to help you quickly resolve performance issues
  • The DBA should take a “baseline” data collection using these counters. The interval may range from every five minutes to as little as every twenty seconds (ideally over a range of days). The collection is essential for ongoing performance monitoring, and performance tuning.
  • In SQL Server, we are somewhat restricted in terms of the types of indexes available when compared to Oracle, this may change over time but the time being we only have: a) Clustered indexes - Leaf nodes contain the actual row data pages b) Non-clustered indexes - Leaf nodes are pointers to row data pages, or, if the table also includes a clustered index then it will point to the clustered index leaf nodes (requires a bitmap lookup step in the execution plan). NOTE: If a table has a clustered index and non-clustered indexes, you must create clustered index first. Use clustered index for range queries, columns in order by and group by clauses, can only deframent online via clustered index c) Indexed Views - there are a number of restrictions for when a view can have an index
  • Clusters are groups of one or more tables that are physically stored together because they share common columns and usually are used together. Because related rows are physically stored together, disk access time improves. To create a cluster, use the CREATE CLUSTER statement. Create a clustered index for the entire cluster. Cluster tables that are accessed frequently by the application in join statements. Do not cluster tables if the application joins them only occasionally or modifies their common column values frequently. Do not cluster tables if the application often performs full table scans of only one of the tables. A full table scan of a clustered table can take longer than a full table scan of an unclustered table. Oracle is likely to read more blocks, because the tables are stored together. Cluster master-detail tables if you often select a master record and then the corresponding detail records. Detail records are stored in the same data block(s) as the master record, so they are likely still to be in memory when you select them, requiring Oracle to perform less I/O. Store a detail table alone in a cluster if you often select many detail records of the same master. This measure improves the performance of queries that select detail records of the same master, but does not decrease the performance of a full table scan on the master table. An alternative is to use an index organized table. Do not cluster tables if the data from all tables with the same cluster key value exceeds more than one or two Oracle blocks. To access a row in a clustered table, Oracle reads all blocks containing rows with that value. If these rows take up multiple blocks, then accessing a single row could require more reads than accessing the same row in an unclustered table. Do not cluster tables when the number of rows for each cluster key value varies significantly. This causes waste of space for the low cardinality key value; it causes collisions for the high cardinality key values. Collisions degrade performance.
  • Reverse Key Index Good for b-trees which have “hot” spots - An area where there are many insertions, tree becomes unbalanced. By reversing the keys of the index, the insertions become distributed across all leaf keys in the index. Using the reverse key arrangement eliminates the ability to run an index range scanning query on the index. Because lexically adjacent keys are not stored next to each other in a reverse-key index, only fetch-by-key or full-index (table) scans can be performed. Specify REVERSE in index creation command. Can later alter index to NOREVERSE.
  • Oracle supports the online creation or rebuilding of an index that works for partitioned or nonpartitioned B*-tree indexes, including index-organized tables. Since the table is not locked, DML operations and queries can execute on the base table while the index is being built. For Oracle: The ONLINE keyword may be specified on the CREATE INDEX or ALTER INDEX statement. The new COALESCE keyword may be specified to defragment the index
  • Don’t use with Rule-based optimizer Note: The cost-based optimizer is the one Oracle recommends You need statistics on the data in the tables to be gathered and stored in the data dictionary. Do this at regular intervals with DBMS_STATS. Statistics generated include the following: Table statistics Number of rows Number of blocks Average row length Column statistics Number of distinct values (NDV) in column Number of nulls in column Data distribution (histogram) Index statistics Number of leaf blocks Levels Clustering factor System statistics I/O performance and utilization CPU performance and utilization
  • Access the index-tuning wizard via query analyser. The wizard option is under the query menu option and is only available when a connection has been established to an instance and something has been entered into the query pane (even a space is enough), as the option remains greyed out until you do. The wizard works hand-in-hand with the traced output file from profiler or a manual trace via sp_trace. Select all tables, unless of you know for a fact that only a small number of the total tables in your schema are being used. The cool feature here is the projected column, in the example I have projected a growth of 80000 orders over the existing 830 currently in the table. On clicking Next the DBA is asked if the recommendations should be saved to disk and/or for them to be applied immediately or scheduled as a SQL*Agent job on the instance to be run later.
  • SQL Server Stored Procedures always keep record count when run. Can say SET NOCOUNT when in production for more speed. Extended stored procedures (DLL’s) are DLL’s written via the ODS (open data services) API (typically via C++). The associated stored procedure in the master database is a wrapper to the underlying DLL that is loaded and run in the same address space of SQL Server (the calling process). T-SQL does not have packages or concept of public and private routines
  • Real Application Clusters - Oracle Enterprise 9i: For Multiple Instance Systems. Some hardware architectures (for example, shared disk systems) enable multiple computers to share access to data, software, or peripheral devices. RAC takes advantage of such architecture by running multiple instances that share a single physical database. In most applications, Real Application Clusters enable access to a single database by users on multiple machines with increased performance. If you operate Oracle in ARCHIVELOG mode, then when a log file is full Oracle converts it to an archive log file before overwriting the log file with information. In Real Application Clusters, each instance automatically archives its own redo log files, or one or more instances can archive the redo log files for some or all of the instances in the cluster database. If you operate your database in NOARCHIVELOG mode, then you can only make offline backups. If you cannot afford data loss, then Oracle strongly recommends that you use ARCHIVELOG mode. A cluster database comprises two or more nodes that are linked by an interconnect. The interconnect serves as the communication path between each node in the cluster database. Each Oracle instance uses the interconnect for the messaging that synchronizes each instance's use of shared resources. Oracle also uses the interconnect to transmit data blocks that the multiple instances share. The primary type of shared resource is the datafiles that all the nodes access. The shared datafiles are on storage devices.
  • SQL Server 2000 Enterprise - Failover clustering is a process in which the operating system and application software work together to provide continuous availability in the event of an application failure, hardware failure, or operating-system error. Failover clustering provides hardware redundancy through a configuration in which other servers essentially act as clones of the main production system. Not meant for speed-up of the application. SQL Server 2000 is built on multiple instances , which allows SQL Server to simultaneously support up to 16 instances of SQL Server. SQL Server 2000 has extensive support for recovering from a failure of a node in the cluster. If a node fails it can be removed, reinstalled, and rejoined to the cluster. It is then a simple operation with SQL Server 2000 Setup to add the new server back into the virtual server definition. SQL Server 2000 running on Windows 2000 Datacenter Server supports up to four nodes in a cluster . Built on top of Windows Clustering of Windows 2000. Need heartbeat, external network, shared storeage devises. The heartbeat is a private network set up between the nodes of the cluster that checks to see if a server is up and running. This occurs at regular intervals known as time slices. If the heartbeat is not functioning, a failover is initiated and another node in the cluster will take over the services.
  • Federated Database - horizontally partition the data in a set of tables across multiple servers. The distributed partitioned view defined on Server1 is: CREATE VIEW Customers AS SELECT * FROM Customers_33 UNION ALL SELECT * FROM Server2.CustomerDB.dbo.Customers_66 UNION ALL SELECT * FROM Server3.CustomerDB.dbo.Customers_99 This view makes the actual location of the data transparent to an application. SQL Server 2000 partitioned views are updatable. This is crucial for distributing data so that the location of the data is transparent to the application. Updatable views support the full behavior of the original table; nonupdatable views are like read-only copies. The SQL Server 2000 query optimizer supports new optimizations that minimize the amount of distributed data that has to be transferred.
  • Each partition of a table or index must have the same logical attributes, such as column names, datatypes, and constraints, but each partition can have separate physical attributes such as pctfree, pctused, and tablespaces. Partitioning is useful for many different types of applications, particularly applications that manage large volumes of data. OLTP systems often benefit from improvements in manageability and availability, while data warehousing systems benefit from performance and manageability. CREATE TABLE sales_list (salesman_id NUMBER(5), salesman_name VARCHAR2(30), sales_state VARCHAR2(20), sales_amount NUMBER(10), sales_date DATE) PARTITION BY LIST(sales_state) ( PARTITION sales_west VALUES('California', 'Hawaii'), PARTITION sales_east VALUES ('New York', 'Virginia', 'Florida'), PARTITION sales_central VALUES('Texas', 'Illinois') PARTITION sales_other VALUES(DEFAULT) Improve processing speed, allow data to be operated on separately
  • In Oracle 9i, we see the release of the oracle redefinition PL/SQL package (DBMS_REDEFINITITION). The process basically allows the DBA to stage schema alterations, for the DBMS to track the changes and to cut them over to the “new” database structure with a simple command and very little downtime to the end-user (if any). This is a very powerful option that is covered in good detail in the article “Don't Shut Down That Database! Use Oracle 9i Online Object Redefinition Instead” There is no equivalent option in SQL Server.
  • With Oracle 9i, National Language Support is extended significantly, now called Oracle Globalisation Support. Previous NLS implementations could only support one national language and character set per database Now support many locales (languages, character sets, sort orders etc) loaded at runtime. This effectively means that single database instance implemented correctly can support error messages, sort orders, date/time, monetary, numeric and calendar conventions of any native language and locale, creating a truly “global” database. SQL Server 2000 has “Collation”. Each user login can be set to language. Collation can be set at database level, column level. Unicode. Can support multiple languages at once.
  • HOT - while database is running RMAN – Recovery Manager: no equivalent in SQL Server. Closest option is Database Maintenance Plans but these are simply wizards that generate scheduled jobs to make life much easier. RMAN is also in Oracle Enterprise Manager as a wizard Import/Export (full) – no equivalent. The best SQLServer has is database scripting (manually run) and BCP (bulk copy data). BCP - bulk copy utility Database Scripting - manual
  • Simple – transaction log (redo log) entries are truncated on completion of a checkpoint. Point in time recovery is not possible. Equivalent to non archived log mode in Oracle. Full – transaction log entries are retained and the log file will grow until the DBA backs up the transaction log and flushes the committed log data to disk (archived log mode in Oracle) Bulk Logged – as per full but selected commands are not fully logged (therefore not recoverable), these include select into, bcp and bulk insert, create index and indexed view creation, text and image operations (write and update text) . Do not alter recovery model properties for any system database. Set recovery model with SQL Server Enterprise Manager or SQL Statement For backups, SQL Server will create one media set per backup set. This means one physical disk file (media set) backup and inside it, a single log or full backup (backup set). It will NOT append backup sets to existing media. DATABASE MAINTENANCE PLAN wizard lets you set up the backup schedule Backup and restore history is stored in MSDB database. Remove old records periodically so a restore will run faster
  • It is important to understand the difference between a media set and a backup set . A physical backup device is the media set, within the media we can store one or more logical backup sets of one or more databases (typically its all the same database). In SQL Server, there is no single backup or recovery statement that will cover all databases within the instance. Consider doing the following: MASTER Full backups, nightly MSDB Full backups, nightly MODEL Full backups, nightly Full backups, nightly
  • The differential backup will backup all extents modified since the last full backup , and NOT the last differential. This is very important to understand, especially during recovery. The last differential backup done must be used on recovery; they are not cumulative as log backups are. This helps speed recovery. But can’t recover to a specific time. All must be recovered. In SQL Server, the differential backup will backup any 64Kb extent that contains an altered page within the database. Remember this when viewing the backup size of the media set as you may be surprised. The tracking is managed by the SQL Server storage engine using the DCM (differential change map) page present in each non-log data file. In Oracle, differential backups are known as differential incremental backups that are supported within RMAN and it is also possible to do cumulative database exports. A differential backup is not supported in Database Maintenance Plans (should change in the next version of SQL Server), therefore the DBA needs to resort to writing their own scripts. In many cases, full and log backups will suffice, but can slow the recovery process when applying large numbers of archived log files. This is where differentials can be used to speed the recovery process.
  • Transaction log backups are the same as archived redo log backups in Oracle. Remember that a transaction log exists for each database within the SQL Server instance and is a mandatory requirement for the database to exist. The log backup is supported via Maintenance Plans, making it very simple for the DBA to quickly set up full backups with scheduled log backups. Remember that the databases transaction log will continue to fill as committed and non-committed transactions execute against the database. The backup transaction log will write (archive in Oracle) all committed transactions to your selected transaction log backup file (an archived log). Y ou cannot selectively truncate transactions in the log file, it’s all or nothing.
  • Both ORACLE and SQLServer have log shipping. SQL Server Enterprise Edition has Wizard to ship transaction logs to another server - “warm” backup. Write two DTS packages on the primary server, one to do a full backup and the other a log backups. Perform steps necessary to keep standby server in ready mode - instance duplication, detect when primary goes down, constant connection, etc. Oracle - DATA GUARD (logs can also be manually configured and managed by DBA) By default, broker management of the primary database resource object is enabled in the online state with the log shipping turned on ( READ-WRITE-XPTON state), a physical standby database resource object is enabled in the PHYSICAL-APPLY-ON state, and a logical standby database resource object is enabled in the LOGICAL-APPLY-ON state. You can change the state of the database resource using the ALTER RESOURCE command, but not when the resource or a configuration is disabled.
  • Recovery in Oracle is either: a) manual via svrmgrl / sqlplus b) via RMAN c) via 3rd party product d) Enterprise Manager In SQL Server, we use variety of methods: a) rebuildm.exe (from setup CD for rebuilding the system databases) b) Enterprise Manager and its GUI wizards c) Query Analyser (GUI or command line version) d) SQL Server Service Control Manager SQL Server: Kill off user connections If Restore can’t fit on disk: SQL Server wants to restore the database files to the same size as at the time when they were backed up. There is no option to alter the physical file size (i.e. shrink) during the restore.
  • SMP - symmetrical multi-processing SQL Server Standard - 1 license for each instance SQL Server Enterprise - as many instances of same server as you want under single license Also, SQL Server has Developer Edition, Personal Edition
  • Enterprise - all of Standard features, plus: (1) Scalability (2) Availability/uptime (3) Performance (4) Advanced analysis 64-bit: Intel Itanium-based servers Fail Over Clustering - 32-bit: 4 nodes; 64-bit: 8 nodes Indexed Views - indexes placed on views 40 different languages OLAP - Online Analytical Processing - large OLAP cubes System Area Network (SAN) - Compaq ServerNet II, GigaNet cLAN
  • CALs - cheaper than CPU if <= 75 CALs for enterprise CAL - legal document only, device - per machine, cheaper whenever not all users log in at once CPU license - need license for each CPU in operating system instance running SQL Server. Cost effective when not all processors of a server are activated, or when multiple instances of SQL Server will run on a server accessing same processors With CALs: Enterprise - $7449 for server; Std - $789 for server + $146 per CAL Pricing Discounts from these retail numbers Windows Server pricing - more complex than shown: Windows 2000 server - 1 license for each SQL Server copy installed Windows Server 2003 - 1 license for each server; SQL Server Pack 3 or later must be applied Editions for: Developer, Personal, Windows CE (must also have developer + CALs), Evaluation
  • Get new versions of software as part of the assurance program Software payments can be spread over term of volume license agreement Problem resolution for server software Technet Concierge Chat Extends support for your version of software up to 2 years after end date of official Microsoft support Windows Source Code, not application source code Corporate Error Reporting - collects statistics and error messages for company, sends them to Microsoft
  • Oracle Fail Safe Configures and verifies Windows clusters and automatically fails over Oracle databases and applications. Flashback Query Recovers from from mistakes by restoring data prior to an erroneous transaction. Oracle Enterprise Manager Comprehensive management framework supports multiple, heterogeneous environments; includes centralized console for single point of management, real-time monitoring, and distributed database management. Oracle Text Adds powerful text search and intelligent text management; indexes any document or textual content to add fast, accurate retrieval. Open System Gateways Transparent access to data stored in heterogeneous non-Oracle distributed environments via SQL. Mainframe Integration Gateways Integrates the major types of mainframe-based data into an Oracle environment. Also, Oracle Personal Edition, Oracle Lite
  • Oracle Data Guard Creates, configures, and manages standby databases. Oracle Transparent Application Failover Ensures applications and users are automatically & transparently reconnected, queries continue uninterrupted, and login context is maintained. Virtual Private Database Restricts data access at the row level; supports fine-grained access control on tables, views, and synonyms. Database Resource Manager Enables the prioritization of database operations by applying system resources according to business priorities defined by the administrator. Oracle Streams Enables propagation and management of data, transactions, and events in a data stream within a database, or from one database to another. Oracle Partitioning Enhanced data management environment for OLTP, datamart, and data warehouse applications; adds significant manageability, availability, and performance capabilities to large underlying database tables and indexes.
  • Named User - requires #users times number of CPUs 2 CPUs and 25 users requires license for 50 named users
  • Named user minimums apply to options, too Internet Application Server - 10 named user minimum
  • This came from Oracle Web Partner Price List. Named Processor Update Support Update Support Std1 $29.25 $13.65 $899.25 $419.85 Standard $45 $21 $2,250 $1,050 Enterprise $120 $56 $6,000 $2,800 One study said Oracle’s support was 15% of license fee per year, plus 7% for phone support. Looks like upgrade is about 15% of license fee, support is 7% of license fee. 5-user: $975 * .15 = $146 25-user 1-CPU: ($800 + 25 * $195) = $5,675 * 15% = $851 Oracle contract says support won’t increase more than 4% annually
  • Total Cost of Ownership - Sum the costs over desired time horizon - expected useful life of system - 3 or 5 year horizon The lowest total cost of ownership is the winner Sometimes downtime will be the biggest dollar amount, so you are projecting something that is not really known.
  • Used a 5-year horizon, many assumptions
  • This came from Oracle Web Page comparing Oracle Support to Microsoft Referenced Input Market Research, but the link no longer existed. Search of Input w/ google search engine - article not found No way to get back to original costs and assumptions Data is already over 1 year old - that is old in this industry Conclusion: Go through your own scenario to calculate TCO
  • Oct 2002 (a little old) DM - Ora has more data cleansing and reduction, has 2 major data models - star + constellation. MS has all 3 (snowflake,too) BSp - MS has built-in reports for some vertical and horizontal areas. Ora has no verticals, but more horizontals DMA - Ora has advanced data mining+predictive analysis methods.MS-basic analysis ID - Ora has more personalized info deliv, graphical outline in gif,png,and jpeg. Adapters to some ERP,CRM,procurement,SCM sys. Con - MS - everything on Windows platform and in db. Ora uses 3 products - database, 9iAS application server, e-business suite Int - MS - IIS web service, .NET adapter Ora - Apache web serv, adapters to bus apps JDE,Psoft,SAP,Siebel; EJB, Corba, JCA adapter; can store data in XML Arch - MS - written in C++, only runs on Windows,COM and .NET integration, fault tolerant at web and app server level but not at component and session level - server failures can interrupt users. Ora - written in Java, extremely robust and scalable, load balancing, runs on Solaris, HP-UX, Unix, Linix, Windows 2000/NT. Many levels of fault tolerance. Glo - MS - not all tools are localized Cost - MS - $26K for test, ave deal $50k. Ora - $80K for test
  • Prev page pricing: MS - US$26,196 for the configuration tested, including: US$19,999, SQL Server 2000 Enterprise Edition single CPU. US$5,199, SharePoint Portal Server single CPU plus 5 CALs. US$179, Data Analyzer single user. US$570, Office XP single user. US$249, MapPoint single user. Oracle - US$80,000, including the database, application server, development suite, add-on packs, and Oracle E-Business Suite components. FUTURE: Yukon - enhanced failover clustering, Database Mirror System - 3 SQL Server systems of Principal, Mirror (transaction logs updating), Arbiter of which is Principal if failover; Online Index Operations; Online Restore; DBCC enhancements, incl checksum of pages; T-SQL enhancements to make more compatible w/ SQL ANSI-99; Security Enhancements; XML data types; Varchar(max) to 2GB; Snapshot Isolation to minimize read/write blocking; new table partitioning scheme for very large databases Oracle 10g - Application Server has enhanced caching, wireless and web capabilities; database - grid computing; automated management;
  • New Developments: Consolidation of Database vendors (Sybase, Progress, Informix) Offshore Outsourcing Security Various mobile computing advances - radio-frequency chips for inventory Microsoft .NET Framework Get training and certifications IT Implementation Small-to-medium business - integrated solution without large cash outlay USA Today Nov 2003 - Microsoft sells full ERP suite for $15,000, phase out Great Plains, lowers fees for Mastercard transactions Large businesses - business process integration across companies Implementation

Twin Cities Oracle Users Group Twin Cities Oracle Users Group Presentation Transcript

  • 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
  • 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
  • 1a - Instances
  • 1b - Memory Configuration Oracle SQL Server
  • 1c - Oracle Memory and Processes
  • 1c - Threads
  • 1c - Threads
  • 1d - Background Processes Oracle
  • 1e - File Structure
  • 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
    • Undo Tablespace in 9i
    • Redo Logs
    • Oracle
    • 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
    • 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
    Lock Types Resources Status
  • 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
  • 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 - TPC-C Results as of May 9, 1997
  • 4 - TPC-C Ver 5 Performance
  • 4 - TPC-C Ver 5 Price Performance
  • 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 - SQL Server Explain Plan
  • 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
  • 4 - SQL Clustered Index
    • Table rows are sorted in same order as Index
    • A table can contain only one clustered index
    • UPDATE and DELETE operations are often accelerated
    • Creating and Modifying Index Values causes Table to be Reorganized on Disk
    • Good for:
      • Retrieving many records at once from table
      • Getting a range of values
      • Columns with limited number of values
  • 4 - Oracle Clusters
  • 4 - Oracle Reverse-Key Index
    • Reverses the bytes of each column indexed (except the rowid) while keeping the column order
  • 4 - SQL Server Index and Table Fragmentation
    • Database Console Commands to use in T-SQL:
    • DBCC SHOW_STATISTICS
    • DBCC
    • UPDATEUSAGE([DBNAME,TABLE,INDEX])
    • DBCC
    • SHOWCONTIG([DBNAME,TABLE,INDEX])
    • DBCC DBREINDEX
    • DBCC INDEXDEFRAG - run online
  • 4 - Oracle Index Tuning Wizard
    • Use with Oracle cost-based optimizer
    • Part of Oracle Enterprise Manager Tuning Pack
    • Identifies tables in need of index changes
    • Presents its findings in reports
    • Allow you to automatically implement recommendations
  • 4 - SQL Server Index Tuning
  • 4 - Stored Procedures
    • Compiled Stored Procedures
      • Minimize Business Tier Activity
    • SQLServer2000 - Extended stored procedures (DLL’s)
  • 5 - Database Management
    • Oracle RAC
    • SQL Server 2000 Failover Clusters
    • SQL Server 2000 Federated Databases
    • Partitioned Tables
    • Online Object Redefinition
    • Globalization Services
    • SQL Loader / DTS
  • 5 - Oracle Real Application Clusters
  • 5 - SQL Server Failover Clustering
  • 5 - SQL Server Federated Databases
    • Distributed Partitioned Views
    • Union All of distributed tables across DBs
  • 5 - Partitioned Tables
  • 5 - Oracle 9i Online Object Redefinition
    • New in Oracle 9i:
    • oracle redefinition PL/SQL package DBMS_REDEFINITITION
  • 5 - Globalization Services
    • Oracle 9i - Globalization Services
      • Expanded National Language Support
    • SQL Server 2000 Collation
  • 5 - SQL Loader / DTS
    • Oracle SQL Loader - command line
    • SQL Server - use DTS Data Transformation Service Import / Export Wizard, or
    • bulk copy BCP command line tool
    • BULK INSERT DML command
  • 6 - Backup and Recovery
    • Backup
      • Hot / Online Backups
      • Differential Backups
      • Archived Log Backups
      • Log Shipping
    • Recovery
  • 6a - Backup: Oracle vs SQL Server
    • ORACLE SQL SERVER
    • Hot Backup All full backups are HOT
    • Full Backups HOT Full Backup
    • Differential Increment Same as Oracle
    • Backups
    • Archive Log Transaction Log
    • RMAN No Equivalent
    • Import/Export (full) Closest are: BCP
    • Database Scripting
  • 6a - SQL Server Recovery Models
    • Simple
      • MASTER
      • MODEL
      • MSDB
      • TEMPDB
    • Full
    • Bulk Logged
  • 6a - SQL Server Media
  • 6a - Differential Backups
    • SQL Server:
    • BACKUP DATABASE [mydb]
    • TO DISK = ‘e:dbbackupsmydb
    • mydb_20020624_full.bak’
    • WITH DIFFERENTIAL ,
    • INIT,
    • NAME = 'Differential Backup of MYDB on 06/24/2002’
  • 6a - Archived Log Backups
    • SQL Server - called Transaction Log
      • 1 Log for each database in an instance
      • Database must be set up to be full or bulk-logged recovery mode
    • BACKUP LOG [mydb] WITH
    • TRUNCATE_ONLY
  • 6a - Log Shipping
  • 6b - Recovery
    • Oracle
      • manual via sqlplus
      • via RMAN
      • Enterprise Manager
    • SQL Server
      • rebuildm.exe
      • Enterprise Manager
      • Query Analyzer
      • SQL Server Service Control Manager
  • 7 - Cost and Licensing
    • Sql Server 2000
      • Standard Edition
      • Enterprise Edition
      • Cost
    • Oracle 9i
      • Standard Edition
      • Enterprise Edition
      • Cost
    • Total Cost of Ownership
  • 7a - SQL Server Standard Edition
    • SMP to 4 CPUs, 2GB of RAM
    • Core functionality of e-commerce, data warehousing, line-of-business solns
    • Data Transformation Services (DTS)
    • Replication - snapshot,transactional,merge
    • Full-text search
    • English Query
    • Stored Procedure development tools
    • SQL Profiling and Performance Analysis Tools
  • 7a - SQL Server Enterprise Edition
    • Enterprise Edition - includes:
      • 32-bit: 32 CPUs and 64 GB RAM
      • 64-bit: 64 CPUs and 512 GB RAM
      • Distributed Partitioned Views
      • Log Shipping
      • Fail over Clustering
      • Indexed Views
      • Multi-language Capability
      • OLAP
      • Direct SAN support
  • 7a - SQL Server Pricing http://www.microsoft.com/sql/howtobuy/sqlserverlicensing.asp
    • Client Access License $146 per device or user
    • CPU License (Windows Server O/S license required):
      • Enterprise Edition $20,000 per processor
      • Standard Edition $5,000 per processor
      • SQL Windows
      • or Server 2003 Server
    • Server License requiring CALs: O/S
      • Enterprise w/ 25 CALs $11,099 $3,399
      • Standard w/ 5 CALs $1,489 $999
      • Standard w/ 10 CALs $2,249 $1,199
    • The above prices are full retail
  • 7a - SQL Server Support
    • New Software Assurance Program
      • Based on License price of product covered
        • Costs 25% per year for each server product
        • Costs 29% per year for each desktop product
      • Linked to your Microsoft Volume License Agreement
  • 7a - SQL Server Support
    • Features of Software Assurance Program
      • New version rights
      • Spread payments
      • Problem resolution support
      • Extended lifecycle hotfix support
      • Enterprise source licensing program
      • Corporate Error Reporting
      • eLearning
  • 7b - Oracle Standard DB
    • Std One - 1 processor, min 5 named users
    • Standard - Up to 4 processors
    • Oracle Fail Safe
    • Flashback Query
    • Java, XML, Globalization Support
    • Oracle Enterprise Manager
    • Oracle Statistics Management
    • Oracle Analytic Functions
    • Oracle Text
    • Gateways to other systems / applications
  • 7b - Oracle Enterprise DB
    • Minimum 25 named users +
    • Available Add-Ons:
    • Oracle Data Guard
    • Oracle Transparent Application Failover
    • Virtual Private Database
    • Database Resource Manager
    • Oracle Streams
    • Oracle Partitioning
    • Oracle Real Application Clusters
    • Oracle Diagnostics Pack
    • Oracle Tuning Pack
    • Oracle OLAP
    • Oracle Data Mining
  • 7b - Oracle 9i DB Pricing
    • CPU License
      • Enterprise Edition $40,000 per processor
      • Standard Edition $15,000 per proc (4 proc max)
      • Std Edition One $5,995 (1 processor only)
    • Licensing by Named Users w/ 1 processor:
      • Enterprise w/ min 25 NUs $20K ($800 * 25)
      • Standard w/ min 5 NUs $1,275 ($300 * 5)
      • Standard 1 w/ min 5 NUs $975 ($195 * 5)
    • Named User Price varies by Edition
  • 7b - Oracle 9i DB Pricing
    • Enterprise Edition Options (per processor)
        • Real Application Clusters $20,000
        • OLAP $20,000
        • Partitioning $10,000
        • Data Mining $20,000
    • Enterprise Manager Options
    • Development Tools
    • InterConnect Adapters
    • Application Server
  • 7b - Oracle 9i Support
    • Upgrade - 15% of license
    • Support - 7% of license
    • Support won’t increase more than 4%/yr
  • 7c - Total Cost of Ownership
    • Software Licensing and Support Costs
    • Hardware Purchase and Support Costs
    • Operations
    • Administration
    • Indirect Costs of
      • End-User Operations
      • Downtime
    • Affected by
      • Assumptions made
      • Changing hardware / software mix
  • 7c - Total Cost of Ownership
    • Example 1 - Magic Market Research, 2002
      • Assumptions:
        • 4-processor system
        • Only factor in known costs
        • 3 apps - Enterprise, Custom Web, and Business Intelligence
      • DB2 had lowest TOC
        • Then SQL Server 2000
        • Then Oracle
  • 7c - Total Cost of Ownership
    • Example 2 - Input Market Research 2002
      • Assumptions:
        • Packaged application environment
        • SQL Server DBA serves 684 users
        • Oracle DBA serves 3000+ users
      • Oracle had lower TOC per user
    • Cost Item Oracle SQLServer
      • License $29.54 $6.05
      • Consult/Impl 2.64 9.23
      • Support/Maint 34.51 102.43
      • Total $66.69 $117.71
  • Forrester Comparison - BI SQL Server 2000 Enterprise vs Oracle 9i Business Intelligence SQL Server Oracle 9i
  • The Future
    • New releases in 2004
      • Microsoft Yukon
      • Oracle 10g
    • How you benefit
  • What This Means
    • Stay aware of new developments
    • Be aware of strategic goals of your enterprise
    • Implement databases as part of entire IT integration strategy
  • Bibliography
    • SQL Server 2000 for the Oracle DBA by Christopher Kempster, 2003, Perth, Western Australia
    • The Heterogeneous DBA by Chuck Sudowsky, 2003, Irvine, CA, Quest Software
    • Database Software Trends Webcast, Oct 28, 2003, Irvine, CA, Quest Software
    • Oracle 9i Database Release 2 New Features Oracle Whitepaper, May 2002
    • Oracle 9i Database Release 2 on Windows: Development and Deployment, Oracle Whitepaper, May 2003
    • Oracle 9I: Developing with Microsoft .NET, Oracle Whitepaper, April 2003
    • DbForums - Oracle 9i vs MS SQL Server 2000 Technical Comparison by Kent Faulkner, USA, April 2003 (biased against MS)
    • Technical Comparison of Oracle 9i Database and SQL Server 2000: Focus on Performance, Oracle Whitepaper, June 2002
    • Database Architecture: Federated vs Clustered, Oracle Whitepaper, March 2002
    • Technical Comparison of Oracle 9i Database vs SQL Server 2000: Focus on Manageability, Oracle Whitepaper, Nov 2002
    • SQL Server 2000 vs Oracle9i - Alexander Chigrik Mar 30, 2003 - see link
    • http://www. mssqlcity .com/Articles/Compare/ sql _server_ vs _oracle. htm
    • Oracle9i Database Compared to SQL Server.htm Written by Oracle. Biased to Oracle.
    • Forrester Scorecard of Oracle 9I vs MS Sql Server 2000 - BI - Nov 2003
    • Microsoft SQL Server Web Pages - new features + pricing + Migrating Oracle Databases to SQL Server 2000
    • Oracle Partner Info - Oracle pricing, partitioning by CPUs
    • Oracle Pricing from Oracle 9i Partner e-page
    • SearchWin2000Info directory - June 2002 interview with Oracle vp: 9i vs SQL Server
    • + Interview with Microsoft vp: Oracle Isn’t All That Bad
    • TPC benchmarks - tpc.org
  • Questions and Answers
    • Architecture
    • Installation
    • Transactions and Record Locking
    • Performance Tuning
    • Database Management
    • Backup and Recovery
    • Cost and Licensing Arrangements