11.07.2015 Views

DB2 9 vs Oracle 10g Admin. Technology - IBM

DB2 9 vs Oracle 10g Admin. Technology - IBM

DB2 9 vs Oracle 10g Admin. Technology - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>IBM</strong> Software Group<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong> <strong>Admin</strong>. <strong>Technology</strong>2008-04-22<strong>IBM</strong> <strong>DB2</strong> Open Forum 3 rdVersion 2.0 Aug. 20, 2006Burt Vialpando & Vikram Khatri© 2008 <strong>IBM</strong> Corporation


Agenda<strong>DB2</strong> Information ManagementTopics<strong>DB2</strong> 소개 및 개요<strong>DB2</strong> 인스턴스 및 CLP<strong>DB2</strong> 데이터베이스<strong>DB2</strong> 백업 및 복구<strong>DB2</strong> HADR(High Availability Disaster Recovery)<strong>DB2</strong> 동시성<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 2


<strong>IBM</strong> Software Group<strong>DB2</strong> 소개및개요<strong>IBM</strong> <strong>DB2</strong> Open Forum 3 rd9 slides© 2008 <strong>IBM</strong> Corporation


제품 패키징비교<strong>DB2</strong> Information Management<strong>Oracle</strong>● <strong>Oracle</strong> Lite Windows CE, Palm, EPOC, Windows 95/98/NT● <strong>Oracle</strong> Personal Edition Windows● <strong>Oracle</strong> Standard Edition Windows CE, LINUX (2 dist.), AIX, HP-UX, HP Compaq, Solaris, Tru64● <strong>Oracle</strong> Enterprise Edition Windows CE, LINUX (2 dist.), AIX, HP-UX, HP Compaq, Solaris, Tru64 RAC is an optional purchase feature<strong>DB2</strong>● <strong>DB2</strong> Everyplace 9 Windows CE, Palm, EPOC, Windows XP/Tablet PC, QNX Neutrino, Symbian, eLinux, Linux on PC● <strong>DB2</strong> Express 9 Windows, Linux (200 dist.)● <strong>DB2</strong> Workgroup 9 Windows, Linux (200 dist.), AIX, HP-UX, Solaris● <strong>DB2</strong> Enterprise 9Windows, Linux (200 dist.), AIX, HP-UX, Solaris, Linux/390Database Partitioning Feature optional purchase DPF• Try DPF or extenders free with licensing update ability !<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 4


<strong>DB2</strong> Information Management<strong>DB2</strong> Express-C 9무료 라이센스 제공<strong>DB2</strong> Express-C 9 is:Production ReadyInnovative <strong>Technology</strong>Developer Friendly• Free to develop, deployand redistribute*• No database size limit• No limit on number ofinstances per server• No user limit* Free registration required• Same superior dataserver technology andprogramming support as<strong>DB2</strong> Express Edition in asmaller package<strong>DB2</strong> Edition Comparisons• Dedicated team for <strong>DB2</strong>community participation &development• Free online communitysupport• Skills & applicationsapplicable to all editionsof <strong>DB2</strong>Express 9/Express-C 9Workgroup 9 Enterprise 9• Linux & Windows,32 and 64-bit platforms• 1-2 CPU Server• 4GB Memory• Linux, UNIX & Windows,32 and 64-bit platforms• 1-4 CPU Server• 16GB Memory• Linux, UNIX & Windows,32 and 64-bit platforms• No limits• Partitioning feature<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 5


<strong>DB2</strong> Information Management동일한코드기반● 100% Common Code Base Pros & Cons A 100% common code base would• Allow for faster distribution of releases & fixes• Give a higher likelihood of identical functionality• Give similar installation procedure for all platforms A 100% common code base would not• Benefit from performance & functionality strengthsinherent to specific platforms● <strong>Oracle</strong> Solution <strong>Oracle</strong> develops on a few OS’s, then ports to others● <strong>IBM</strong> <strong>DB2</strong> Solution <strong>DB2</strong> data server has about a 90% common code base for LUW• Varying by about 10% for operating system & hardware differences• All supported OS versions for LUW released simultaneously <strong>IBM</strong> develops on the platforms it supports to optimize the code for them• Porting is not done <strong>DB2</strong> z-OS, iSeries and VM/VSE products are a different code base• Which take advantage of these platforms <strong>DB2</strong> end users & DBAs see little difference externally• Mostly for OS considerations Using DPF on LUW does not require a new code install<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 6


<strong>DB2</strong> Information Management툴및제품관리 & 개발 툴 & 제품<strong>Oracle</strong><strong>IBM</strong>Description of Usage<strong>Oracle</strong> <strong>10g</strong> Enterprise Edition• <strong>Oracle</strong> Enterprise Manager• Enterprise Login Assistant• Database ConfigurationAssistant• <strong>Admin</strong>istration Assistant• <strong>Oracle</strong> SQL PlusWorksheet• iSQL<strong>Oracle</strong> SQL Plus<strong>Oracle</strong> Net Config. Assistant<strong>Oracle</strong> SQL AnalyzeADDM<strong>Oracle</strong> Forms Developer<strong>Oracle</strong> Progress Monitor<strong>Oracle</strong> Procedure Developer• <strong>Oracle</strong> Spatial & Intermedia• <strong>Oracle</strong> Time Series• COM Cartridge<strong>DB2</strong> Enterprise 9• <strong>DB2</strong> Control Center• <strong>DB2</strong> Web Query Tool• <strong>DB2</strong> Recovery Expert• <strong>DB2</strong> High Performance Unload• <strong>DB2</strong> Performance Expert<strong>DB2</strong> Command Editor<strong>DB2</strong> Command Line Processor<strong>DB2</strong> Configuration Assistant• <strong>DB2</strong> Visual Explain• db2exfmt, db2expln<strong>DB2</strong> Event Monitor / Analyzer<strong>DB2</strong> Table Editor Developer Suite<strong>DB2</strong> Query Patroller(9.5 WorkloadManagement)<strong>DB2</strong> Developer Workbench• <strong>DB2</strong> Relational Extenders• <strong>IBM</strong> Content Manager (and familyof products which are many)Relational Database Management SystemGUI database master console, control,management, auto login, recovery, etc.GUI level line oriented & script savingdatabase accessOS level line oriented database accessNode cataloging & connecting, networkingQuery analysis & visual explainsDatabase event info. collection & analysisForms creation, development, usageQuery & session monitoringStored procedure & other object developmentImage searching, content management<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 7


<strong>DB2</strong> Information Management툴및제품통신 & 연결 툴 & 제품<strong>Oracle</strong>Files Online (iFS 8i)• <strong>Oracle</strong> TransparentGateway• <strong>Oracle</strong> Access Managersfor CICS, IMS, <strong>DB2</strong>• Advanced Replication• Message Broker• <strong>Oracle</strong> Streams• Internet Commerce Server• Internet Application Server<strong>IBM</strong>Data Links Manager• <strong>DB2</strong> Discovery Link• <strong>DB2</strong> Connect, <strong>DB2</strong> RelationalConnect• WebSphere Information Integrator• MQ Series• <strong>DB2</strong> Q Replication• <strong>DB2</strong> SQL Replication• WebSphere Portal Studio• <strong>IBM</strong> Enterprise Information PortalDescription of UsageFile system for Internet useFederationReplication, message queuingInternet servicing, connection<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 8


<strong>DB2</strong> Information Management툴및제품인터넷, 자바, 데이터 웨어하우징 & OLAP 툴 & 제품<strong>Oracle</strong>• JDeveloper• <strong>Oracle</strong> Designer• <strong>Oracle</strong> Portal (WebDB)• <strong>Oracle</strong> Objects• <strong>Oracle</strong> Data Mart Suite• Warehouse Builder<strong>Oracle</strong> Pure*IntegrateOne Meaning• <strong>Oracle</strong> Express Server• <strong>Oracle</strong> Express Objects• <strong>Oracle</strong> Discoverer• <strong>Oracle</strong> Reports• <strong>Oracle</strong> Data Mining Suite• <strong>Oracle</strong> Darwin<strong>IBM</strong>• Visual Age Family• WebSphere Studio• Net.Data• <strong>IBM</strong> Content Manager• <strong>DB2</strong> Data Warehouse Manager• <strong>DB2</strong> Data Propagator• <strong>IBM</strong> Data Refresher• WebSphere Inf. IntegratorVality IntegrityInformation Catalog• <strong>DB2</strong> OLAP Server• Data Warehouse Center• QMF• <strong>DB2</strong> Web Query Tool forMultiplatforms• <strong>DB2</strong> Intelligent Miner• <strong>DB2</strong> OLAP Server MinerDescription of UsageJava & web development & object modelingData Warehouse building , data movement,managementData cleansingMetadata sourcingOLAP, data marts, cubesReporting in all its formsData mining<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 9


<strong>DB2</strong> Information Management툴및제품<strong>DB2</strong> GUI 로드맵ConfigurationAssistant(db2ca)<strong>DB2</strong>DesktopFolderx<strong>DB2</strong>CommandWindow(db2cmd)<strong>DB2</strong>CommandLineProcessor(db2)CommandEditor(db2ce)AlertCenterVisualExplainReplicationCenter(db2rc)TaskCenter(db2tc)SmartWizards Guidesor WizardsActivityMonitor(db2am)ControlCenter(db2cc)HealthCenter(db2hc)JournalDevelopmentCenter(db2dc)Satellite<strong>Admin</strong>istrationCenterSQL AssistToolSettingsLicenseCenterDataWarehouseCenterFirst Steps(db2steps)xInformationFolder(db2ic)●●Tools that can be started from a command prompt show the command in parenthesisMost others are accessed through the Control Center & Command Center<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 10


<strong>DB2</strong> Information Management툴및제품– 타벤더예Quest Software Support of <strong>DB2</strong>Toad for <strong>DB2</strong>Toad for <strong>DB2</strong> simplifies database development and allows database developers to be more productive by providing anintuitive graphical user interface to <strong>DB2</strong>. With Toad, developers can use a single, industry-proven tool for both developmentand <strong>DB2</strong> object management.Quest Central for <strong>DB2</strong>Quest Central for <strong>DB2</strong> is an integrated suite of tools for managing <strong>DB2</strong> on Linux, Unix, Windows, and z/OS. Quest Centralprovides complete database administration, SQL tuning, space management, and performance diagnostics across all platformsfrom a single console.Quest SQL Optimizer for <strong>DB2</strong>SQL Optimizer for <strong>DB2</strong> UDB offers complete SQL performance optimization by proactively detecting inefficient SQL andautomatically rewriting and selecting best alternatives to maximize performanceKnowledge Xpert for <strong>DB2</strong>Knowledge Xpert for <strong>DB2</strong> is a comprehensive, Windows-based technical resource designed to give you quick access to expertadvice to solve common and complex management issues for <strong>DB2</strong> on z/OS and UDB for NT and Unix.Benchmark Factory®Benchmark Factory is a load testing solution that prevents unplanned downtime and slow performance by testing your system'slimits before you go live.DataFactory®DataFactory populates development, test and QA databases with millions of rows of meaningful, syntactically correct test data,providing you with a realistic view of application performance before going live.Foglight® Cartridge for Databases - <strong>DB2</strong>/UDBFoglight is a powerful console that monitors every tier in your critical application technology stacks, including databases,networks, application servers, process schedulers and Web servers, alerting you to problems before they impact end users.This cartridge provides 24x7 monitoring for complex <strong>DB2</strong>/UDB database environments.Spotlight® on <strong>DB2</strong>Spotlight® on <strong>DB2</strong> diagnoses <strong>DB2</strong> UDB and z/OS performance problems in real time by graphically displaying all databaseactivity in an intuitive user interface, enabling you to respond quickly to issues that need attention.<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 11


