Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert...

24
Expert Consolidation in Oracle Database 12c Martin Bach

Transcript of Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert...

Page 1: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

Expert Consolidation in Oracle Database 12c

Martin Bach

Page 2: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

Expert Consolidation in Oracle Database 12c

Copyright © 2013 by Martin Bach

This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law.

ISBN-13 (pbk): 978-1-4302-4428-8

ISBN-13 (electronic): 978-1-4302-4429-5

Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.

The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.

While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.

President and Publisher: Paul ManningLead Editor: Jonathan GennickTechnical Reviewer: Frits HooglandEditorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Louise Corrigan, Morgan Ertel,

Jonathan Gennick, Jonathan Hassell, Robert Hutchinson, Michelle Lowman, James Markham, Matthew Moodie, Jeff Olson, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Gwenan Spearing, Matt Wade, Tom Welsh

Coordinating Editor: Kevin SheaCopy Editor: Lori CavanaughCompositor: SPi GlobalIndexer: SPi GlobalArtist: SPi GlobalCover Designer: Anna Ishchenko

Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com.

For information on translations, please e-mail [email protected], or visit www.apress.com.

Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales.

Any source code or other supplementary materials referenced by the author in this text is available to readers at www.apress.com. For detailed information about how to locate your book’s source code, go to www.apress.com/source-code.

Page 3: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

iii

Contents at a Glance

About the Author ���������������������������������������������������������������������������������������������������������������� xv

About the Technical Reviewer ������������������������������������������������������������������������������������������ xvii

Acknowledgments ������������������������������������������������������������������������������������������������������������� xix

Introduction ����������������������������������������������������������������������������������������������������������������������� xxi

Chapter 1: Consolidation as an industry trend ■ ������������������������������������������������������������������1

Chapter 2: Oracle 12c New Features ■ �������������������������������������������������������������������������������25

Chapter 3: Supporting Hardware ■ �������������������������������������������������������������������������������������71

Chapter 4: Supporting Software ■ ������������������������������������������������������������������������������������109

Chapter 5: Installing Oracle Linux ■ ��������������������������������������������������������������������������������139

Chapter 6: Installing the Oracle Database ■ ���������������������������������������������������������������������177

Chapter 7: Pluggable Databases ■ �����������������������������������������������������������������������������������223

Chapter 8: Monitoring the Hosting Platform ■ ������������������������������������������������������������������273

Chapter 9: Learning About Data Guard ■ ��������������������������������������������������������������������������317

Chapter 10: Implementing Data Guard ■ ��������������������������������������������������������������������������337

Chapter 11: Backup and Recovery ■ ��������������������������������������������������������������������������������375

Chapter 12: Upgrading to Oracle 12c ■ ����������������������������������������������������������������������������417

Index ���������������������������������������������������������������������������������������������������������������������������������455

Page 4: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c
Page 5: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

v

Contents

About the Author ���������������������������������������������������������������������������������������������������������������� xv

About the Technical Reviewer ������������������������������������������������������������������������������������������ xvii

Acknowledgments ������������������������������������������������������������������������������������������������������������� xix

Introduction ����������������������������������������������������������������������������������������������������������������������� xxi

Chapter 1: Consolidation as an industry trend ■ ������������������������������������������������������������������1

Consolidation ���������������������������������������������������������������������������������������������������������������������������������2

End of life announcements-Hardware ������������������������������������������������������������������������������������������������������������������� 3

Support policy for Oracle Software ������������������������������������������������������������������������������������������������������������������������ 3

Different kinds of consolidation ����������������������������������������������������������������������������������������������������������������������������� 5

Virtualization ���������������������������������������������������������������������������������������������������������������������������������6

Benefits of virtualization ���������������������������������������������������������������������������������������������������������������������������������������� 7

More virtualization options ������������������������������������������������������������������������������������������������������������������������������������ 7

A stepping stone on the way to the cloud ������������������������������������������������������������������������������������������������������������� 8

Cloud computing ���������������������������������������������������������������������������������������������������������������������������8

Infrastructure as a Service ���������������������������������������������������������������������������������������������������������������������������������� 10

Software as a Service ������������������������������������������������������������������������������������������������������������������������������������������ 10

Platform as a Service ������������������������������������������������������������������������������������������������������������������������������������������ 11

The Public Cloud �������������������������������������������������������������������������������������������������������������������������������������������������� 11

The Private Cloud ������������������������������������������������������������������������������������������������������������������������������������������������� 11

Security in the cloud �������������������������������������������������������������������������������������������������������������������������������������������� 12

Use for the cloud hype ����������������������������������������������������������������������������������������������������������������������������������������� 12

Page 6: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ Contents

vi

Automation ����������������������������������������������������������������������������������������������������������������������������������12

Processes with the potential for automation ������������������������������������������������������������������������������������������������������� 12

Auditing and securing automated processes ������������������������������������������������������������������������������������������������������ 14

