Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Using Edition-based redefinition with PL/SQL How to deploy database code changes.

Similar presentations


Presentation on theme: "Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Using Edition-based redefinition with PL/SQL How to deploy database code changes."— Presentation transcript:

1 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Using Edition-based redefinition with PL/SQL How to deploy database code changes with zero downtime Chris Saxon, Oracle Developer Advocate for SQL chris.saxon@oracle.com @chrisrsaxon & @sqldaily www.sqlfail.comwww.sqlfail.com & blogs.oracle.com/sqlblogs.oracle.com/sql

2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

3 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | The PL/SQL Deployment Challenge! How do we get PL/SQL into production with no outage?

4 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | The PL/SQL Deployment Challenge! Database may be INcon SIS tenT

5 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | The PL/SQL Deployment Challenge! No time to test

6 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | The PL/SQL Deployment Challenge! Can’t get DDL lock

7 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Emergency Rollback?

8 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Solutions pre-11gR2

9 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Rename Your Objects! YOUR_PKG_V1 -> YOUR_PKG_V2 -> YOUR_PKG_V3 -> etc.

10 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | PROCEDURE PACKAGE VIEW Rename Your Objects!

11 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | PROCEDURE PACKAGE VIEW PROCEDURE_V2 PACKAGE_V2 VIEW_V2 Rename Your Objects!

12 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Rename Your Objects! SMALL_VIEW_V3BIG_VIEW_V2SMALL_VIEW_V2 SOME_PKG_V5aSOME_PKG_V5b A_PKG_V3A_PROC_V3A_PROC_V5b

13 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Replicate Your Database and $$$

14 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Limited code reuse Lose native compilation No dependency management No Database Compiled PL/SQL!

15 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | EBR to the Rescue!

16 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | EDITION_1EDITION_2EDITION_3 EBR to the Rescue! PROCEDURE PACKAGE VIEW

17 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | How do I use EBR?

18 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Editions Enable Your Database Editions enable your users – alter user enable editions; There is no rollback command!

19 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Create the Edition Create an edition – create edition new_edition; Grant user privileges: – grant use on edition new_edition to my_user;

20 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Switch Edition and Deploy! Change current edition – Alter session set edition = new_edition; Compile your code

21 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Connect and Test Can specify in connection string: – ORA_EDITION environment variable – oracle.jdbc.editionName JDBC variable – Link database service to edition

22 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | That was too easy! Surely there must be a catch?

23 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Not Everything is Editionable MY_PACKAGE PUBLIC SYNONYM MATERIALIZED VIEW

24 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Not Everything is Editionable MY_PACKAGE PUBLIC SYNONYM MATERIALIZED VIEW

25 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Many editions > risk of missteaks

26 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Managing Multiple Editions Set your database default edition Remove access to old editions Good governance!

27 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Further Reading 11gR2 Documentation: http://docs.oracle.com/cd/E11882_01/appdev.112/e41502/adfns_editions.ht m#ADFNS020 http://docs.oracle.com/cd/E11882_01/appdev.112/e41502/adfns_editions.ht m#ADFNS020 12cR1 Documentation: http://docs.oracle.com/database/121/ADFNS/adfns_editions.htm http://docs.oracle.com/database/121/ADFNS/adfns_editions.htm Oracle-BASE article: http://oracle-base.com/articles/11g/edition-based- redefinition-11gr2.phphttp://oracle-base.com/articles/11g/edition-based- redefinition-11gr2.php Tom Kyte’s Oracle Magazine article, Edition-Based Redefinition, Part 1: http://www.oracle.com/technetwork/issue-archive/2010/10-jan/o10asktom- 172777.html http://www.oracle.com/technetwork/issue-archive/2010/10-jan/o10asktom- 172777.html Edition-based redefinition whitepaper, Bryn Llewellyn July 2009: http://www.oracle.com/technetwork/database/features/availability/edition- based-redefinition-1-133045.pdf http://www.oracle.com/technetwork/database/features/availability/edition- based-redefinition-1-133045.pdf

28 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Summary Use EBR to deploy PL/SQL with zero downtime Easier than replication More practical than package renaming Requires 11gR2+

29 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Questions?

30


Download ppt "Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Using Edition-based redefinition with PL/SQL How to deploy database code changes."

Similar presentations


Ads by Google