<strong>DB2</strong> Information Management<strong>DB2</strong> 개발 연구소Development 3,000+Sales / Mktg. 3,000+Partners 16,000+RochesterTorontoBoeblingenMenlo Park,Oakland,Portland,Silicon ValleyAlmaden ResearchDenverAustinSomersLenexaHawthorne ResearchYamato•Over 6,000 Strong WW•Data Management Research•Strong Partnering<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 12


<strong>DB2</strong> Information Management<strong>DB2</strong> HistoryOn Linux, Unix and Windows (LUW)V1.x 1993►►OS/2 and AIX platformLow-end OLTPV2.x 1995►►►►►Multiple platformsCapacity and performanceJDBCUDTs, UDFs, LOBsLow-end OLTPV5.x 1997►►►►SMP and MPP parallelismData Links ManagerSQLJInitial OLAP SQLV6.1 1999►►►►►<strong>DB2</strong> for Linux<strong>DB2</strong> Satellite EditionEase of UseEase of Application DevelopmentPerformanceV7.x 2000►►►►►►►►►Integration WarehousingIntegrated OLAPFederated databasesNative OLE DB ClientSpatial extenderXML extenderAbstract Data TypesSQL stored proceduresTPC-H LeadershipV8.1 2003, V8.2 2005►►►►►►►►Multidimensional ClusteringSMART technologyExpanded Linux supportOnline utilitiesAdvanced BI, CubeViewsTPC-C leadershipInformation IntegrationSAP OptimizationV9.1 2006, V9.5 2007►►►►Self Tuning MemoryAutomation automaticallyAdvanced SQLData Compression<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 13


<strong>IBM</strong> Software Group<strong>DB2</strong> 인스턴스 및 CLP<strong>IBM</strong> <strong>DB2</strong> Open Forum 3 rd25 slides© 2008 <strong>IBM</strong> Corporation


<strong>DB2</strong> Information Management<strong>DB2</strong> 인스턴스 개요● 인스턴스 = Database Manager● 인스턴스가 하는 일: 데이터베이스 메모리 사용을 위한 디폴트 값 - 예:• Utility impact limits• Sort, hash, Java and other “heap” limits and defaults 모니터링• Health• Snapshot 감사기능 진단 및 & 통지내용 로깅 연결 관리• User authentication• Communication protocols• Agents & pooling management• Transaction management (aka “sessions” in <strong>Oracle</strong>-speak) 연합데이터베이스 기능 제어 분산 트랜잭션 관리<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 15


<strong>DB2</strong> Information Management서버 프로세스 아키텍쳐The <strong>Oracle</strong> SID<strong>Oracle</strong> SIDParameterfileControlfilesPasswordfileArchivedlog fileDatafilesDatafilesDatabaseproddb1Redologfiles● An <strong>Oracle</strong> SID (or unique instance name) can 하나의 데이터베이스만 허용● 인스턴스 = 물리적인 구조를 액세스하기 위한 논리적인 메모리 구조● 데이터베이스 = 물리 구조● 인스턴스와 데이터베이스 용어가 동일하게 사용 그러나 기술적으로 다른 의미SET ORACLE_SID = inst1SQLPLUS> connect internalSQLPLUS> startup<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 16


<strong>DB2</strong> Information Management서버 프로세스 아키텍처The <strong>DB2</strong> InstanceCatalogLog<strong>DB2</strong> InstanceDatabaseproddb1DBconfigBufferPoolsCatalogLogDatabaseproddb2DBconfigBufferPoolsDBMconfig● A <strong>DB2</strong> instance can 하나 이상의 데이터베이스 허용 대부분 운영시스템은 하나의 데이터베이스 사용● A <strong>DB2</strong> instance is a logical access to The databases logical structures Then to the databases physical structures● In a <strong>DB2</strong> instance 프로세스는 데이터베이스들간 공유 인스턴스 구성변수(dbm cfg)가 모든 데이터베이스에 공유 각각의 데이터베이스는 각자의 데이터베이스 구성변수(db cfg)를 소유● <strong>DB2</strong> terms "instance" & "database" have distinct meanings & purposesSET db2instance = inst1db2start<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 17


<strong>DB2</strong> Information Management서버 프로세스 아키텍처<strong>Oracle</strong> Processes List (Not Exhaustive)P1P2P3P4LevelN/AProcessServerLGWRDBWn *PMONSMONMMANMMOMMMNLCKPTRECOARCn *SNPn *LCKn *Dnnn * &Snnn*RVWRCTWRASMQMNn *PurposeServer processes - Either dedicated or shared, performs requests for the clientLog Writer - Performs sequential writes from the redo log buffer in the SGA to the redo log file(s)Database writer - Writes the dirty buffers from the database buffer cache to the data file(s)Process monitor - Cleans up failed user processes and frees of resources of these processesSpace monitor - Space maintenance & crash recovery agentMemory Manager - SGA memory brokerMemory Monitor – AWR problem detection and self tuningMemory Monitor Light - Transfer statistics AWR collects to diskCheck point – Flushes modified data from the buffer cache to the disk and updates the control file and data filesby doing a header update (DBWn actually does the write)Resolve for distributed databases - (DISTRIBUTED_TRANSACTIONS mode)Archive log monitor - Writes logs to archive areas (in ARCHIVE LOG mode)Snapshot & job schedulerInter-instance locking - for multiple instances for one database (RAC mode)Dispatchers - for shared server, & Shared Sever processesRecovery Writer - Flashback supportChange Tracking Writer – RMAN supportAutomatic Storage Management - related processes are ASMB, ARB, RBALQueue monitor for advanced queuing•can be many<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 18


<strong>DB2</strong> Information Management서버 프로세스 아키텍처<strong>DB2</strong> Processes List (Not Exhaustive)P1P2P3P4LevelProcessPurposeLike?Instancedb2syscSystem controller - exists for the database server to functiondb2gdsGlobal daemon spawner - UNIX systems onlydb2wdogWatchdog - UNIX systems only, handles abnormal terminationPMON &SMONdb2resynRe-sync agent - scans the global re-sync listdb2cartInvokes user exits to archive or retrieve log files (Archive Log)db2dartPre-allocates log files for database with log retain set on (Archive Log)db2ipccmInter-process listener - handles local client programs (DPF)Serverdb2fcmdmFast communications manager daemon - handles inter nodal communication (DPF)db2pbcParallel system controller - handles parallel requests from remote nodes (DPF)db2tcpcm, &others *TCP/IP communication listener, & other listeners (depending upon which protocols arespecified in the <strong>DB2</strong>COMM variable)db2fmpHealth Monitor processMMMLDatabasedb2loggrLogger - manipulates log files to handle transaction processing & recoveryLGWRdb2dlockDeadlock detectiondb2uext2Archive log monitorARCndb2pfch0 *Pre-fetcherdb2pclnr1Page & buffer pool cleanerDBWn &MMMLApplicationdb2agent *Either a process or thread, depending upon the OSServer* can be many<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 19


<strong>DB2</strong> Information Management서버 프로세스 아키텍처<strong>DB2</strong> Process ModelP1P2P3P41. 클라이언트 프로그램은 리스너를 통해 Coordinator agent를 할당받음2. 연결 요청은 coordinator agent를 통해 이루어짐3. db2fmp는 fenced SPs / UDFs 실행<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 20


<strong>DB2</strong> Information Management메모리 구조<strong>Oracle</strong>PGAStackSpaceData BuffersSGALarge Pool(optional)Shared PoolLibrary CacheFixed SGAVariablesJava Pool (optional)Dictionary CacheParametersEventsSessionInfoEnqueuesFixed TablesControl StructuresSort AreaRedo BuffersState ObjectsStatisticsLatches• System Global Area (SGA) - 서버 프로세스간 통신, statement cache, redo log buffers, databuffer cache• Program Global Area (PGA) - 응용프로그램과 데이터베이스 간 통신• User Global Area (UGA) - user context & row-cached cursors<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 21


<strong>DB2</strong> Information Management메모리 구조<strong>DB2</strong>Database Manager Shared MemoryMonitor Heap mon_heap_sz Audit Buffer audit_buf_szDatabase Shared MemoryUtility Heaputil_heap_szbackbufszrestbufszbuffer poolLocklistsBuffer Poolsbuffpagebuffer pool buffer pool buffer poollocklistExtended Memory Cacheestore_seq_szShared Sort MemorydbheaplogbufszCatalogcatalog_cache_szpckcacheszLocal ClientApplication Global Memoryapp_ctl_heap_szRemote ClientAgent & AppSharedMemoryaslheapszagent_stack_szquery_heap_szAgent Private Memorystat_heap_szapplheapszsortheapdrda_heap_szudf_mem_szstmtheaprqrioblkApplicationSharedMemoryrqrioblk• Database Manager Shared Memory- 인스턴스 공유 메모리• Database Shared Memory - 데이터베이스 공유 메모리• Application Shared Memory - 응용프로그램 공유 메모리• Agent Private Memory - 에이전트 정보: sort heaps, cursor info & session contexts<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 22


<strong>DB2</strong> Information Management중요 파일들<strong>Oracle</strong> Manually HandledKey <strong>Oracle</strong> files● <strong>Oracle</strong> has a control file(s) which <strong>Oracle</strong> 복구에 필수 파일ControlParameter 하나 이상의 복사본을 관리filefiles 별도 백업 필요 Painstakingly maintained (e.g. ALTER DATABASE BACKUP CONTROL FILE TO ...)● <strong>Oracle</strong> has parameter files which인스턴스 시작을 위한 필수 파일OS버전에따라하나이상존재가능• 혼란 가능성별도 백업 필요 / painstakingly maintained재 생성 가능하나 번거로움<strong>Oracle</strong> 9i does have a new "server parameter file" (SPFILE) option... are you using it?• Still requires a PFILE for database creation● <strong>Oracle</strong> has a security (password) file which리모트 데이터베이스 관리를 위한 파일OS에 따라 하나 이상의 버전이 존재 가능 – 혼란 가능성별도 백업 필요 / painstakingly maintained재생성가능Securityfile<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 23