The importance of standards for support ������������������������������������������������������������������������������������14

Integrating acquisitions and mergers ������������������������������������������������������������������������������������������������������������������ 14

How much standardization is needed? ��������������������������������������������������������������������������������������������������������������� 15

Standardization of the full stack �������������������������������������������������������������������������������������������������������������������������� 16

Potential storage standards ��������������������������������������������������������������������������������������������������������������������������������� 16

Potential operating system standards ����������������������������������������������������������������������������������������������������������������� 17

Potential database standards ������������������������������������������������������������������������������������������������������������������������������ 17

Difficulties with the current operational model ��������������������������������������������������������������������������������������������������� 18

Changes in the hardware world ��������������������������������������������������������������������������������������������������18

The Linux operating (eco-) system ����������������������������������������������������������������������������������������������20

A little bit of (UNIX) history ���������������������������������������������������������������������������������������������������������������������������������� 20

Enter Linus ����������������������������������������������������������������������������������������������������������������������������������������������������������� 21

Why is Linux so popular? ������������������������������������������������������������������������������������������������������������������������������������� 23

Summary �������������������������������������������������������������������������������������������������������������������������������������24

Chapter 2: Oracle 12c New Features ■ �������������������������������������������������������������������������������25

Changes for Developers ��������������������������������������������������������������������������������������������������������������25

The Quest for Security and Least Privilege ���������������������������������������������������������������������������������������������������������� 25

Other Improvements �������������������������������������������������������������������������������������������������������������������������������������������� 32

Changes Relevant to Database Availability ���������������������������������������������������������������������������������39

Brief Introduction to Real Application Clusters ���������������������������������������������������������������������������������������������������� 40

Brief Introduction to Automatic Storage Management ���������������������������������������������������������������������������������������� 42

Enhancements in the Cluster Layer ��������������������������������������������������������������������������������������������������������������������� 43

Non-RAC Options to Increase Availability ������������������������������������������������������������������������������������������������������������ 47

Data and Information Lifecycle Management �����������������������������������������������������������������������������50

Storage Tiers ������������������������������������������������������������������������������������������������������������������������������������������������������� 50

Partitioning ���������������������������������������������������������������������������������������������������������������������������������������������������������� 51

Automatic Data Optimization in Oracle 12c ��������������������������������������������������������������������������������������������������������� 51

Page 7: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ Contents

vii

Infrastructure Changes ����������������������������������������������������������������������������������������������������������������54

Database Resident Connection Pool Exposed to Middle Tier ������������������������������������������������������������������������������� 54

Copy-on-Write for Cloning Databases ����������������������������������������������������������������������������������������������������������������� 55

Deprecation of OEM DB Console �������������������������������������������������������������������������������������������������������������������������� 59

Shaping of Network Traffic ���������������������������������������������������������������������������������������������������������������������������������� 65

Threaded Architecture ����������������������������������������������������������������������������������������������������������������������������������������� 65

Summary �������������������������������������������������������������������������������������������������������������������������������������70

Chapter 3: Supporting Hardware ■ �������������������������������������������������������������������������������������71

Enabling Hardware ����������������������������������������������������������������������������������������������������������������������71

Blades or Rack-Mounted? ����������������������������������������������������������������������������������������������������������������������������������� 72

Changes in the Hardware World �������������������������������������������������������������������������������������������������������������������������� 74

Thoughts About the Storage Backend ����������������������������������������������������������������������������������������������������������������� 74

Consolidation Features in Linux ��������������������������������������������������������������������������������������������������82

Non-Uniform Memory Architecture with Intel X86–64����������������������������������������������������������������������������������������� 82

Control Groups ����������������������������������������������������������������������������������������������������������������������������������������������������� 85

Benchmarks ��������������������������������������������������������������������������������������������������������������������������������89

FIO ����������������������������������������������������������������������������������������������������������������������������������������������������������������������� 90

Oracle I/O numbers ���������������������������������������������������������������������������������������������������������������������������������������������� 94

Silly little Oracle Benchmark ������������������������������������������������������������������������������������������������������������������������������� 99

Summary �����������������������������������������������������������������������������������������������������������������������������������108

Chapter 4: Supporting Software ■ ������������������������������������������������������������������������������������109

Enabling Software Solutions �����������������������������������������������������������������������������������������������������109

High Availability Considerations ������������������������������������������������������������������������������������������������������������������������ 109

Disaster Recovery Considerations ��������������������������������������������������������������������������������������������������������������������� 111

Virtualization Examples �������������������������������������������������������������������������������������������������������������112

Oracle Solaris Zones ������������������������������������������������������������������������������������������������������������������������������������������ 112

Oracle VM Server for x86 ����������������������������������������������������������������������������������������������������������������������������������� 120

Final Thoughts on Virtualization ������������������������������������������������������������������������������������������������������������������������� 129

Page 8: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ Contents

viii

