SETA Central 2006 Crashes Happen - Downtime Won't with Data Guard Stephen Rea Tuesday, October 10, 2006 9:30 AM.

Slides:



Advertisements
Similar presentations
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Oracle High Availability Solutions RAC and Standby Database Copyright System Managers LLC 2008.
Advertisements

3 Managing an Oracle Instance. Objectives Setting up operating system and password file authentication Creating the parameter file Starting up an instance.
Oracle Architecture. Instances and Databases (1/2)
ITEC474 Control File Maintenance
Oracle9i Data Guard Darl Kuhn Sun Microsystems
Backup and recovery Basics of Backup and restoration Types of recovery Defining strategy Starting up and shutting down 80/20 rule SLA’s.
Oracle Data Guard Ensuring Disaster Recovery for Enterprise Data
1 Chapter 15 Duplicating Databases and Transporting Data.
Backup The flip side of recovery. Types of Failures Transaction failure –Transaction must be aborted System failure –Hardware or software problem resulting.
Managing an Oracle Instance
5 Copyright © 2006, Oracle. All rights reserved. Database Recovery.
RMAN Restore and Recovery
Backup and Recovery Part 1.
Chapter 12 Performing Incomplete Recovery. Background Viewed as one of the more difficult chapters to write Thought it was important to put in material.
ITEC474 Redo Log Files.
CHAPTER 5 Managing Control Files, Online Redo Logs, and Archiving.
Oracle9i Database Administrator: Implementation and Administration
7 Maintaining Redo Log Files. 7-2 Objectives Explaining the use of online redo log files Obtaining log and archive information Controlling log switches.
1 © 2006 Julian Dyke Logical Standby Julian Dyke Independent Consultant juliandyke.com Web Version.
CERN - IT Department CH-1211 Genève 23 Switzerland t Oracle Data Guard for RAC migrations WLCG Service Reliability Workshop CERN, November.
Introduction to Oracle Backup and Recovery
Using RMAN to Perform Recovery
Oracle Database Administration
1 Data Guard Basics Julian Dyke Independent Consultant Web Version - February 2008 juliandyke.com © 2008 Julian Dyke.
Oracle Database Administration
Presentation #32050 Presentation #32050 Implementing Oracle9i Data Guard For Higher Availability By Daniel T. Liu First American Real Estate Solutions.
CHAPTER 2 Implementing a Database. Introduction to Creating Databases After you’ve installed the Oracle software, the next logical step is to create a.
DBA’s Guide to Physical Dataguard Part II. DBA’s Guide to Physical Dataguard Part II, NoCOUG May 21 st / 43 Overview.
ORACLE 10g DATA GUARD BROKER Ritesh Chhajer Sr. Oracle DBA.
Oracle DataGuard Concepts and Architecture
ORACLE 10g DATAGUARD Ritesh Chhajer Sr. Oracle DBA.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
11g(R1/R2) Data guard Enhancements Suresh Gandhi
6 Copyright © 2009, Oracle. All rights reserved. Configuring the Oracle Network Environment.
1 Data Guard. 2 Data Guard Reasons for Deployment  Site Failures  Power failure  Air conditioning failure  Flooding  Fire  Storm damage  Hurricane.
IT Database Administration SECTION 01. Starting Up and Shutting Down the Database Database Administration Facilities – A number of tools are available.
Week 3 Lecture 1 The Redo Log Files and Diagnostic Files.
Database Administration 3.Using Administration Tools.
8 Copyright © Oracle Corporation, All rights reserved. Configuring the Database Archiving Mode.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives  Learn the steps for creating a database  Understand the prerequisites for creating.
Creating an Oracle Database. Considerations before creating a DB Planning for Database Creation –Select the standard database block size. –Use an undo.
10 Copyright © Oracle Corporation, All rights reserved. User-Managed Backups.
Configuring the Database Archiving Mode
CERN IT Department CH-1211 Genève 23 Switzerland t Using Data Guard for hardware migration.
Implementing Oracle9i Data Guard Michael New Senior Technical Consultant ThinkSpark Session id:
Backup and Recovery Part 2. Online backup Online backup requirements: Backup all data files (file system copy) Backup all redo information produced during.
18 Copyright © 2004, Oracle. All rights reserved. Backup and Recovery Concepts.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
March 8, 2005 Bulletproofing, Backups, and Disaster Recovery Scenarios Presented by: Stephen Rea, University of Arkansas Cooperative Extension Service.
Agenda Data Guard Architecture & Features
April 2-5 Orlando, Florida Database Disaster Recovery and More Presented by: Stephen Rea University of Arkansas Cooperative Extension Service April 3,
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
Copyright  Oracle Corporation, All rights reserved. 3 Oracle Backup and Recovery Configuration.
Control File Information The database name The timestamp of database creation The names and locations of associated datafiles and redo log files Tablespace.
CERN IT Department CH-1211 Genève 23 Switzerland t Using Data Guard for hardware migration UKOUG RAC & HA SIG, Feb 2008 Miguel Anjo, CERN.
1 Implementing Oracle Data Guard for the RLS database Kasia Pokorska CERN, IT-DB 30 th March 2004.
 Database Administration Oracle Database Instance Management Starting Up and Shutting Down أ. ندى الغامدي, أ. ندى الطوالة.