<strong>DB2</strong> Information Management중요 파일들<strong>DB2</strong> Automatically Handled● 각 데이터베이스 당 Control 및 parameter 파일들이 존재함 데이터베이스의 스스로 자동 다중관리:• SQLBP.1 & 2 (buffer pool info)• SQLSPCS.1 & 2 (table space info)• SQLOG* (log control files)• SQLDBCON & F (db configuration)• db2rhist.asc & .bak (recovery history file) Backup명령에의해자동백업됨. Restore / Recover 명령에 의해 자동 복구됨● 별도의 백업 가능 dbm cfg 파일(“db2system”) (or the entire subdirectory it is in) Registry 파일 (db2set)● <strong>DB2</strong> 가정 - 설치및관리자 기본적으로 쉬운 유지관리를 하도록 기술력과 OS에 대한 지식이 그다지 높지 않아도 가능하게 나중에 원하는바 대로 조정하고 보다 복잡하게 구성하도록<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 24


<strong>DB2</strong> Information Management<strong>Oracle</strong> 디렉토리 구조Windows Example (Using OFA)\oracleORACLE_BASE\productProduct directory\10.1.0ORACLE_HOME\admin\mydb1Database\bdump\cdump\create\pfile\db_1\udump\network\bin\adminsqlplus.exesqlldr.exerman.exe, etclistener.oratnsnames.orasqlnet.ora,etc.<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 25


<strong>DB2</strong> Information Management<strong>DB2</strong> 디렉토리 구조Windows Example\<strong>DB2</strong>Instance Name\node0000Partition number (note: in ESE non DPF databases are a single node implementation)\sql00001Database ID\SQLOGDIR\SQLT0000.0\SQLT0001.0\SQLT0002.0Default LOG directorySYSCATSPACE table space (always created)TEMPSPACE1 table space (always created)USERSPACE1 table space (always created)\program files\mysmsts\mydmsts.datSQLTAG.NAM. This file marks the subdirectory as being in useSQL*.BKM (contains block allocation information if it is an MDC table)SQL*.LF (contains LONG VARCHAR or LONG VARGRAPHIC data)SQL*.LB (contains BLOB, CLOB, or DBCLOB data)SQL*.LBA (contains allocation and free space information about SQL*.LB files)SQL*.INX (contains index table data)SQL*.IN1 (contains index table data),etc.\<strong>IBM</strong>\sqllibdb2start.exedb2stop.exedb2cmd.exe, etc.<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 26


<strong>DB2</strong> Information Management환경 / 레지스트리 변수● <strong>Oracle</strong> 환경변수Variableora_cwdora_sid_pfileoracle_homeoracle_sidoracle_basenls_langrdbms_archiverdbms_controlsqlpathFunctionCurrent <strong>Oracle</strong> directoryPath to init.ora fileEnvironment where products runDefault Instance (SID)Root of the <strong>Oracle</strong> directory treeLanguage, character & territory setLocation of backup database filesLocation of backup database control filesLocation of SQL scripts● <strong>DB2</strong> 환경변수Use of the <strong>DB2</strong> profile registry allows for changes without a system rebootUse db2set or use the Configuration Assistant<strong>DB2</strong> environment variables (OS controlled) are: db2path, db2instanceVariabledb2adminserverdb2commdb2includedb2instance (e)db2instdefdb2ownerdb2slogondb2path (e)db2systemFunctionSpecifies which instance runs the admin. serverStarted communications managerPath to include in SQL searchesCurrent instanceDefault instanceInstance owning machineEnables secure logonDirectory where product is installedServer name id<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 27


<strong>DB2</strong> Information ManagementINIT.ora 와 <strong>DB2</strong> 파라미터• <strong>DB2</strong>는 50개 이상의 변수가 변경 즉시 반영됨 !<strong>Oracle</strong> <strong>10g</strong>init.ora parmcontrol_filesdb_nk_cache_sizedb_block_buffersdb_block_checkingdb_block_checksumdb_create_online_log_dest_ndb_block_sizedb_filesdb_keep_cache_sizedb_recycle_cache_sizedb_namedb_writer_processes<strong>DB2</strong> 9 Equivalentno equivalent parm neededno equivalent parm neededno equivalent parm neededsee: buffpageno equivalent parm neededno equivalent parm needednewlogpathnpagesizemaxtotfilopno equivalent parm neededno equivalent parm neededno equivalent parm needednum_iocleanersCommentsSQLBP.1, SQLSPCS.1, SQLOG*, SQLDBCON, db2rhist.asc. Multiplefiles in <strong>DB2</strong> perform this functionality.Create as many buffer pools as you want of any page sizeSame as above. If no buffer pools are created then use buffpage db cfgparm.<strong>DB2</strong> uses consistency bits to maintain page level integrity. Thisperforms better then checksum page checking. Cannot be turned off.Same as above.Specifies where to change the log files location. db cfg parm.Defined when database is created.Maximum open files. dbm cfg parm.To have data pages kept in memory, create a buffer pool specifically fortables you want to pin.<strong>DB2</strong>'s buffer pool algorithm is more advanced (not just LRU) so youdon't need to specify recycle pools.With <strong>DB2</strong> the database name is defined with create database commandand not by a config parm. You can see the name (and provide aliasesfor that name) with the db2 catalog command and/or the db2 listdatabase directory command.Number of asynchronous page cleaners. db cfg parm.<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 28


<strong>DB2</strong> Information ManagementINIT.ora <strong>vs</strong>. <strong>DB2</strong> Parameters(Continued)dml_locks<strong>Oracle</strong> <strong>10g</strong>init.ora parmjava_pool_sizelocal_listenerlog_archive_destlog_bufferlog_checkpoint_intervaloptimizer_*parallel_max_serversessionsshared_pool_sizesort_area_sizehash_area_sizeuser_dump_dest<strong>DB2</strong> 9 Equivalentno exact equivalent -see: locklist & maxlocksjava_heap_szsvcenamedb2commlogarchmeth1logbufszsoftmaxno exact equivalent -see: dft_queryoptdft_degreemaxcagentsno exact equivalent -see: dbheapno exact equivalent -see: sortheapdiagpathComments<strong>DB2</strong> locks are held in memory & are a set of db cfg parms for sizing thislock information.dbm cfg parm.Specifies the port <strong>DB2</strong> will listen on. dbm cfg parm.You must also specify the protocol as a registry variable.db cfg parm.Specifies the size of the log buffer. db cfg parm.Checkpointing. db cfg parm.The <strong>DB2</strong> optimizer is fully cost based so there are no system levelmodes. The one exception is the dft_queryopt db cfg parm whichindicates how much optimization <strong>DB2</strong> should do.Specifies the degree of parallelism to use if you want to override <strong>DB2</strong>sautonomics. db cfg parm.Maximum number of concurrently connected applications. dbm cfgparm.No shared pool in db2. The closest parm would be the dbheap db cfgparm.<strong>DB2</strong> has a global size for all sorts and hash joins using sortheap db cfgparm.Path to diagnostic dump data. dbm cfg parm.<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 29


CLP 모드<strong>DB2</strong> Information Management● CLP는 3가지 모드 지원ModeCommandBatchInteractiveNoted ByOS prompt, prefaced with a db2 before each commandOS prompt, db2 and an -f option to designate the input fileCLP prompt, default of which is db2 =>● The command mode Is invoked from an OS shell window with db2cmd [return]• db2cmd.exe is an extension of the Windows OS shell Invokes OS commands directly Invokes <strong>DB2</strong> commands with db2 “db2-command”● The batch mode Is like running Command Window commands en-masse● The interactive mode Is invoked from the Command Window with db2 [return] Requires a ! to invoke OS commands<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 30


<strong>DB2</strong> Information ManagementCLP 도움말C:\ db2 ?db2 [option ...] [db2-command | sql-statement |[? [phrase | message | sqlstate | class-code]]]option: -a, -c, -e{c|s}, -finfile, -lhistfile, -o, -n, -p, -rreport, -s,-t, -td;, -v, -w, -x, -zoutputfile.db2-command:ACTIVATE DATABASE GET/UPDATE DB CFG RECONCILEADD CONTACT GET/UPDATE DBM CFG RECOVERADD CONTACTGROUP GET DBM MONITOR SWITCHES REDISTRIBUTE DB PARTITION……etc.,GET CONTACTGROUPS QUITGET CONTACTS REBINDUPDATE MONITOR SWITCHESNote: Some commands are operating system specific and may not be available.For further help:? db2-command - help for specified command? OPTIONS - help for all command options? HELP - help for reading help screensThe preceding three options can be run as db2 from an OS prompt.!db2ic - <strong>DB2</strong> Information Center (Windows only)This command can also be run as db2ic from an OS prompt.C:\ db2 ? sql0100 [this is an example of an SQL “message” help request]Tip:“db2 ? help” helps youread and use helpscreens-----------------------------------------“db2 help” launches theInformation Center<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 31


CLP 옵션<strong>DB2</strong> Information Managementdb2 => list command optionsCommand Line Processor Option SettingsBackend process wait time (seconds) (<strong>DB2</strong>BQTIME) = 1No. of retries to connect to backend (<strong>DB2</strong>BQTRY) = 60Request queue wait time (seconds) (<strong>DB2</strong>RQTIME) = 5Input queue wait time (seconds) (<strong>DB2</strong>IQTIME) = 5Command options (<strong>DB2</strong>OPTIONS) =Option DescriptionCurrent Setting--------- ---------------------------------------------- ---------------------a Display SQLCA OFF-c Auto-Commit ON-e Display SQLCODE/SQLSTATE OFF-f Read from input file OFF-l Log commands in history file OFF-n Remove new line character OFF-o Display output ON-p Display interactive input prompt ON-r Save output to report file OFF-s Stop execution on command error OFF-t Set statement termination character OFF-v Echo current command OFF-w Display FETCH/SELECT warning msgs ON-x Suppress printing of column headings OFF-z Save all output to output file OFFdb2 => update command options using c OFF [turns this off]db2 => set <strong>DB2</strong>OPTIONS=+c [Windows alternative for the same thing]db2 => export <strong>DB2</strong>OPTIONS=“+c” [UNIX alternative for the same thing]Tip:Leaving the interactive modeturns off your db2option settings!-------------------------------------------“? options” is different from “listcommand options”-------------------------------------------Many db2option switches can betemporarily overridden in a batchmode<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 32


<strong>DB2</strong> Information ManagementCLP History 및 runcmd 명령● Command history [reverse] [n] displays the last commands cached 20 ascending is default display and 20 is the default cached Set db2_clp_histsize registry variable to change cache size● runcmd runs the numbered command from the history cache● These ONLY work in interactive modedb2 => historydb2 => history1 connect to sample2 list command options3 select * from sysibm.sysdummy1…20 select * from customerdb2 =>db2 => runcmd 3db2 => runcmd 3<strong>IBM</strong>REQD-------------Y1 record(s) selecteddb2 =><strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 33