High Availability Example ����������������������������������������������������������������������������������������������������������129

Oracle Clusterware HA Framework �������������������������������������������������������������������������������������������130

Installing a Shared Oracle RDBMS Home ���������������������������������������������������������������������������������������������������������� 131

Installing the Shared Database Binaries ������������������������������������������������������������������������������������������������������������ 133

Creating the Database ��������������������������������������������������������������������������������������������������������������������������������������� 133

Registering the Database with Clusterware ������������������������������������������������������������������������������������������������������ 134

Managing the Database ������������������������������������������������������������������������������������������������������������������������������������� 137

Summary �����������������������������������������������������������������������������������������������������������������������������������138

Chapter 5: Installing Oracle Linux ■ ��������������������������������������������������������������������������������139

Installing Oracle Linux 6 ������������������������������������������������������������������������������������������������������������139

Manual Installation ��������������������������������������������������������������������������������������������������������������������140

Anaconda ����������������������������������������������������������������������������������������������������������������������������������������������������������� 141

Choice of storage devices ��������������������������������������������������������������������������������������������������������������������������������� 142

Network configuration ��������������������������������������������������������������������������������������������������������������������������������������� 143

Time zone settings and root password �������������������������������������������������������������������������������������������������������������� 144

Partitioning �������������������������������������������������������������������������������������������������������������������������������������������������������� 145

Boot loader configuration ���������������������������������������������������������������������������������������������������������������������������������� 150

Software installation ������������������������������������������������������������������������������������������������������������������������������������������ 150

Automated installation ��������������������������������������������������������������������������������������������������������������152

Preparing for PXE booting���������������������������������������������������������������������������������������������������������������������������������� 152

Making the installation tree available ���������������������������������������������������������������������������������������������������������������� 153

Setting up the TFTP server �������������������������������������������������������������������������������������������������������������������������������� 154

Configuring the Dynamic Host Configuration Protocol server ��������������������������������������������������������������������������� 156

Considerations for the Kickstart file ������������������������������������������������������������������������������������������������������������������ 158

Testing the automated installation �������������������������������������������������������������������������������������������������������������������� 160

Preparing for the Oracle Database installation �������������������������������������������������������������������������161

Installing additional packages ��������������������������������������������������������������������������������������������������������������������������� 161

Creating the operating system users and groups ���������������������������������������������������������������������������������������������� 161

Checking kernel parameters ����������������������������������������������������������������������������������������������������������������������������� 165

The Oracle mount points ����������������������������������������������������������������������������������������������������������������������������������� 167

Page 9: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ Contents

ix

Setting session limits ��������������������������������������������������������������������������������������������������������������������������������������� 168

Configuring large pages ������������������������������������������������������������������������������������������������������������������������������������ 169

Introducing the oracle-rdbms-server preinstall package ���������������������������������������������������������������������������������� 171

Configuring storage �������������������������������������������������������������������������������������������������������������������171

Partitioning LUNs ����������������������������������������������������������������������������������������������������������������������������������������������� 171

Configuring dm-multipath ��������������������������������������������������������������������������������������������������������������������������������� 173

Summary �����������������������������������������������������������������������������������������������������������������������������������176

Chapter 6: Installing the Oracle Database ■ ���������������������������������������������������������������������177

Preparing for the installation �����������������������������������������������������������������������������������������������������177

Staging the software ����������������������������������������������������������������������������������������������������������������������������������������� 177

Preparing your environment variables��������������������������������������������������������������������������������������������������������������� 178

Configuring your graphical user interface ��������������������������������������������������������������������������������������������������������� 178

Installing Oracle Restart ������������������������������������������������������������������������������������������������������������180

Interactive installation of Oracle Restart ����������������������������������������������������������������������������������������������������������� 180

Silent installation of Oracle Restart ������������������������������������������������������������������������������������������������������������������� 197

Automatic installation of Oracle Restart using RPM ������������������������������������������������������������������������������������������ 200

Installing the Oracle database ���������������������������������������������������������������������������������������������������205

Interactive installation of the RDBMS binaries �������������������������������������������������������������������������������������������������� 205

Silent Installation of the Database Software ����������������������������������������������������������������������������������������������������� 217

Automatic Installation of the Database Software RPM �������������������������������������������������������������������������������������� 219

Summary �����������������������������������������������������������������������������������������������������������������������������������221

Chapter 7: Pluggable Databases ■ �����������������������������������������������������������������������������������223

The consolidated hosting platform before Oracle 12�1 �������������������������������������������������������������223

Pluggable Databases to the rescue ������������������������������������������������������������������������������������������������������������������� 225

Guide to rest of chapter ������������������������������������������������������������������������������������������������������������������������������������� 227

Implementation details for Pluggable Databases ����������������������������������������������������������������������227

Physical structure of a CDB and PDB����������������������������������������������������������������������������������������������������������������� 227

The Pluggable Database ������������������������������������������������������������������������������������������������������������������������������������ 233