3 Copyright © Oracle Corporation, All rights reserved. 管理数据库事例.
Configuring the Database Archiving Mode
Is 221: Database Administration
Oracle9i Database Administrator: Implementation and Administration
Understanding the Oracle Data Guard Architecture
Duplicating a Database
Performing Database Recovery
Chapter 5 The Redo Log Files.
Arkansas Banner Users Group (ABUG) 2006
Presentation transcript:

SETA Central 2006 Crashes Happen - Downtime Won't with Data Guard Stephen Rea Tuesday, October 10, :30 AM

Session Rules of Etiquette No smokin' No drinkin' No cussin' No tobaccer spittin' No tomater throwin'

Data Guard - Oracle's Answer to Disaster Recovery See how to quickly implement a Data Guard physical standby database in a day. Learn how to switch over to your standby database in minutes. Possibly offload your batch reporting workload to your standby database. Replace your forebodings about crashes with "Don't worry... be happy!" Oracle Data Guard Concepts and Administration Release 2 (9.2)

Data Guard Flow (Oracle 9i)

Data Guard Flow (Oracle 10g)

Data Guard Protection Modes Maximum Performance – –Updates committed to primary and sent to standby without waiting to see if they were applied to standby – –Pros: Little or no effect on performance of primary – –Cons: Slight chance of lost transactions (on failover) Maximum Availability (we will implement this one) – –Attempts to apply updates to standby before committed to primary – –Lowers protection to Maximum Performance temporarily if updates can't be applied to standby – –Pros: Primary continues unaffected if connection to standby is lost or the updates are delayed – –Cons: Slight performance hit on primary; lost transactions on failover possible only if the standby has been unreachable

Data Guard Protection Modes Maximum Protection – –Assures updates are applied to standby before committed to primary – –Pros: No chance of lost transactions – –Cons: Primary will freeze if connection to standby is lost or the updates are delayed Notes: We will be implementing a physical standby database locally on the same server here. Logical standby databases are not covered. Implementing the standby on a remote server will be similar - just use a different IP address, and the standby instance name can be the same as the primary in that case.

Primary Database Requirements for Data Guard FORCE LOGGING must be enabled: SQL> select force_logging from v$database; SQL> alter database force logging; ARCHIVELOG mode and automatic archiving must be enabled: SQL> archive log list MAXLOGFILES >= (2 * Current Redo Log Groups) + 1: SQL> select records_used "Current Groups", records_total "Max Groups" from v$controlfile_record_section where type = 'REDO LOG';

listener.ora Additions Define the standby database SID on the standby site: (SID_DESC= (SID_NAME=PROD2) (ORACLE_HOME=/pgms/oracle/product/v9204) ) (in $ORACLE_HOME/network/admin/listener.ora)

tnsnames.ora Additions Define the standby database connect string on the primary site: myserver_prod2 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = ) -- whatever host IP has PROD2 (Port = 1521) ) (CONNECT_DATA = (SID = PROD2) ) (define myserver_prod and myserver_prod2 on both primary and standby sites for quick switchovers)

sqlnet.ora and /etc/oratab Additions Enable dead connection detection on the primary and standby sites: sqlnet.expire_time=2 (in $ORACLE_HOME/network/admin/sqlnet.ora) Add the standby database's entry to /etc/oratab on the standby site: PROD2:/pgms/oracle/product/v9204:N

Standby Database Parameter File Create the initPROD2.ora parameter file to be used for the standby database (done from primary database): – –If your primary is using an spfile: $ sqlplus "/ as sysdba" SQL> create pfile='$ORACLE_HOME/dbs/initPROD2.ora' from spfile; – –Else, if your primary is using a pfile: $ cp -p $ORACLE_HOME/dbs/initPROD.ora $ORACLE_HOME/dbs/initPROD2.ora Note: We will be modifying both the primary and standby parameter files to handle being in either the primary or the standby mode for quick switchovers.