<strong>DB2</strong> Information ManagementCLP Command 창배치 모드 사용 예● Batch or shell files can execute saved <strong>DB2</strong> command files● These can produce yet other output files for various purposes● Here is a “Generate RUNSTATS commands” example–x to suppress column headings–td to set the end of command delimiter as @–f to indicate input file name–z to indicate output file nameCLPxmp01.batdb2 connect to sampledb2 -x -td@ -f CLPxmp01.db2 -z CLPxmp01OUT.txtdb2 commit workdb2 connect resetCLPxmp01.db2select 'RUNSTATS ON TABLE'||rtrim(tabschema)||'.'||tabname||‘ON ALL COLUMNS ALLOW WRITE ACCESS;'from sysstat.tableswhere card = -1@CLPxmp01OUT.txtRUNSTATS ON TABLE SYS<strong>IBM</strong>.SYSVIEWSON ALLCOLUMNS ALLOW WRITE ACCESS;RUNSTATS ON TABLE SYS<strong>IBM</strong>.SYSVIEWDEPONALL COLUMNS ALLOW WRITE ACCESS;… etc., etc.<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 34


<strong>IBM</strong> Software Group<strong>DB2</strong> 데이터베이스<strong>IBM</strong> <strong>DB2</strong> Open Forum 3 rd14 slides© 2008 <strong>IBM</strong> Corporation


<strong>DB2</strong> Information ManagementDatabase 관리유사한 함수 및 용어● 주요 관리 함수 및 용어 기본적으로 동일 Different enough to miss when new to <strong>DB2</strong><strong>Oracle</strong> 함수/용어Alert LogArchive Redo LogAutoextendData DictionaryData CacheDbms_repairDump datafile #block#(ALTER SYSTEM)Enable Restricted & Quiesceinit.ora *Materialized View (Snapshot)Statement Cache<strong>DB2</strong> 함수/용어<strong>DB2</strong>Diag Log<strong>Admin</strong>istration Notification LogArchive LogAutoresizeSystem CatalogBuffer poolInspectdb2dartQuiesceDBM config (instance)DB config (database)Materialized Query TablePackage Cache* <strong>Oracle</strong> 9i supports a "server parameter file" maintained by the <strong>Oracle</strong> engine<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 36


<strong>DB2</strong> Information ManagementDatabase 관리Dictionary 와 Catalog● <strong>Oracle</strong> Dictionary 와 <strong>DB2</strong> System Catalog 내용<strong>Oracle</strong> Data Dictionary 내용SYS.xxxx$- Base TablesSELECT table_name FROM user_tablesSELECT view_name FROM user_viewsSYS.GV_$ or GV$SYS.V_$ or V$ALL_%DBA_%USER_%-System Views<strong>DB2</strong> System Catalog 내용SYS<strong>IBM</strong>Base tablesSYSCAT- Read-only views- Defined for catalog base tablesSELECT name FROM sysibm.systables WHERETYPE="T" and CREATOR=userSELECT name FROM sysibm.systables WHERETYPE="V" and CREATOR=userSYSSTAT- Updateable views- For access path manipulation<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 37


<strong>DB2</strong> Information Management물리 데이터베이스 저장 모델스토리지 구조● <strong>Oracle</strong>과 <strong>DB2</strong>는 물리 데이터베이스 구조가 거의 비슷함 Below shows the slight differences in concept & semantics<strong>Oracle</strong> 스토리지 구조<strong>DB2</strong> 스토리지 구조DatabaseDatabaseTable spaceDatafileTable spaceContainerSegmentObjectExtentExtent<strong>Oracle</strong> BlockOS Page<strong>DB2</strong> PageOS PageLogicalPhysicalLogicalPhysical<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 38


<strong>DB2</strong> Information Management물리 데이터베이스 저장 모델테이블 공간 타입<strong>Oracle</strong> 테이블 공간 타입● System● Non-System Temporary• Dictionary Managed• Locally Managed Permanent• Dictionary Managed• Locally Managed (default) Transportable Undo<strong>DB2</strong> 테이블 공간 타입● Database Managed (DMS) Regular Temporary (system & user) Large● System Managed (SMS) Regular Temporary (system & user)<strong>Oracle</strong> Table Space Storage 설정INITIALNEXTMINEXTENTSMAXEXTENTSPCTINCREASEFREELIST/GROUPS<strong>DB2</strong> Table Space Storage 설정PAGESIZEEXTENTSIZEPREFETCHSIZEOVERHEADTRANSFERRATEBUFFERPOOL<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 39


<strong>DB2</strong> Information Management물리 데이터베이스 저장 모델<strong>DB2</strong> 테이블 공간 생성● <strong>DB2</strong> Table Space Creation Only SYSADM & SYSCTRL authorities can perform this Only created & active buffer pools may be used in a CREATE TABLESPACE command Buffer pools are dynamic & take immediate affect when added, dropped or altered DFT_PREFETCH_SZ can be set to let <strong>DB2</strong> calculate optimal prefetching for your environmentCREATE [ REGULAR / LARGE / TEMPORARY ]TABLESPACEtablespacenamePAGESIZEintegerMANAGED BY [ AUTOMATIC STORAGE][ SYSTEM / DATABASE ][ system-container / database-container ]EXTENTSIZE [ number-of-pages / integer ]PREFETCHSIZE [ number-of-pages / integer ]BUFFERPOOLbufferpool-nameOVERHEADnumber-of-milisecondsTRANSFERRATE number-of-milliseconds…AUTORESIZEYES…● To review information on these use LIST TABLESPACES [ SHOW DETAIL ] LIST TABLESPACE CONTAINERS FOR X [ SHOW DETAIL ] Or use Control Center GUI, or SYSCAT.TABLESPACES catalog view<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 40


<strong>DB2</strong> Information Management물리 데이터베이스 저장 모델<strong>DB2</strong> Container Types For DMS & SMSDMS - Database ManagedSMS - System ManagedFile Device Directory/database/tablespace/prod1● DMS is for database managed table spaces Basically what all <strong>Oracle</strong> table spaces translate to Recommended for larger more often used table spaces Supports automatic resizing and automatic storage similar to <strong>Oracle</strong>● SMS is for system managed table spaces Only <strong>DB2</strong> has the option to use this type of table space Recommended for smaller, less used tables paces• For ease of maintenance Operating system controlled• No database alterations possible to the container(s) More containers can be added to it with a redirected restore<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 41


<strong>DB2</strong> Information Management물리 데이터베이스 저장 모델<strong>DB2</strong> Striping<strong>DB2</strong> Table Space~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~alter to add newContainer Stripe Set 0Container Stripe Set 1● <strong>DB2</strong> does automatic striping of data among the containers in a table space You just make sure containers fall on different mount points You set PREFETCHSIZE for a table space setting to maximize striped reads & writes Or use block based buffer pools● <strong>DB2</strong> does automatic rebalancing of the data between containers when New DMS containers are added to a table space Rebalancing can be avoided during table space alter by• Use of ALTER TABLESPACE ... BEGIN NEW STRIPE SET• With "policy" regulation to control impact on performance<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 42


<strong>DB2</strong> Information Management물리 데이터베이스 저장 모델<strong>DB2</strong> 행 압축● Dictionary 기반 - symbol table for compressing/decompressing data records Lempel-Ziv (LZ) based algorithm (static dictionary based) Dictionary per table stored within the permanent table object● 데이터는 페이지에 압축 저장 On table space disk – I/O 비용 절감 In buffer pools – 메모리 절감● Insert/Update/Import/Load 시 항시압축됨 Does not compress rows where no storage saving is realized for that row● 약간의 CPU 비용 추가 Rows must be decompressed before being processed for evaluationNameDeptSalaryCitySTZipBurtsmpo100000DallasTX75063Viksmpo500000DallasTX75063Burtsmpo100000DallasTX75063Viksmpo500000DallasTX75063Etc…Dictionary(01)smpo(02)Dallas, TX, 75063Burt(01)100000(02)Vik(01)500000(02)Etc……Etc …<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 43


기타관리 상 차이<strong>DB2</strong> Information Management<strong>DB2</strong>Dynamic bitmap indexing엔진 스스로 필요한 시기에 메모리에 자동으로 생성Buffer pool per table space테이블공간 당 각자의 버퍼풀 할당 가능동일한 테이블공간이라 하더라도 다른 버퍼풀 사용가능Optimizer는 다양한 정보에 의해 판단● Query optimization class● SubcommandsOPTIMIZE FOR n ROWSFETCH FIRST n ROWS ONLY● Registry variables● Volatile table● Informational constraints● Selectivity clause● Optimization profiles<strong>Oracle</strong>Static bitmap indexingDBA가 만들고, 일반 인덱스와 동일하게 관리Cache (buffer pool) per block sizeblock size별로 Cache 할달 가능Optimizer가 한정된 정보에 의해 판단● Hints● Environment variablesVersion 7부터 비용기반 지원<strong>10g</strong>에서는 Rules based가 지원되지 않음Version1부터 비용기반의 Optimizer<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 44


<strong>DB2</strong> Information Management기타관리 상 차이 (계속)<strong>DB2</strong>True schema support사용자와 무관하게 Schema가 존재가능. 데이터베이스내 또는 데이터베이스 간 손쉽게 이동 가능Packaged codeStatic access path를 위한Pacakge정보를 카탈로그테이블에 보관됨.Unrestricted parallel DML모든 Query, Utility, RI Cascade, Triggers, LOB처리 시병렬 처리 지원Optimizer aware of extenders.NET 과 Spatial 정보에 대한 최적화 지원Federated Object 최적화 지원True row compressionLoad/Import/Insert되는 모든 행이 압축됨행레벨및칼럼레벨압축<strong>Oracle</strong>User schema supportSchema를 생성하기 위해서는 User가 먼저생성되어야 함No packaged code<strong>Oracle</strong>은 Static Access Path를 보관하지 않음Restricted parallel DMLRI cascase, Triggers, LOB처리시제약사항이있으며, DML의 병렬처리는 partitionedtable일때만 지원Optimizer not aware of extenders최적화 미지원Initial column only compression<strong>Oracle</strong>은 direct path loader에만 지원.변경된 행에 대해서는 후에 ALTER … MOVE명령으로 재압축 필요.칼럼 레벨 압축<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 45


<strong>IBM</strong> Software Group<strong>DB2</strong> 백업및복구<strong>IBM</strong> <strong>DB2</strong> Open Forum 3 rd28 slides© 2008 <strong>IBM</strong> Corporation


<strong>DB2</strong> Information Management아키텍처 비교컴포넌트<strong>Oracle</strong><strong>DB2</strong>Data Files(Data Blocks)Control Files,List BackupData Files(Data Pages)RecoveryHistory FileRMANBackup /RestoreRedo LogsParameterFilesUndoSegmentsRecoveryLogs<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 47


<strong>DB2</strong> Information Management아키텍처 비교<strong>DB2</strong> 제어센터로깅구성Wizards●효과적인 학습 툴●GUI 도구에서 로깅설정을 위한 명령어를자동 생성하여 실행Screens walk you throughlogging setup●<strong>DB2</strong> 로깅을 위해추가적인 파라미터구성 불필요<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 48