Page 10: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ Contents

x

Creating a Container Database ��������������������������������������������������������������������������������������������������234

Memory considerations for CDBs ���������������������������������������������������������������������������������������������������������������������� 235

Deciding about storing files ������������������������������������������������������������������������������������������������������������������������������� 236

Using Database Configuration Assistant to create a CDB ���������������������������������������������������������������������������������� 237

Creating a CDB using scripts ����������������������������������������������������������������������������������������������������������������������������� 239

Exploring the new CDB �������������������������������������������������������������������������������������������������������������������������������������� 242

Managing Pluggable Databases ������������������������������������������������������������������������������������������������242

Creating a Pluggable Database ������������������������������������������������������������������������������������������������������������������������� 242

Connecting to Pluggable Databases ������������������������������������������������������������������������������������������������������������������ 250

Moving within the CDB �������������������������������������������������������������������������������������������������������������������������������������� 251

PDB-specific initialization parameters �������������������������������������������������������������������������������������������������������������� 252

Considerations for hosted environments ����������������������������������������������������������������������������������������������������������� 252

Opening and closing PDBs ��������������������������������������������������������������������������������������������������������������������������������� 253

Users and roles in the context of a PDB ������������������������������������������������������������������������������������255

Creating common users ������������������������������������������������������������������������������������������������������������������������������������ 256

Creating local users ������������������������������������������������������������������������������������������������������������������������������������������� 258

Common roles ��������������������������������������������������������������������������������������������������������������������������������������������������� 259

Local roles ��������������������������������������������������������������������������������������������������������������������������������������������������������� 260

Playing nicely with others ���������������������������������������������������������������������������������������������������������260

Overview of Resource Manager in Oracle 12�1 ������������������������������������������������������������������������������������������������� 261

Resource Manager for the Container Database ������������������������������������������������������������������������������������������������� 261

Resource Manager for the Pluggable Database ������������������������������������������������������������������������������������������������ 265

Testing the Resource Plan ��������������������������������������������������������������������������������������������������������������������������������� 269

Instance Caging ������������������������������������������������������������������������������������������������������������������������������������������������� 271

Summary �����������������������������������������������������������������������������������������������������������������������������������271

Chapter 8: Monitoring the Hosting Platform ■ ������������������������������������������������������������������273

Oracle Enterprise Manager��������������������������������������������������������������������������������������������������������273

Extending Functionality via Plugins ������������������������������������������������������������������������������������������������������������������� 275

The Role of the Agent ���������������������������������������������������������������������������������������������������������������������������������������� 275

The Oracle Management Service����������������������������������������������������������������������������������������������������������������������� 276

The Enterprise Manager Repository ������������������������������������������������������������������������������������������������������������������ 276

Page 11: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ Contents

xi

Who Should Look After Enterprise Manager? ���������������������������������������������������������������������������������������������������� 277

Sizing Considerations ���������������������������������������������������������������������������������������������������������������������������������������� 277

Installing Cloud Control �������������������������������������������������������������������������������������������������������������279

Choosing the Operating System for the Management Host ������������������������������������������������������������������������������� 279

Preparing the Linux Operating System �������������������������������������������������������������������������������������������������������������� 280

Installing Enterprise Manager ��������������������������������������������������������������������������������������������������������������������������� 281

The Initial Configuration Steps �������������������������������������������������������������������������������������������������������������������������� 293

Creating and Managing Enterprise Manager Accounts ������������������������������������������������������������������������������������� 294

Managing Database Targets �����������������������������������������������������������������������������������������������������299

Deploying an Agent to a New Host �������������������������������������������������������������������������������������������������������������������� 299

Getting Agent Software for Different Platforms ������������������������������������������������������������������������������������������������� 303

The Manual Target Discovery Process ��������������������������������������������������������������������������������������������������������������� 305

Automatic Target Discovery Process ����������������������������������������������������������������������������������������������������������������� 307

Support for Pluggable Databases ���������������������������������������������������������������������������������������������������������������������� 308

Standardized Monitoring ����������������������������������������������������������������������������������������������������������������������������������� 309

Incident Management ���������������������������������������������������������������������������������������������������������������������������������������� 313

Summary �����������������������������������������������������������������������������������������������������������������������������������316

Chapter 9: Learning About Data Guard ■ ��������������������������������������������������������������������������317

An introduction to Oracle Data Guard ����������������������������������������������������������������������������������������318

Standby databases: A historical perspective �����������������������������������������������������������������������������319

Types of standby databases ������������������������������������������������������������������������������������������������������321

The physical standby database ������������������������������������������������������������������������������������������������������������������������� 322

The snapshot standby database ������������������������������������������������������������������������������������������������������������������������ 322

The logical standby database ���������������������������������������������������������������������������������������������������������������������������� 322

The transient logical standby database ������������������������������������������������������������������������������������������������������������� 323