Standby Database Parameters (changes in copy of primary's values) Change pathnames, such as control_files, background_dump_dest, core_dump_dest, user_dump_dest, and audit_file_dest, and add: # log_archive_dest = /orcl/oradata/PROD2/archivelogs log_archive_dest_1 = 'LOCATION=/orcl/oradata/PROD2/archivelogs MANDATORY' # for switchover log_archive_dest_state_1 = ENABLE # for switchover log_archive_dest_2 = 'SERVICE=myserver_prod LGWR SYNC' # for switchover log_archive_dest_state_2 = ENABLE # for switchover standby_archive_dest = /orcl/oradata/PROD2/archivelogs standby_file_management = AUTO # or MANUAL for raw devices remote_archive_enable = TRUE # TRUE or RECEIVE, change RECEIVE to SEND on switchover instance_name = PROD2 lock_name_space = PROD2 # use when primary and standby on same system; same as instance_name fal_server = myserver_prod # "fal" is Fetch Archive Log, for log gap resolution fal_client = myserver_prod2 db_file_name_convert = ('/PROD/','/PROD2/') log_file_name_convert = ('/PROD/','/PROD2/') audit_file = false # can't audit in a read-only standby database!

Primary Database Parameters (changes in primary's values) # log_archive_dest = /orcl/oradata/PROD/archivelogs log_archive_dest_1 = 'LOCATION=/orcl/oradata/PROD/archivelogs MANDATORY' log_archive_dest_state_1 = ENABLE log_archive_dest_2 = 'SERVICE=myserver_prod2 LGWR SYNC' log_archive_dest_state_2 = ENABLE standby_archive_dest = /orcl/oradata/PROD/archivelogs # for switchover standby_file_management = AUTO # for switchover; or MANUAL for raw devices remote_archive_enable = TRUE # TRUE or SEND, change SEND to RECEIVE on switchover instance_name = PROD lock_name_space = PROD # use when primary and standby on same system; same as instance_name fal_server = myserver_prod2 # for switchover fal_client = myserver_prod # for switchover db_file_name_convert = ('/PROD2/','/PROD/') # for switchover log_file_name_convert = ('/PROD2/','/PROD/') # for switchover (If primary uses spfile, wait until after the standby database files are copied/created to make these parameter changes.)

Standby Database Datafiles, etc. Create the standby control file from the primary database: SQL> alter database create standby controlfile as '/orcl/oradata/PROD2/ctrl_PROD_01.ctl'; Shut down the primary database and copy or FTP its datafiles, redo log files, and the just- created standby parameter file and standby control file, to the standby site.

Standby Database Datafiles, etc. Copy the standby control file on the standby site to the other file names listed in the control_files init.ora parameter. Create the standby's password file, if needed, on the standby site: $ orapwd file=$ORACLE_HOME/dbs/orapwPROD2 password= entries=5 Reload the listener on the primary and standby sites: $ lsnrctl reload

Standby Database Startup Start the standby database in nomount mode, create the spfile if wanted, mount the standby database, and change to managed recovery: $. oraenv PROD2 $ sqlplus "/ as sysdba" SQL> create spfile from pfile; SQL> startup nomount SQL> alter database mount standby database; SQL> alter database recover managed standby database disconnect from session; SQL> exit

Primary Database Startup If your primary is using an spfile, set the primary database parameters in the spfile as listed earlier. Sample "alter system" commands are shown below: SQL> startup nomount SQL> alter system reset log_archive_dest scope=spfile sid='*'; SQL> alter system set log_archive_dest_1 = 'LOCATION=/orcl/oradata/PROD/archivelogs MANDATORY' scope=spfile; … etc … SQL> shutdown

Primary Database Startup Start up the primary database with the new parameters: SQL> startup Start archiving to the standby database by issuing a log switch: SQL> alter system switch logfile; Congratulations! You now have a working standby database for your primary database. But wait … There's more …

Add Standby Redo Log Groups to Standby Database (reqd in 10g) Create standby redo log groups on standby database (start with next group number; create one more group than current number of groups) after switching out of managed recovery mode: SQL> sqlplus "/ as sysdba" SQL> alter database recover managed standby database cancel; SQL> alter database open read only; SQL> select max(group#) maxgroup from v$logfile; SQL> select max(bytes) / 1024 "size (K)" from v$log; SQL> alter database add standby logfile group 4 ('/orcl/oradata/PROD2/stby_log_PROD_4A.rdo', '/orcl/oradata/PROD2/stby_log_PROD_4B.rdo') size 4096K; … etc … SQL> column member format a55 SQL> select vs.group#,vs.bytes,vl.member from v$standby_log vs, v$logfile vl where vs.group# = vl.group# order by vs.group#,vl.member;

Add Tempfile to the Standby Add a tempfile to the standby database for switchover or read-only access, then, switch back to managed recovery: SQL> alter tablespace temp add tempfile '/data/oradata/PROD2/temp_PROD_01.dbf' size K reuse; SQL> alter database recover managed standby database disconnect from session; SQL> select * from v$tempfile; SQL> exit

Add Standby Redo Log Groups to the Primary Database Create standby logfile groups on the primary database for switchovers (start with next group number; create one more group than current number of groups): $ sqlplus "/ as sysdba" SQL> select max(group#) maxgroup from v$logfile; SQL> select max(bytes) / 1024 "size (K)" from v$log; SQL> alter database add standby logfile group 4 ('/orcl/oradata/PROD/stby_log_PROD_4A.rdo', '/orcl/oradata/PROD/stby_log_PROD_4B.rdo') size 4096K; … etc … SQL> column member format a55 SQL> select vs.group#,vs.bytes,vl.member from v$standby_log vs, v$logfile vl where vs.group# = vl.group# order by vs.group#,vl.member;

Switch To Maximum Availability Protection Mode Switch to the desired "maximum availability" protection mode on the primary database (from the default "maximum performance"): SQL> select value from v$parameter where name = 'log_archive_dest_2'; -- must show LGWR SYNC SQL> shutdown normal SQL> startup mount SQL> alter database set standby database to maximize availability; SQL> alter database open; SQL> select protection_mode from v$database;

Test Updates Propagating to the Standby Database Try some edits on the primary and check to see that the changes made it to the standby: – –On the primary: SQL> update spriden set spriden_first_name = 'James' where spriden_pidm = 1234 and spriden_change_ind is null; SQL> commit; SQL> alter system switch logfile; – –On the standby (wait a few seconds first): SQL> alter database recover managed standby database cancel; SQL> alter database open read only; SQL> select * from spriden where spriden_pidm = 1234 and spriden_change_ind is null; SQL> alter database recover managed standby database disconnect from session;

Running Reports with a Standby Database Set standby to Read Only to run reports: SQL> alter database recover managed standby database cancel; SQL> alter database open read only; SQL> alter database recover managed standby database disconnect from session;

Shutdown and Startup for a Standby Database To shut down a standby database: – –If in read-only access, switch back to managed recovery (after terminating any other active sessions): SQL> alter database recover managed standby database disconnect from session; – –Cancel managed recovery and shutdown: SQL> alter database recover managed standby database cancel; SQL> shutdown immediate To start up a standby database: SQL> startup nomount SQL> alter database mount standby database; SQL> alter database recover managed standby database disconnect from session;

Switchover - Swapping Primary and Standby End all activities on the primary and standby database. On the primary (switchover status should show "TO STANDBY"): SQL> select database_role,switchover_status from v$database; SQL> alter database commit to switchover to physical standby; SQL> shutdown immediate SQL> startup nomount SQL> alter database mount standby database; On the standby (switchover status should show "SWITCHOVER PENDING"): SQL> select database_role,switchover_status from v$database; SQL> alter database commit to switchover to primary; SQL> shutdown normal SQL> startup On the primary: SQL> alter database recover managed standby database disconnect from session; On the standby: SQL> alter system archive log current; Change tnsnames.ora entry on all servers to swap the connect strings (myserver_prod and myserver_prod2).

Failover - Standby Becomes Primary End all activities on the standby database. May need to resolve redo log gaps (not shown here). On the standby: SQL> alter database recover managed standby database finish; SQL> alter database commit to switchover to primary; SQL> shutdown immediate SQL> startup Change tnsnames.ora entry on all servers to point the primary connect string to the standby database. New standby needs to be created. Old primary is no longer functional.

Summary Data Guard provides an automated standby database which can essentially eliminate downtime of your production data. Setup is easy and fairly straightforward. Maintenance is minimal. Switchovers and failovers can be done within a few minutes. Reporting can be offloaded to the standby to ease the workload on the primary. And … It's Free! (Included with Enterprise Edition)

Whew! Glad That’s Over! Any Questions?

Presenter Information Stephen Rea, Oracle Database Administrator Univ of AR Cooperative Extension Service 2301 S. University Avenue P.O. Box 391 Little Rock, AR