<strong>DB2</strong> Information Management아키텍처 비교<strong>DB2</strong> 제어센터 백업, 리스토어 및 롤 포어드 Wizards●효과적인 학습 도구●백업및리스토어,롤포어드에 대한 모든구성 내용 제공●GUI 도구에서 명령을자동 생성하여 실행제어세터에서 3개의화면 실행<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 49


<strong>DB2</strong> Information Management아키텍처 비교로깅 옵션<strong>Oracle</strong><strong>DB2</strong><strong>Oracle</strong> 로깅 옵션 및 컴포넌트Redo logs는 인스턴스마다 정의NoArchive 모드- Full DB "crash" recovery- Limited roll-forward availableArchive Mode- Recover DB, TS, DF- Dual logging & mirrored logging- 3 redo log states1 - Active2 - Inactive3 - Archived<strong>DB2</strong> 로깅 옵션 및 컴포넌트데이터베이스마다 별도 정의Circular 모드- Full "crash" recovery,- No roll-forward recoveryArchive Log (aka Log Retain)- Recover DB, TS- Dual logging & mirrored logging- 3 recovery log states1 - Active2 - Online archived3 - Off-line archived<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 50


<strong>DB2</strong> Information Management아키텍처 비교Archive 로깅<strong>Oracle</strong> Archive LogInstance LevelSGA<strong>DB2</strong> Archive LogData Base LevelDB Shared MemoryDatabaseBufferCacheRedo LogBufferLarge &SharedPools, etc.BufferPoolLogBufferPackageCache, DBHeap, etc.dbwrckptlgwrarchdb2pgclnr[softmax]db2loggerdb2uext2Data FilesControlFilesRedoLogFilesArchiveLog FilesData FilesLogControlFileRecoveryLogFilesArchiveLog FilesActive LogNon-Committed or Non-ExternalizedTransactionsInactive LogCommitted & Externalized TransactionsArchived LogFiles moved from active log subdirectoryto another mediaActive LogNon-Committed or Non-ExternalizedTransactionsOnline Archive LogCommitted & Externalized TransactionsOff-line Archive LogFiles moved from active log subdirectoryto another media<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 51


<strong>DB2</strong> Information Management아키텍처 비교Recovery History 정보<strong>Oracle</strong>● For Online Backup● RMAN LIST BACKUP● V$BACKUP_FILES<strong>DB2</strong>●Recovery History File updated during Database backup, restore, roll-forwardor recovery Table space backup, restore or rollforward Table space is created, dropped, altered,renamed or quiesced Table is loaded, dropped or reorganized Log file is archived New log file is written tolist history backup all for sampleselect * fromtable(sysproc.admin_list_hist())as historyprune history 200412Format YYYYMM<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 52


<strong>DB2</strong> Information Management오프라인 백업 (aka Cold Backup)가장 단순한 백업<strong>Oracle</strong>● NOARCHIVELOG 모드● Shutdown in normal● 수동 복사 :− data files− control files− redo logs(Use OS cpio, tar, backup manager,etc.)<strong>DB2</strong>●●●Circular logging 모드(except to make a base backup for anarchive logged database)모든 사용자 연결 해제 (or quiesce or stop)Backup 명령어 사용− 데이터베이스 또는 테이블 공간 레벨− SYSADM, SYSCTRL or SYSMAINTauthority neededbackup database sample toc:\db2backup●수동 복사 불필요하나 필요 시 가능<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 53


<strong>DB2</strong> Information Management오프라인 리스토어<strong>Oracle</strong>●●●●Shutdown Normal백업 이미지와 동일한 이름 사용Data file, control files, redo logs,undo logs 파일들을 수동으로 복사수동 복사 중에 datafile를 변경가능<strong>DB2</strong>●●●데이터베이스 Stop 또는 quiesceHistory file에서 필요한 백업본에 대한TIMESTAMP를 가져옴 (사용편의성)Restore 명령 사용restore database samplefrom "c:\db2backup" taken at20040901144022 without prompting●alter database rename filename to 새로운 데이터베이스로 생성가능하나 매우 복잡●●Restore 중에 container 를 변경가능(“redirected restore”)<strong>DB2</strong>는 이 작업의 편의성을 위해 script를생성해 주기도 함새로운 데이터베이스로 손쉽게 생성 가능Restore db… into newdb<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 54


<strong>DB2</strong> Information Management온라인 백업 (aka Hot Backup)Archive 로깅 구성 필요<strong>Oracle</strong>●init.ora 변경 LOG_BUFFER LOG_ARCHIVE_DEST LOG_ARCHIVE_DUPLEX_DEST LOG_ARCHIVE_CONFIG Other optional…shutdownstartup mountalter database archivelogshutdown immediate데이터베이스 백업 수행alter database openalter database startarchive log listarchive log all<strong>DB2</strong>●●●●로깅 변수 변경 LOGFILSZ LOGBUFSZ LOGPRIMARY LOGSECOND추가 변경(선택적)− NEWLOGPATH MIRRORLOGPATH BLK_LOG_DSK_FULL OVERFLOWLOGPATHLOGARCHMETH1 설정 오프라인 백업 수행 필요Wizard를 통해구성가능로그 백업 수행<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 55


<strong>DB2</strong> Information Management아키텍처 비교<strong>DB2</strong> 로깅 파라미터FunctionParameterUsageDefaultArchive Retry DelayarchretrydelayWait in second between archive log failure attempts. 0 means no retry.20Block on Log Disk Fullblk_log_dsk_fulPrevent disk full errors from being generated.NOFailover Archive PathfailarchpathAlternate directory for the archive log files if the log archive method specifiedfails.NULLLog Archive Methods 1 & 2logarchmeth1logarchmeth2These parameters cause the database manager to archive log files tolocations that are not the active log path.Values are OFF, RETAIN, USEREXIT, DISK, TSM, VENDOROFFLog Archive Options 1 & 2logarchopt1logarchopt2Works with logarchmeth1 & 2 for vendor options if using TSM or VENDORvalues.NULLLog BufferlogbufszAmount of memory to use as a buffer for log records in 4-KB pages.8Log File SizelogfilsizThe size of each configured log, in number of 4-KB pages.1000Max Logs per Transactionmax_logPercentage of primary log space that can be consumed by one transaction.0 means no limit.0Mirror Log PathmirrorlogpathLocation where an identical copy of the logs will be kept.NULLNew Log PathnewlogpathLocation to change for log path away from default SQLOGDIR.NULLNumber of Commits toGroupmincommitsAllows you to delay the writing of log records to disk until a minimum numberof commits have been performed.1Number of Archive RetriesnumarchretryNumber of attempts that will be made to archive log files using the specifiedlog archive method before they are archived to the path specified by thefailarchpath.5Number of Log Spannum_log_spanNumber of active log files that an active transaction can span. 0 means nolimit.0Overflow Log PathoverflowlogpathMulti-function parameter used for rollforward and archived log retrievaloperations.NULLPrimary LogslogprimaryNumber of primary logs. Also determines number of logs in active log path.3Secondary LogslogsecondNumber of secondary logs allocated if needed. -1 is unlimited active logs.2<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 56


<strong>DB2</strong> Information Management온라인 백업작동 및 범위<strong>Oracle</strong>●●●●●●●RMAN 사용Table space 레벨, one at a time(system 및 rollback 테이블공간은특별한 주의 필요)Alter table space begin backup모드변경된 내용들을 모두 디스크에반영SCN markers are frozenLog full images of changedblocksdata files 과 control files 복사(all data blocks, changed &unchanged)Alter table space end backup 모드백업 동안에 최소한의 activity 권장sysdba 권한 필요<strong>DB2</strong>●●●●●BACKUP command 사용Database 또는 테이블 공간 레벨 로그에 확약된 트랜잭션을 위해변경된 페이지 정보를 보유 Very first full backup done offline백업 이미지에 포함 되는 것 변경된 데이터 페이지들 변경되지 않는 데이터 페이지들 시스템 파일들 History 파일들 Control 파일들 로그파일 포함 가능우선순위 조절 가능 그래도 온라인 백업 동안에는최소한의 activity 권장sysadmin, sysctrl , sysmaint 권한필요<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 57


<strong>DB2</strong> Information Management온라인 백업<strong>DB2</strong> 예<strong>DB2</strong>● Online Database backupbackup database sample online to c:\db2backup●Online table space backup including logsbackup database sample tablespace (userspace1) online toc:\db2backup include logs●Online database backup 압축 및 Throttledbackup database sample online to c:\db2backupCompress util impact priority 50<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 58


<strong>DB2</strong> Information Management온라인 리스토어Database 고려사항<strong>Oracle</strong>●●●●●Restore 와 recover 전략이 무엇이유실되었느냐에 따라 다름 (Examples,see paper on “<strong>Oracle</strong> RecoveryScenarios”)Restore – 오프라인 상태에서, 백업받은 이미지 복사Recover – roll-forward를 위해redolog 반영Database 레벨 복구 데이터베이스 Mount 모든 데이터파일을 Online 시킴 유실된 데이터파일을 복사 Redo log 적용 (inactive andarchived)Recover database는 2가지 타입 가능 End of logs Point in time<strong>DB2</strong>●●데이터베이스 Restore 시에는 오프라인상태에서 온라인 백업이미지를 이용하여restore 실행전체 Restore는 모든주요시스템파일들을 자동으로 복원– 손쉽게 복구하고 서비스 시작 가능– Restore with roll-forward for more controlrecover db sample to end of logsrestore database sample fromc:\db2backup taken at 20041201194626without promptingrollforward database sample to end oflogs and complete●orRoll-forward 는 2가지 타입 제공− End of logs− Point in time<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 59


<strong>DB2</strong> Information Management온라인 리스토어테이블 공간 고려사항<strong>Oracle</strong>●●테이블공간 레벨 복구테이블 공간 Offline 시킴유실된 데이터파일 복사Redo log 반영(online and archived)복구 시나리오Media failure의 심각도및백업전략에 의존적이며, 일관성있는상태로 복구하는 것이 힘겨운때가 종종 있음.예제 “<strong>Oracle</strong> RecoveryScenarios”<strong>DB2</strong>●●●테이블공간 복구를 온라인 상태에서실행restore database sampletablespace(userspace1) onlinefrom c:\db2backuptaken at 20040901201428without promptingrollforward database sampleto end of logs and completetablespace(userspace1) online롤 포어드는 2가지 타입 제공− End of logs− Point in time테이블공간 백업 이미지들을 이용하여전체 데이터베이스를 생성 가능<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 60


<strong>DB2</strong> Information ManagementIncremental 백업비교<strong>Oracle</strong><strong>DB2</strong>●Cumulative Incremental BackupLevel 0 is a baselineSimilarLevel 1은 가장 마지막 Level 0백업 이래 변경된 모든block들을 백업●Incremental Backup 마지막 full backup받은 이래변경된 모든 페이지들을 백업●Differential Incremental Backup(default)SimilarLevel 0 is a baselineLevel 1 은가장마지막incremental backup이래 변경된모든 block들을 백업●Delta Backup 마지막 full, incremental,delta이래로 변경된 모든페이지들을 백업<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 61