The Active Data Guard Option ����������������������������������������������������������������������������������������������������323

Data protection modes ��������������������������������������������������������������������������������������������������������������324

Maximum Protection Mode �������������������������������������������������������������������������������������������������������������������������������� 324

Maximum Performance mode ��������������������������������������������������������������������������������������������������������������������������� 324

Maximum Availability mode ������������������������������������������������������������������������������������������������������������������������������� 325

Page 12: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ Contents

xii

Role transitions �������������������������������������������������������������������������������������������������������������������������325

An in-depth view on Data Guard terminology ���������������������������������������������������������������������������326

New Data Guard features in 12�1 ����������������������������������������������������������������������������������������������328

Better separation of duties for log shipping ������������������������������������������������������������������������������������������������������ 328

Better support for cascaded destinations ��������������������������������������������������������������������������������������������������������� 328

The Far Sync Standby Feature ��������������������������������������������������������������������������������������������������������������������������� 329

Ability to check for switchover readiness ���������������������������������������������������������������������������������������������������������� 330

Broker configuration can be renamed in place ������������������������������������������������������������������������������������������������� 332

Managing and administering Data Guard ����������������������������������������������������������������������������������333

Managing using SQL*Plus ��������������������������������������������������������������������������������������������������������������������������������� 333

Management using the Data Guard Broker ������������������������������������������������������������������������������������������������������� 333

Summary �����������������������������������������������������������������������������������������������������������������������������������334

Chapter 10: Implementing Data Guard ■ ��������������������������������������������������������������������������337

Naming considerations �������������������������������������������������������������������������������������������������������������337

Implementing Data Guard on a file system �������������������������������������������������������������������������������339

Configuring Data Guard with Oracle Managed Files������������������������������������������������������������������343

Creating a Data Guard Broker configuration �����������������������������������������������������������������������������346

Listener configuration ���������������������������������������������������������������������������������������������������������������������������������������� 349

Standby file management ���������������������������������������������������������������������������������������������������������������������������������� 350

Configuring redo application delay �������������������������������������������������������������������������������������������������������������������� 351

Enabling the configuration��������������������������������������������������������������������������������������������������������������������������������� 351

Changing the protection mode to maximum availability ����������������������������������������������������������������������������������� 352

Enabling Flashback on the standby ������������������������������������������������������������������������������������������������������������������� 353

Completely removing the Broker configuration �������������������������������������������������������������������������354

Performing a graceful switchover operation �����������������������������������������������������������������������������354

Performing a failover operation �������������������������������������������������������������������������������������������������357

Performing an immediate failover ��������������������������������������������������������������������������������������������������������������������� 358

Performing a complete failover ������������������������������������������������������������������������������������������������������������������������� 359

Reinstating the old primary database ��������������������������������������������������������������������������������������������������������������� 360

Page 13: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ Contents

xiii

Creating a lights-out configuration using the Broker ����������������������������������������������������������������361

Maintaining archived logs ���������������������������������������������������������������������������������������������������������366

Data Guard specifics for Pluggable Databases �������������������������������������������������������������������������369

Creating a new Pluggable Database on the primary database �������������������������������������������������������������������������� 369

The effect of plugging in PDBs into the primary ������������������������������������������������������������������������������������������������ 370

Unplugging PDBs from the primary ������������������������������������������������������������������������������������������������������������������� 371

Dropping a PDB from the primary ��������������������������������������������������������������������������������������������������������������������� 372

Summary ����������������������������������������������������������������������������������������������������������������������������������373

Chapter 11: Backup and Recovery ■ ��������������������������������������������������������������������������������375

An introduction to Backups �������������������������������������������������������������������������������������������������������375

RMAN backups �������������������������������������������������������������������������������������������������������������������������������������������������� 376

The database incarnation ���������������������������������������������������������������������������������������������������������������������������������� 378

The Fast Recovery Area ������������������������������������������������������������������������������������������������������������������������������������� 378

Logical backups ������������������������������������������������������������������������������������������������������������������������������������������������� 380

Additional technology available ������������������������������������������������������������������������������������������������������������������������� 381

Noteworthy new RMAN features in Oracle 12�1 ������������������������������������������������������������������������384

The SYSBACKUP role ����������������������������������������������������������������������������������������������������������������������������������������� 384

Ability to execute SQL directly in RMAN ������������������������������������������������������������������������������������������������������������ 385

Enhanced over-the-network features ���������������������������������������������������������������������������������������������������������������� 386

Point-in-Time Table Recovery ���������������������������������������������������������������������������������������������������������������������������� 389

Taking RMAN backups ���������������������������������������������������������������������������������������������������������������391

Considerations for the Recovery Catalog ���������������������������������������������������������������������������������������������������������� 391

Configuring the RMAN environment ������������������������������������������������������������������������������������������������������������������ 394

Technical aspects around RMAN backups ��������������������������������������������������������������������������������������������������������� 398

Restore and Recovery ���������������������������������������������������������������������������������������������������������������401

Restoring the server parameter file ������������������������������������������������������������������������������������������������������������������� 402

Restoring the control file ����������������������������������������������������������������������������������������������������������������������������������� 404

Restoring databases ������������������������������������������������������������������������������������������������������������������������������������������ 405

Page 14: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ Contents

xiv

The need for testing ������������������������������������������������������������������������������������������������������������������412

Introduction to Querying RMAN metadata ���������������������������������������������������������������������������������412

Refreshing an environment �������������������������������������������������������������������������������������������������������414

Summary �����������������������������������������������������������������������������������������������������������������������������������416

Chapter 12: Upgrading to Oracle 12c ■ ����������������������������������������������������������������������������417

The upgrade path to Oracle database 12c ��������������������������������������������������������������������������������417

Before you upgrade production��� ����������������������������������������������������������������������������������������������419

Upgrading Oracle Restart on the same server ��������������������������������������������������������������������������420

The upgrade path for Oracle Restart ����������������������������������������������������������������������������������������������������������������� 421

Unsetting environment variables ����������������������������������������������������������������������������������������������������������������������� 421

Performing the Upgrade ������������������������������������������������������������������������������������������������������������������������������������ 422

Performing additional post-migration validation ����������������������������������������������������������������������������������������������� 425

Using Oracle Restart 12c and previous database releases in parallel��������������������������������������������������������������� 426

Upgrading the database ������������������������������������������������������������������������������������������������������������427

High level steps ������������������������������������������������������������������������������������������������������������������������������������������������� 428

Performing a database software-only installation��������������������������������������������������������������������������������������������� 429

Running the pre-upgrade tool ��������������������������������������������������������������������������������������������������������������������������� 430

Making a database available for a first test migration �������������������������������������������������������������������������������������� 431

Performing the upgrade ������������������������������������������������������������������������������������������������������������������������������������ 432

Performing necessary post-upgrade steps ������������������������������������������������������������������������������������������������������� 435

Upgrading the database with the Database Upgrade Assistant ������������������������������������������������������������������������ 436

Consolidating migrated databases ��������������������������������������������������������������������������������������������443

Updating the compatible parameter ������������������������������������������������������������������������������������������������������������������ 444

Checking compatibility �������������������������������������������������������������������������������������������������������������������������������������� 445

Plugging the non-CDB into the CDB ������������������������������������������������������������������������������������������������������������������� 446

Moving the database into ASM ��������������������������������������������������������������������������������������������������448

Being able to downgrade ����������������������������������������������������������������������������������������������������������454

Summary �����������������������������������������������������������������������������������������������������������������������������������454

Index ���������������������������������������������������������������������������������������������������������������������������������455

Page 15: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

xv

About the Author

Martin Bach is an enthusiastic Oracle database administrator and co-author of Pro Oracle Database 11g RAC on Linux, also with Apress. He has specialized in the Oracle Database Management System since 2001. His main interests are high availability and disaster recovery solutions for mission-critical 24x7 systems.

Martin is a proud member of the Oracle Certified Master community as well as an Oracle Ace, an accreditation which has been awarded based on his significant contribution and activity in the Oracle technical community. The greatest honor of all is to be a part of the Oak Table Network. The Oak Table is an informal network for the Oracle scientist, who believes in better ways of administering and developing Oracle-based systems.

Martin maintains a successful weblog at martincarstenbach.wordpress.com in addition to his written publications, which is regularly updated with his latest research results and additional information about this book.

Page 16: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c
Page 17: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

xvii

About the Technical Reviewer

Frits Hoogland is an IT professional specializing in Oracle database performance and internals. Frits frequently presents on Oracle technical topics at conferences around the world. In 2009 he received an Oracle ACE award from the Oracle Technology Network and a year later became an Oracle ACE Director. In 2010 he joined the OakTable Network. In addition to developing his Oracle expertise, Frits works with MySQL, PostgreSQL, and modern operating systems. Frits currently works at Enkitec LP.

Page 18: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c
Page 19: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

xix

Acknowledgments

A book such as this one you are reading right now is never the sole effort of one single person—nobody is an island after all. Therefore I would like to thank the people who assisted in all stages of the researching, testing, writing, reviewing, and publication of this book. Fist I would like to thank the Apress team of Lead Editor Jonathan Gennick and coordinating Editor Kevin Shea for their patience, advice, and support, but also their input in getting this project started. For the technical review, I would like to thank Frits Hoogland for his time in reading, commenting, and improving the contents of the book. The technical reviewer too often does not get enough credit when you read a book as his name is not on the front cover. Frits however has been outstanding in thoroughness and dedication when it came to reviewing the contents of the book you are holding in your hands. I am very grateful for his contributions.

At this place it is time for me to thank the people who also helped with research and ideas. Steve Shaw—the lead author of Pro Oracle Database RAC 11g on Linux—has been inspirational in many ways and it was a great pleasure to have worked with him on the previous book we wrote. I tried to take his example when writing this book.