<strong>DB2</strong> Information ManagementIncremental Backup<strong>Oracle</strong> Cumulative and Differential Incremental Backups *Cumulative Incremental BackupDifferential Incremental Backup (default)* Excerpt from <strong>Oracle</strong> documentation<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 62


<strong>DB2</strong> Information ManagementIncremental Backup<strong>DB2</strong> Incremental & Delta<strong>DB2</strong> Incremental & Delta Backups<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 63


<strong>DB2</strong> Information ManagementIncremental BackupUsing<strong>Oracle</strong>●●●●부분 백업을 위해 RMAN 사용RMAN은 마지막 백업 이래 변경된Block들을 Tracking하는 파일을이용Tracking Enablealter database enable blockchange tracking using file'/bkups/change.log‘Tracking Disablealter database disable blockchange tracking<strong>DB2</strong>●●Tracking을 위해db cfg 에TRACKMOD 를 YES로 변경update db cfg for sample usingtrackmod yesFull 백업을 받은 후, 이후에Incremental 백업 수행backup database sample toc:\db2backupbackup database sample onlineincremental to c:\db2backupbackup database sample onlineincremental delta toc:\db2backup<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 64


<strong>DB2</strong> Information ManagementIncremental RestoreUsing<strong>Oracle</strong>●●Incremental restore를 위해RMAL 사용RMAN은 Incremental백업이미지로부터 IncrementalMerge시킬수있음<strong>DB2</strong>●데이터의 손실 없이 restore incremental 및 delta 백업을 통한자동 복구를 위해 Automatic 키워드사용 Roll forward(예제 : 다음 장)●Restore wizard 사용시매우편리<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 65


<strong>DB2</strong> Information ManagementIncremental Restore<strong>DB2</strong> 예제<strong>DB2</strong> Incremental Restore 단계●Restore using “automatic” keyword to apply incremental or delta backupsrestore database sample incremental automaticfrom c:\<strong>DB2</strong>Backuptaken at 20040901230402 without prompting자동 restore를 위해, 가장 최근의 incremental 및delta 백업이미지의 timestamp●Roll-forwardrollforward database sample to end of logs and complete<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 66


<strong>DB2</strong> Information Management삭제된 테이블 복구과정 비교<strong>Oracle</strong>●FLASHBACK옵션이 있으면손쉬움:FLASHBACK TABLE RECYCLETEST TOBEFORE DROP<strong>DB2</strong>● 삭제된 테이블 history 가 보관됨(DROPPED TABLE RECOVERY가 On)list history dropped table allfor sample●영구적으로 테이블 삭제를 하려면:DROP TABLE RECYCLETEST PURGE●이전의 백업 이미지로부터 테이블공간을 Restore●영구적으로 삭제한 테이블을복구하는 일은 매우 어려움 (다음장)restore db sampletablespace(userspace1)from c:\db2backup taken at20040902100931 without rollingforward without prompting<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 67


<strong>DB2</strong> Information Management삭제된 테이블 복구과정 비교(계속)<strong>Oracle</strong>●영구적으로 삭제된 테이블을복구하는 법 Database를 다른서버에restore테이블을 삭제된 바로 이전의시점까지 point-in-time 복구 실행삭제된 테이블을 Export원래의 데이터베이스에 Import<strong>DB2</strong>●●●삭제된 테이블의 데이터를 Unloadrollforward db sample to end oflogs and complete recoverdropped table00000000000002010002000d toc:\db2backupRecovery history 파일로부터 DDL문추출하여 테이블 재 생성데이터 로드load fromc:\db2backup\node0000\dataof del method p(1)insert into recoverme<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 68


<strong>DB2</strong> Information Management백업 및 복구자동 튜닝 백업 지원● 자동 튜닝 기능이 BACKUP 유틸리티에도 지원● 성능 상 장점최악의 시나리오에서도 4배의 성능 향상● 자동 설정:Buffer sizeNumber of buffersParallelism<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 69


<strong>DB2</strong> Information Management백업 및 복구지원 유틸리티●●●●db2ckbkp (백업 이미지 점검) 백업 이미지의 무결성 점검 (로그 포함 여부 확인 가능)db2ckrst (incremental restore 이미지 점검) Helps manage log chains to make sure they are complete for any given incrementalrestoredb2adutl (TSM 오브젝트 관리) Allows users to query, extract, verify, and delete backup images, logs, and load copyimages saved using Tivoli Storage Manager.db2pd (문제 해결) -LOGS 옵션 – 모든 로그에 대한 현재 정보<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 70


<strong>DB2</strong> Information Management백업 및 복구교육<strong>Oracle</strong>● 백업 및 복구가 배우고사용하기가 쉽지 않음.● <strong>Oracle</strong>은 Backup / Recovery를위해3일 교육과정 제공<strong>DB2</strong>● 백업 및 복구가 배우고 사용하기가 매우간단● <strong>DB2</strong> ADMIN교육 과정이 4일 과정이며,− 백업 및 복구를 위한 topic이 포함− 습득 위해 1일 이하소요<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 71


<strong>DB2</strong> Information Management백업 및 복구결론● 두 데이터베이스 모두 제공Offline or online backup of database and table spacesTable space online backup and restore, relocation of table space withcompressionRoll-forward to a point-in-time or to the end of logsIncremental and differential backup for data warehouse environmentEffective mechanisms and capabilities for securing data from loss due to mediacorruption or human error.● 그러나, 백업및복구기술은<strong>Oracle</strong>보다 <strong>DB2</strong>가 매우 간단하며 손쉬움<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 72


<strong>IBM</strong> Software GroupPrimary<strong>DB2</strong> High AvailabilityDisaster Recovery (HADR)cloneStandby<strong>IBM</strong> <strong>DB2</strong> Open Forum 3 rd29 slides© 2008 <strong>IBM</strong> Corporation