I would also like to thank the following people, and they are listed in no particular order: Kevin Closson, Chris Buckel, Matt Morris, Alex Gorbachev, Yury Velikanov, Doug Burns, The Oak Table Network, Martin Nash, Jerry Pride, Simon Haslam, Ronny Egner, Shirish Jamthe, and Kunal Vasavada. I had so many great conversations with people I worked for—and with—that cannot all be named here individually. I am sure those who remember a joint project will know who is meant. I also won’t ever forget the great atmosphere during after-work conversations with friends in London. I still remember how thrilled I was when I was first invited along. And last but certainly not at all least Kerry Osborne, Andy Colvin, Randy Johnson, Hank Tullis, Karl Arao, Tanel Poder, and everyone else at Enkitec that I don’t have space to list individually. It has been a fantastic journey.

Thinking back it has been a very long way from the humble beginning to where I am now. Invaluable support at the university was provided by Prof. Dr. Steinbuβ, who first started my enthusiasm for the Oracle Database. I can’t forget Jens Schweizer, Timo Philipps, Harald Ferber Axel Biesdorf, and Thorsten Häs for countless good hours in H105, and discussing more than just the most obvious solution to a problem. Furthermore I would also like to thank everyone at the “old” e-DBA for a lot of support during my first years in England.

It is important to me to point out that it is not only about the help of the Oracle community. I have been able to draw a lot of inspiration and passion from my supportive family. Without your help and understanding of the countless hours of research it would certainly not have been possible to finish this book at all.

Page 20: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c
Page 21: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

xxi

Introduction

Ever since I have started looking at the Oracle database engine a little more than a decade ago, I have been fascinated by its features and the way it integrates with the underlying platforms it runs on. Before studying Oracle at the university as part of my degree I was exposed to MySQL (still independent then, and version 3.23) and thought that Oracle couldn’t be so different. After all, it’s about insert, delete, update, and commit, right? It is almost ironic how wrong I was! Over the years there was only one thing that became clearer and clearer: the more I learned about the product, the less I thought I understood. Although that isn’t really the case, one can’t help escaping that feeling sometimes. Add in the constant change of the software to meet Oracle’s customer needs then you get the picture. What makes it difficult to keep up to date is the fact that you can find a lot of information—sometimes conflicting—on the Internet about our favorite database engine.

I personally think that all DBAs have to keep an open mind and try to do the best we can to keep up with new releases to provide an ultimately great service to our end users who should be happy to be able to use a well-maintained database estate. I hope the book you are about to read helps you on this mission: instead of having to dissect the available information “out there” I went through it and analyzed it to the best of my abilities so you don’t have to spend the same time and effort.

Note: ■ oracle as a company has acquired an enormous number of smaller and not-so-small companies during the last few years. When speaking of “oracle” in this book you can safely assume the database engine is being referred to, unless otherwise stated.

In this introduction the general structure of the book is presented, my motivation for writing it and a guide on how to approach the material. Don’t be intimidated by the page count, the chapters follow what I think is a logical structure.

How This Book Is StructuredThis book has been written with one goal in mind: to help technical and managerial staff alike to make best use of the most current Oracle database release in order to build a consolidated database environment. The book follows what could be a potential path to adopting a consolidation strategy for your company or a project. Although the focus clearly is with Linux and the x86-64 platforms, I have no intention of making this the platform of your choice for your consolidation project. Even though I think that you would be a very good value for the money out of this platform, it is by far not ideal to introduce an unknown platform to the already complex equation dealing with database consolidation. Many companies have a preferred hardware platform for which trained and experienced staff is available. Consolidation projects can be challenging, and do not need additional challenges by the introduction of an unfamiliar platform to the hardware estate.

Page 22: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ IntroduCtIon

xxii

If a new hardware platform is well maintained by the vendor though, who provides a balanced, well-engineered system right from the start then there is great value in such a product. Rather than going over a certification and validation cycle yourself you rely on the vendor to ensure that the components of the system are compatible, and that drivers as well as firmware combinations have been tried and tested. Oracle’s own Engineered Systems are a great example for this hardware category.

The book you are about to read tries to help you along the various stages of the consolidation project, from planning to implementation. In my opinion consolidation projects using Oracle 12c will need to provide answers to the following key questions:

Which Operating System should be chosen?•

How should the database instance be protected from failure?•

How can I increase availability for the solution?•

How much automation can be put into the provisioning of the stack?•

How can I make use of the new Pluggable Databases Feature?•

How should I monitor the environment?•

How do I protect the database from site failure, and how can it be backed up and recovered?•

It begins with background material about some of the current challenges in IT and ways users have already started coping with them. First of all it’s important to understand the importance of consolidation in the IT industry, and which technical evolutions in the x86-world made them possible. Another section in the same chapter describes the Cloud Computing hype, which every reader probably has heard about.

The next chapter introduces Oracle 12c: which features are new with the obvious focus on database consolidation but some other interesting ones as well. Other additional and noteworthy features making the DBA’s life easier will be introduced as well. Since there is a lot of uncertainty about Oracle Automatic Storage Management (ASM) in the field, a section has been dedicated to it.

The next chapters are dedicated to supporting infrastructure. Chapters 3 and 4 introduce different infrastructure options followed by various methods for protecting the consolidated database and offers other suggestions to the deployment of the database. The last thing anyone wants to see is a database containing a lot of critical information from multiple applications that crashes and creates an unnecessary and avoidable outage. Depending on how you want to play it and how much budget is available different ways for protecting the database instance are available. The chapters assume that you are building your own system rather than using one available.

Before one can install the Oracle software you have to install the underlying operating system. Although Oracle still exists for a large number of platforms I decided to present the installation of Linux. The probability that Linux will be used for your consolidation project is quite high and I am hoping to provide you with some benefit about the installation of the operating system.

Installing the Oracle software is the next logical step after the operating system has been configured properly. This again is demonstrated on the Linux platform. Following the Oracle installation you can read a chapter about Pluggable Databases, the exciting new consolidation features of Oracle 12c.

The following chapter is dedicated to monitoring Oracle 12c. A great number of monitoring tools are available for the Oracle database, but since Oracle themselves own their Enterprise Manager which has undergone substantial redevelopment for version 12 this tool has been chosen as the monitoring solution of choice.

No important production database deployment is complete without a disaster recovery solution. Chapters 9 and 10 cover Data Guard—one way of protecting the database from environment hazards and other catastrophes, small and large.

Similarly, deployments are not complete without a backup and recovery strategy. A dedicated chapter explores which tools are available for backup and recovery, and how to integrate them into the enterprise-wide solution.

The final chapter explains possible ways to upgrade to Oracle 12.1.

Page 23: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ IntroduCtIon

xxiii

A word about print screensOne of the comments I read about the previous book project I was involved in is related to print screens. An advanced Oracle user complained about the print screens, essentially saying that the use of print screens artificially inflated the contents of the book. Although I sympathize with the writer of the comment there are a few points I would like to add.

First of all, not everyone will have firsthand knowledge of Oracle 12c. DBAs who are about to install the new release for the first time might enjoy seeing the various screens in print when reading the book. I certainly would have! The same goes for screen output. You will find a lot of output from running commands in the book for the same reason: if you are about to perform a certain task you might find it comforting to see a little more output than just the command with the supplied command line arguments. In addition to providing more detail for the reader who can compare his to the book’s output I hope to also demonstrate that the contents of this book are based on true research. But please bear in mind that patches can alter the output of commands.

Please be careful with LicensesThis book is not a license guide. Please bear this in mind when reading about features and check with the Oracle website or your sales representative if a feature mentioned in the book is licensable separately. Notice that Oracle can change the license model over the time this book is available. You should double-check if a particular feature you would like to use requires a separate license or database pack.

ConventionsThroughout the book, I have tried to keep a consistent style for presenting commands and their results. Where a piece of code is presented in the text, it is presented in fixed-width font, such as this example. Where it made sense to display it you should see the context in which a command has been executed in the SQL*Plus SQLPROMPT variable.

SYS@CDB$ROOT> select name, cdb from v$database;

The syntax of the command is most often provided for reference, the preceding paragraphs should already have provided background information about the command.

A similar approach has been chosen for operating system commands. Normally you should see commands shown as in this example:

[oracle@server1 ~]> df –h /u01

The shell’s PS1 variable follows the conventions set on Oracle Linux 6.x and many other popular Linux distributions using the Bourne Again Shell (BASH) as their default command line interpreter. It shows the account name followed by the @-sign and the server name on which the command has been executed. The standard accounts you will see throughout the book are root, oracle, and grid.

You will notice that most of the shell-scripts are written for BASH as found on Oracle Linux 6.x. Shell scripts are not necessarily compatible between interpreters, and care should be used to evaluate and test scripts first before using them on actual systems.

Page 24: Expert Consolidation in Oracle Database 12c - Springer978-1-4302-4429-5/1.pdf · Expert Consolidation in Oracle Database 12c Martin Bach. Expert Consolidation in Oracle Database 12c

■ IntroduCtIon

xxiv

Critical thinking welcome!The book is written from my point of view, and opinions are my own. To loosely quote Jonathan Lewis: “just because it is written does not mean it is right.” If you disagree with passages of the book, I would like to know. Email me your questions and constructive remarks and I will be happy to reply. Since a book is a static object once in print I intend to provide errata and updates on my own and Apress’s website.

Downloading the codeThe code for the examples shown in this book is available on the Apress web site, www.apress.com. A link can be found on the book’s information page under the Source Code/Downloads tab. This tab is located underneath the Related Titles section of the page.