<strong>DB2</strong> Information Management<strong>DB2</strong> HADR 의 목표• 장애시간의 최소화(Ultra-fast failover)• 관리의 용이함 및 비용의 최소화 (Easy administration)• 이중화에 대한 성능 보장(Negligible impact on performance• 업무 연속성 제공(H/W,S/W upgrades without interruption)• Fail-Over의 용이함 (Client Reroute) Transparent failover & failback for applications<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 74


<strong>DB2</strong> Information Management<strong>DB2</strong> HADR - 가장 빠른 장애복구 솔루션‣ 데이터베이스를 이중 관리함으로써 사이트 장애 또는 Storage 장애에 대비‣ 무 중단으로 버전 업그레이드 가능‣ 최근 변경내용을 대기서버의 메모리(버퍼풀)에 저장‣ 장애 시 대기서버의 가동시작 시간을 앞당김‣ 15초이내장애복구‣ 실재로 600명의 SAP 사용자를 서비스하는 시스템에서 11초만에 데이터베이스 서비스를 재 시작했음‣ 대기서버에서도 장애 시 주 서버와 동일한 성능 (100%)으로 서비스 가능Automatic Client RerouteClient application은 자동으로 대기서버에서 재 시작됨txtxNetwork ConnectionHADR두 서버간 Sync 유지txtxTSA for server monitoringMonitors the primary and initiatesthe takeover.HACMP, heartbeat, TSA, MSCS, etc1차서버2차 서버<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 75


<strong>DB2</strong> Information ManagementHADR 구성 방안 (Local HA/Remote DR)• HADR 구성으로 Local Standby Database 구성• Remote DR을 위해 HADR Standby 데이터베이스에 연결(주 서버의 네트웍 부하 고려)HADR Cluster•Primary DB 서버장애감지Local Standby Database로 자동 서비스 이전•서울 지역 전원장애 등 재해 발생Remote DR 서버로 서비스 이전Automatic client rerouteHADRDB1Primary DatabaseDB1’Disk MirroringLocal standby DatabaseDB1’’RemoteDisasterRecovery<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 76


<strong>DB2</strong> Information ManagementHADR의 구현및관리– 손쉽게구성하고관리“한 장의 설명으로 충분”● Primary Setup(1)db2 backup db hadr_db to backup_dir● Standby Setup(2) db2 restore db hadr_db from backup_dir(3)db2 update db cfg for hadr_db using HADR_LOCAL_HOST host_a HADR_REMOTE_HOST host_b HADR_LOCAL_SVC svc_a HADR_REMOTE_SVC svc_b HADR_REMOTE_INST inst_b HADR_TIMEOUT 120 HADR_SYNCMODE ASYNC(6) db2 start hadr on database hadr_db asprimary(4) db2 update db cfg for hadr_db usingHADR_LOCAL_HOST host_bHADR_REMOTE_HOST host_aHADR_LOCAL_SVC svc_bHADR_REMOTE_SVC svc_aHADR_REMOTE_INST inst_aHADR_TIMEOUT 120HADR_SYNCMODE ASYNC(5) db2 start hadr on database hadr_db asstandby서비스 이관 : db2 takeover hadr on db hadr_db<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 77


<strong>DB2</strong> Information ManagementHADR Setup클라이언트 리라우트● Client reroute 구성BeforeClient re-routeAfterClient re-routeActive Standby Loss ActiveDatabasePrimaryHADRDatabaseStandbyFailoverClustermanagerexecutes“db2TAKEOVERHADR ONDATABASEHADRDB BYFORCE” onstandbyDatabaselossDatabasePrimaryPrimary :db2 UPDATE ALTERNATE SERVERFOR DATABASE HADRDB USINGHost1.ibm.com PORT 50000Standby :db2 UPDATE ALTERNATE SERVERFOR DATABASE HADRDB USINGHost2.ibm.com PORT 55000<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 78


<strong>DB2</strong> Information ManagementRAC 대비 HADR의 우수성HADR솔루션은 RAC에 비해 고 가용성은 물론이고 성능, 관리성, 비용 면에서 모두 탁월한 장점을 가진솔루션입니다.구분성능구현및관리비교HADR > RACHADR > RAC세부내용<strong>DB2</strong>는 한대의 SMP기계에서 OLTP업무 최고의 성능(tpc-c)을 내고있습니다. 가장 최근 자료(2006/12)에 의하면, 동일한 기계 사양에서<strong>Oracle</strong>에 비해 3.4배의 성능 차이를 보였습니다.한대의 SMP로 관리하는 것이 Cluster 시스템을 운영하는 거에 비해관리하기가 더 쉽습니다. 이로 인해 관리비용이 RAC가 더 많이 소요됩니다.또한 RAC는 구축 시 Application의 디자인 고려 등 구현하기가 어렵지만,HADR은 구성하기가 매우 쉽습니다.고가용성HADR > RAC한대의 노드가 장애 시 HADR은 RAC와 비교했을 때 최소한 비슷하거나또는 보다 빠른 재 가동 시간을 확보할 수 있습니다. 또한 <strong>DB2</strong>는 고 가용성을위한 다양한 기능들을 제공하고 있습니다.비용HADR > RACH/W비용은 RAC솔루션이 보다 저렴하나, <strong>Oracle</strong> 및 RAC를 위한라이센스 비용으로 인해, HADR솔루션이 전체적인 비용을 절감시킵니다. 이에따라 S/W유지보수비용도 RAC가 더 비싸게 책정될 수 있습니다. RAC 3노드를 가정했을 때, 동일한 용량을 가지는 HADR솔루션이 24% 더저렴합니다.<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 79


<strong>DB2</strong> Information Management<strong>Oracle</strong> RAC 장애 복구Data Block Remastering• 한 노드가 실패하면 실패한 노드의 블럭들을 다른 노드에서 재 분산되어야 함.• 이 과정 동안 전 노드의 GCS가 중단되며, 데이터베이스 서비스도 중단됩니다.Instance 1 Instance 2 Instance 3Global ResourceDirectoryMaster for block14710…Global ResourceDirectoryMaster for block25811…Global ResourceDirectoryMaster for block36912…<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 80


<strong>DB2</strong> Information Management초기 도입 비용 비교총 업무량 처리를 위해 12장의 CPU가 필요하다고 가정했을 때 <strong>Oracle</strong> RAC는 장애 시 한대의 서버에서 가동되어야하므로, 업무 대비한 CPU 개수에 대한 추가적인 고려가 필요하나, 이를 감안하지 않더라도 도입비용 면에서 <strong>DB2</strong>HADR 이 보다 저렴합니다. HADR은 <strong>DB2</strong>의 고가용을 지원하는 기능이며, DR기능도 포함합니다.$256,721 절감 (24%)Assumes that RACscales linearlyp570 12-way p570 12-wayServerStorage<strong>DB2</strong> ESE (Enterprise Server Edition) 9HADR (High Availability Disaster Recovery)Total*$33,125 per CPU for <strong>DB2</strong> ESE$211,740$151,168*$430,625$0$793,533StorageTotalp570 4-way p570 4-way p570 4-wayServer(8822.5)<strong>Oracle</strong> EE <strong>10g</strong>RAC(Real Application Cluster)**$48,000 per CPU for <strong>Oracle</strong> EE***$24,400 per CPU for <strong>Oracle</strong> RAC$105,870$75,584**$576,000***$292,800$1,050,254•초기 도입시 Disk 추가비용 소요•HADR을 위한 추가 라이센스 없음•Standby장비:1 CPU 라이센스 구매•RAC 추가 라이센스 구매•두개 장비 모두 CPU 기반 라이센스 구매•라이센스구매비용↑=유지보수비용↑<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 81


<strong>DB2</strong> Information ManagementHADR <strong>vs</strong> RAC 가용성구분<strong>DB2</strong> HADR<strong>Oracle</strong> <strong>10g</strong> RAC소프트웨어 장애 대비Server 장애 대비디스크장애대비사이트장애대비Rolling Upgrade 지원수분대장애복구장애 복구 이후 서비스 가동지역적인 분산Express/Workgroup에서도 지원구성 및 모니터가 간단응용프로그램 변경이 불필요YesYesYesYesYesYesYesYesYesYesYesYesYesNoNoNoYesYesNoNo / LimitedNoNo<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 83


<strong>IBM</strong> Software Group<strong>DB2</strong> 동시성분리 레벨 및 잠금<strong>IBM</strong> <strong>DB2</strong> Open Forum 3 rd18 slides© 2008 <strong>IBM</strong> Corporation


동시성개요<strong>DB2</strong> Information Management● 동시성:● 다중 사용자 및 응용프로그램들이 자원을 공유하는 것을 허용 데이터 일관성 유지 2가지 메커니즘► 분리 레벨►잠금동시성 이슈 Lost updates2개의 Transaction이 동일한 데이터를 변경하려고 시도하여, 첫 번째 변경된 데이터는 두 번째 변경된데이터에 의해 사라지는 현상 Phantom ReadsTransaction이 두번째결과집합을생성할때, 처음에 없던 새로운 행들이 추가되는 현상 Nonrepeatable ReadsTransaction이 두 번째 결과집합을 생성할 때, 변경된 행이 존재하거나 또는 삭제되어 나타나지 않는행이 있는 현상. Uncommitted Reads다른 transaction에 의해 변경되었으나, 아직 확약되지 않은 데이터를 읽는 현상 Old Data ReadsTransaction이 읽어온 데이터가 이미 다른 transaction에 의해변경되어, 구 데이터가 되는 현상.<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 85


<strong>DB2</strong> Information Management동시성ANSI 분리 레벨 개요ANSI 분리 레벨Repeatable ReadRead StabilityCursor StabilityUncommitted Read잠금 영향결과집합에 영향을 미치는 모든 행들에 대해 트랜잭션이 마칠 때까지잠금을 보유(Any row that is referenced in any mannerto produce a result set is locked until thetransaction ends)실제적으로 검색된 모든 행들에 대해 트랜잭션이 마칠 때까지 잠금을보유(Any row that is actually retrieved to producethe result set is locked until the transaction ends)결과집합중현재참조되는행에대해서만cursor가이동하거나또는트랜잭션이 마칠 때까지 잠금을 보유(Only the row that iscurrently being referenced in that result set islocked until that cursor is repositioned or thetransaction ends)트랜잭션이 실행되는 동안 잠금을 확보하지 않음(No locking isdone on any records at any time during atransaction (with the exception of a dropped oraltered table which is not transactional anyway))<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 86


<strong>DB2</strong> Information Management동시성ANSI 분리 레벨 – 동시성이슈해결ANSI IsolationLevelJ2EE Isolation Level *Old DataReads?LostUpdates?UncommittedReads?NonrepeatableReads?PhantomReads?Repeatable ReadSerializationNoNoNoNoNoRead StabilityRepeatable ReadNoNoNoNoYesCursor StabilityRead CommittedNoNoNoYesYesUncommitted ReadRead UncommittedNoNoYesYesYes* From <strong>Oracle</strong>’s documentation on J2EE isolation levels:http://www.oracle.com/technology/oramag/oracle/03-may/o33j2ee_2.html#t4Phantom ReadsConcurrency Problems . . .Lost UpdatesUncommitted ReadsNonrepeatable Reads<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 87


<strong>DB2</strong> Information Management동시성ANSI 분리레벨 튜닝 : 보다 많은 동시성 확보● <strong>DB2</strong>_EVALUNCOMMITTED 레지스트리 변수 RS나 CS분리레벨에서,조건을 만족시키는 행이 있을 때까지, 행 잠금을 연기함. 조건을만족시키지 않는 행들은 통과 CS 나 RS 트랜잭션은 미 확약 데이터에 대해서도 조건 만족여부를 검사● <strong>DB2</strong>_SKIPDELETED 레지스트리 변수 CS나 RS 트랜잭션은 삭제된 행(아직 commit되지 않음)에 대해조건검사를Skip.● <strong>DB2</strong>_SKIPINSERTED 레지스트리 변수 CS나 RS 트랜잭션은 추가된 행(아직 commit되지 않음)에 대해조건검사를Skip.● Other <strong>DB2</strong> Concurrency Improvement Suggestions 자주 commit을 하도록 보다 작은 UOW를 생성 가능한 한 빨리 Cursor를 Close Table 잠금이 필요한 경우(Load나 utility작업을 하는 경우)에는 SHARE모드에서 함<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 88


<strong>DB2</strong> Information Management동시성<strong>DB2</strong> 분리레벨 설정● Statement 레벨:SELECT (INTO), DELETE, UPDATE ... WITH {RR, RS, CS, UR}● 현재 세션에서 dynamic SQL:SET CURRENT ISOLATION = {RR, RS, CS, UR} or SET ISOLATION {RR, RS, CS, UR}● precompile 이나 bind 시:ISOLATION {RR, RS, CS, UR} option of the command line processor PREP or BIND commands● <strong>DB2</strong> Call Level Interface (<strong>DB2</strong> CLI):For <strong>DB2</strong> CLI, change the isolation level as part of the <strong>DB2</strong> CLI configuration (db2cli.ini). This can be doneeither by: UPDATE CLI CFG FOR SECTION sectionname USING TXNISOLATION {1, 2, 4, 8}where:1 = SQL_TXN_READ_UNCOMMITTED - Read Uncommitted (Uncommitted Read)2 = SQL_TXN_READ_COMMITTED (default) - Read Committed (Cursor Stability)4 = SQL_TXN_REPEATABLE_READ - Repeatable Read (Read Stability)8 = SQL_TXN_SERIALIZABLE - Serializable (Repeatable Read) Editing db2cli.ini and setting applTxnIsolation = {1, 2, 4, 8}● JDBC 또는 SQLJ :Use the setTransactionIsolation method in the java.sql interface connection, where:TRANSACTION_SERIALIZABLE = Repeatable readTRANSACTION_REPEATABLE_READ = Read stabilityTRANSACTION_READ_COMMITTED = Cursor stabilityTRANSACTION_READ_UNCOMMITTED = Uncommitted read● Command Line Processor (CLP) :CHANGE ISOLATION TO {RR, RS, CS, UR, NC} where NC stands for No Commit● REXX:CHANGE SQLISL TO {RR|CS|UR|RS|NC} {RR, RS, CS, UR, NC}<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 89


동시성잠금 모드<strong>DB2</strong> Information ManagementLocking ModeIN (Intent None)IS (Intent Share)NS (Next Key Share)S (Share)IX (Intent Exclusive)SIX (Share with Intent Exclusive)U (Update)NW (Next Key Weak Exclusive)X (Exclusive)W (Weak Exclusive)Z (Super Exclusive)Applicable ObjectTable spaces, blocks, tablesTable spaces, blocks, tablesRowsRows, blocks, tablesTable spaces, blocks, tablesTable spaces, blocksRows, blocks, tablesRowsRows, blocks, tables, buffer poolsRowsTable spaces, tables<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 90


<strong>DB2</strong> Information Management동시성잠금 타입 호환성STATE OF HELD RESOURCESTATEREQUESTEDNoneINISNSSIXSIXUNXXZNWWNoneYESYESYESYESYESYESYESYESYESYESYESYESYESINYESYESYESYESYESYESYESYESYESYESNOYESYESISYESYESYESYESYESYESYESYESNONONONONONSYESYESYESYESYESNONOYESYESNONOYESNOSYESYESYESYESYESNONOYESNONONONONOIXYESYESYESNONOYESNONONONONONONOSIXYESYESYESNONONONONONONONONONOUYESYESYESYESYESNONONONONONONONONXYESYESNOYESNONONONONONONONONOXYESYESNONONONONONONONONONONOZYESNONONONONONONONONONONONONWYESYESNOYESNONONONONONONONOYESWYESYESNONONONONONONONONOYESNOLegend:YES - grant lock requested immediatelyNO - wait for held lock to be released or timeout to occur<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 91


동시성<strong>DB2</strong> 잠금 튜닝<strong>DB2</strong> Information Management● LOCKLIST 잠금 정보를 저장하는 메모리● LOCKTIMEOUT 응용프로그램이 잠금을 획득하기 위해 기다리는 시간(초)● MAXLOCKS Lock escalation이 일어나는 LOCKLIST 중의 비율● DLCHKTIME Deadlock 발생 점검 주기● SET CURRENT LOCK TIMEOUT [ WAIT | NOT WAIT | NULL | WAIT integer ] 트랜잭션 내에서 Lock timeout 값 등록● ALTER TABLE…LOCKSIZE BLOCKINSERT Insert 잠금을 최소화하는 MDC 테이블 옵션<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 92


<strong>DB2</strong> Information Management동시성TPC-C: OLTP 벤치마크● “벤치마크는 <strong>DB2</strong> 동시성이 효율적임을 증명” <strong>DB2</strong>는 비슷한 H/W구성에서 <strong>Oracle</strong>보다 성능 상 우수<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 93


<strong>DB2</strong> Information Management동시성SAP 벤치마크 – 가장 큰 OLTP 벤더● “벤치마크는 <strong>DB2</strong> 동시성이 효율적임을 증명” SAP 테스트에서 <strong>DB2</strong>는 최고의 성능을 내는 데이터베이스<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 94


<strong>DB2</strong> Information ManagementMVRC 와 ANSI 분리레벨<strong>Oracle</strong> 분리 레벨• <strong>Oracle</strong>은 Multi Version Read Consistency (MVRC) 분리레벨 사용• Query에서 보는 데이터는 시작 시점의 존재 데이터• Any statement seeing an update "rolls back" to get an older version of the data- 잠금 비용을 줄이는 경우도 있으나, I/O 비용을 항상 증가시킴- 모든 변경될 가능성 있는 data block들은 물리적인 복사본(undo tablespace에기록)이 항상필요하기때문- 디스크 요구량 증가- Cache 사용량 증가- Log 사용량 증가• 일기만 하는 Transaction은 writer를 기다리지 않으나, 읽어온 데이터가 구 데이터일가능성이 있음- 이 이슈는 MVRC에만 존재• 두개의“WITH UPDATE”문장은 서로를 기다려야 함• 더구나 <strong>Oracle</strong>은 벤치마크테스트 시에는 “serializable” 분리레벨을 사용 (See <strong>Oracle</strong> TPC-C benchmark to see it widely uses serialized isolation.)<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 95


<strong>DB2</strong> Information ManagementMVRC 와 ANSI 분리 레벨<strong>Oracle</strong> 분리 레벨 문제점• <strong>Oracle</strong> MVRC는 여러가지문제유발• 다른 RDBMS들은 이 분리레벨을 사용하지 않음• ANSI 기반의 J2EE 분리 모델과 매치되지 않음• 확약된 트랜잭션도 Update문 이전에 시작되었으면 구 데이터를 읽어감.• 보관된 구 데이터를 찾기 위해 추가적인 CPU 자원이 필요• 동일한 Block의 데이터가 여러 버전 Cache되어, cache의 효율성이 떨어짐• Undo Tablespace(9i이전 : Rollback segments)가 필요• RBS는 복구를 위해 redo log에 저장됨• RBS는 <strong>Oracle</strong> DBA에게는 문제가 많음► 구 데이터 보관을 위해 추가적은 디스크 필요► Segment의 크기및숫자관리필요► Transaction의 크기나 기간을 알 필요가 있음► Sync가 이루어지지 않으면, <strong>Oracle</strong>은 트랜잭션을 취소시킴► ORA-01555 에러 발생 (snapshot old) 시 해결방법▪ DBA가 RBS의 크기를 늘려주거나 숫자를 늘려 해결▪ 개발자가 자주 Commit을 자주 찍지 않도록 수정하여 해결<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 96


<strong>DB2</strong> Information ManagementMVRC 와 ANSI 분리 레벨실상황예제첫번째 예제: MVRC두번째 예제: MVRC force serializing<strong>DB2</strong>와 유사Transaction 1Transaction 2Transaction 1Transaction 2Begin Transaction.Begin Transaction.Begin TransactionBegin TransactionSELECT available seatsfrom flight ABC111.See seat 23F is lastavailable.Reserve seat.SELECT available seats fromflight ABC111 using FORUPDATE clause.See seat 23F is last available.Reserve seat.SELECT available seats onflight ABC111.SELECT available seats on flightABC111 using FOR UPDATE.Also see 23F available as <strong>Oracle</strong>goes to rollback segment to getthe old version of that block.Blocks wait on lock from firsttransaction.Commit Transaction.Commit Transaction.Reserve seat.Commit TransactionSELECT returns with no seatsavailable.Successful Commit with lostupdate.Book on another flight.Flight is oversold!<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 97


<strong>DB2</strong> Information ManagementMVRC 와 ANSI 분리 레벨벤치마크 테스트에서의 프로그램 코딩● TPC-C 벤치마크 발표 보고서에 의하면… 질문: 왜 <strong>Oracle</strong>은 MVRC를 사용하지 않는가? 답변: 최고도의 트랜잭션 시스템에서는 Overhead가 너무많기때문!<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 98


<strong>DB2</strong> Information ManagementMVRC 와 ANSI 분리 레벨<strong>DB2</strong> 분리 레벨• <strong>DB2</strong>는 ANSI 표준 분리 레벨을 사용• RR – 모든 참조되는 행을 잠금• RS - 모든 검색된 행에 대해 잠금• CS – 현재 처리되고 있는 행에 대해서만 잠금• UR – 어떤 행도 잠그지 않음• 현재의 확약된 데이터만을 읽도록 트랜잭션을 나열하는 게 기본• UR 분리 레벨은 Dirty Read를 허용하여, Reader가 Writer를 기다리지 않게 함• <strong>DB2</strong>는 Undo(rollback) 오버헤드를 가지지 않음• <strong>DB2</strong>는 행 수준 잠금은 진정한 행 수준 잠금이며, 메모리에 저장• <strong>Oracle</strong>의 SCN은 물리 데이터 블록의 헤더에 저장• <strong>Oracle</strong>의 SCN은 동일한 페이지의 행을 필요로 하는 다른 트랜잭션에 의해 변경될 수 있음.• 자주 commit을 하지 않도록 짜여진 <strong>Oracle</strong>응용프로그램을 <strong>DB2</strong>로 전환 시에는 많은 Locking을유발하게 됨. 그러나 반대로,• 자주 commit을 하도록 짜여진 <strong>DB2</strong> 응용프로그램을 <strong>Oracle</strong>에 전환 시에는 많은 ORA-01555 에러가발생될 수 있다MVRC가 벤치마크에서 어떻게 사용되었는가?• TPC-H (warehousing), SAP, PeopleSoft, Baan (OLTP) 테스트에서 <strong>DB2</strong> 가선두!• TPC-C테스트에서, ORACLE은ƒ MVRC와 ORA-01555의 에러핸들링을Skip하며 코딩했는가?ƒ 왜 결과를 얻기 위해 serializable 분리 레벨을 사용했는가?ƒ 그럼에도 불구하고 왜 여전히 <strong>DB2</strong>에 비해 처리량이 낮은가?<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 99


<strong>DB2</strong> Information Management잠금<strong>Oracle</strong> 행 수준잠금• <strong>Oracle</strong> 잠금 접근• 해당 데이터 페이지에 lock 정보를 저장• 모든 data 및 인덱스 페이지에는 동시에 접근하는 트랜잭션 수에 따라 가변적으로 늘어나는Transaction layer 가있다.• 모든 트랜잭션은 해당 페이지 내에 ITL(Interested Transaction List)에 하나의 엔트리를 추가한다.• 동일한 페이지를 액세스하는 트랜잭션이 많아질수록, transaction layer의 크기는 커짐• 비용• 디스크 공간 Overhead• 디스크 속도 Overhead• MAXTRANS는 ITL의 수를제한• DBA는 “hot” 테이블에 대한 disk overhead와 MAXTRANS에 대해고려필요• MAXTRANS에 도달하면, Transaction들은 “sleep”됨• 장점• 메모리 불필요<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 100


<strong>DB2</strong> Information Management잠금<strong>DB2</strong> 행 수준잠금• <strong>DB2</strong> 잠금 접근• 모든 잠금은 이름을 가짐 (Lock Request Block 또는 LRB)• Lock이 요청될 때, LRB가 locklist 메모리 영역에 저장됨• 다중 응용프로그램이 동일한 레코드를 exclusive 모드로 잠그려고 하면, <strong>DB2</strong>는 first come first served 에의해 링크 목록을 생성함.• 다중 응용프로그램이 reading을 위해서는 공유 가능• 링크 목록은 lock을 사용하는 transaction과 lock을 기다리는 transaction 정보를 모두 포함• Transaction이 lock을 기다릴 때, semaphore에서 기다림(<strong>Oracle</strong> 처럼 sleep timer가 아님)• 첫번째transaction이 lock을 해제하면, 다음 transaction 으로 lock의 ownership이 전수됨• 비용• 메모리가 필요• 장점• 동일한 행에 대해 x-Lock을 필요로 하는 transaction은 먼저선점한Transaction이 lock을 해제할 때가지기다려야 함. 순서대로 처리됨.• 디스크보다 빠르고, 사용을 마치면 사라짐ƒ 데이터베이스가 다운되었을 때, Lock이 필요한가?ƒ "Hot“테이블들은 <strong>DB2</strong>의 Lock escalation에 의해 행 수준 잠금의 수를 줄임.ƒ Lock escalation은 <strong>Oracle</strong>에는 없음. Memory locking에 만있음<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 101


<strong>DB2</strong> Information ManagementLocking 비교LockingMechanism관리소요 바이트고려사항장점<strong>DB2</strong> 9Row-level Locking메모리에 저장LOCKLIST 공간68 bytes fixed•Locking을 위한 메모리 공간 필요•Lock을 요청한 순서대로 처리•Lock은 일시적인 정보일 뿐 데이터베이스가 다운되면붚필요한 정보이므로 메모리 관리가 더 효율적•“Hot table”에 대한효율적/동적 Lock Escalation (메모리공간절약및성능향상)<strong>Oracle</strong> <strong>10g</strong>Row-level Locking디스크에 저장Data Page가 있는동일블록에저장48 bytes + 24 bytes per transaction•추가디스크공간필요•디스크 I/O 필요•MAXTRANS 가최대Lock을 제한•MAXTRANS에 도달하면 트랜잭션은 정지•DBA는 대량의Lock을 요구하는 “Hot table”의Overhead를 고려하여 테이블 공간 설계가 필요함•Locking을 위한 메모리 불필요<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 102


<strong>DB2</strong> Information Management감사합니다<strong>DB2</strong> 9 <strong>vs</strong> <strong>Oracle</strong> <strong>10g</strong>© 2008 <strong>IBM</strong> Corporation 103

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!