redgate how to be friends with developers

36
How to Become Friends with Developers and Stop Making DBA Stand for "Don't Bother Asking" March 27, 2013 Presented by: Kellyn Pot’Vin Sr. Technical Consultant, Enkitec

Upload: kellyn-potvin-gorman

Post on 21-Aug-2015

2.424 views

Category:

Technology


1 download

TRANSCRIPT

How to Become Friends with Developers and Stop Making DBA

Stand for "Don't Bother Asking"

March 27, 2013

Presented by: Kellyn Pot’VinSr. Technical Consultant, Enkitec

2

Who am I?

• Resides in Westminster, Colorado• Oracle ACE, Sr. Technical Specialist at

Enkitec• Specialize in performance and enterprise

management of large database environments.

• Board of directors for RMOUG, Director of Training Days 2014 and Database Track Lead for KSCOPE 2013

• Blog: http://DBAKevlar.com• Twitter: @DBAKevlar• Expert EM12c Book- May 16th from

Apress

3

Why This Topic?

• Conversations with User Group Members/peers.

• How Often I Experience it professionally.

• Read about it often in blogs, articles and in books.

• Some of my biggest wins, consider my most important compliments had to do with this subject.

• When first learning, others would seek me out over others who knew more because of it.

4

The Valued Lesson

• First “official” Job as a DBA• First Time Managing

MSSQL• Instructed NOT to Speak to

Dev/App Group.• Two Frustrating Weeks.• Broke “No Communication”

Rule• Great Experience• Supported for Four Years

5

The Ball and Chain

“If you have been in IT long enough, you are probably aware that most DBAs don't get along well with the developers.

They are somewhat akin to a husband and wife who don’t like each other but can't get a divorce.“

6

Different Goals

Developer Goals- To implement new business enhancements, often by a deadline.

Database Administrator- Ensure that database environments are accessible and functioning 24X7 without any interruption to service.

Outside Influencers- To ensure they get what they want, even if requirements given to Developers are unattainable and risk production uptime for Database Administrators.

7

Negative Culture“[Most] DBAs aren't happy unless they're well established as the bottlenecks in the [development] process.”

“If Shakespeare were alive in 2012, he’d be a technical writer, and his motto would be: “Kill all the DBAs.”

“Why does it take two developers to change a light bulb? Because one always leaves in the middle of the project.“

“The Only way I know to deal with Developers involves a bat!”

Now, try substituting an minority or racial group when you say anything similar to the above comments and you may think twice about what may have become culturally acceptable in the workplace.

8

What Many DBA’s Think is Required to talk to Developers

Dangerous Borderline Safe Safest

Your code sucks

Interesting coding choice

Would you like to work on this together?

This is brilliant

Yeah, You’re not getting 2 TB for THIS.

You need 2TB of space for this?

I think we could rewrite this to use less temp.

This is brilliant

Why would you ever do this?

This may not be the best way to write this…

I’d like to recommend an alternative strategy.

This is brilliant

9

What Developers think is required to talk with DBA’sDangerous Borderline Safe Safest

Nothings Changed

Could something have changed?

I’m sure something must have changed.

You are absolutely correct.

The database sucks

Something seems to be up with the database.

Could you help me out and check the database?

You are absolutely correct.

It works great in dev and test.

We did test this, but it is having issues in production.

I could really use your help figuring out why its having issues in prod.

You are absolutely correct.

10

We Lack Respect, but Why?

• Deadlines• Demands of each group• Lack of respect for each role’s skill set

Truth is, both sides think they are Obi Wan and neither are Darth Vader!

11

Results• Impacts productivity• Causes Turnover, eliminating positions.• Costs business $$

In My Opinion-• Demands Developers to fill DBA positions in

hopes of meeting deadlines.• Reason for “Agile Like” development

processes.• Makes more demand for “open-source” tools

to circumvent RDBMS dependent environments.

12

Why DBA’s are Needed

Database Administrators and Developers primary roles require different mindsets. To play both roles often:• Is a conflict of interest.• Leaves priorities

unaddressed.• Lessens expertise.

13

Why we Need Developers

That differing mindset requires someone who can visualize quickly how to design a process, yet not overthink the issues that might arise, (that is the DBA’s job when time comes for code review!)

For a Developer to perform his tasks and maintain the database, do afterhours support, etc.??

14

Changing the Game

How do we change the never-ending battle?

First identify the source of the conflict-• Is it centralized?• Is it between certain

individuals?• Is it cultural in an

organization?• Are there outside

contributors?

15

Standing Up to the FightFind a responsible manager to buy-in.Focus on-• Cost to

• Resources• Deadlines• Goals• Revenue

• Changing the culture, not assigning blame.

If you are assigning blame, you may be part of the problem…

16

• Learn to code- some level, some platform.• Learn the database- the best DBA’s know their

data.• Participate in code reviews- Be a productive

participant.• Give read only access to key developers• Share with Developers what you know- it

shouldn’t look like magic!• Don’t make decisions based on control- base

them on the business’ best interest.• Never assume, request time to research and

have data behind findings.

As a DBA?

17

Options for Developers?• Educate yourself on how Oracle works and about

the Cost Based Optimizer, (CBO)• Help with production issues- you are often an

integral part of the solution!• Build your code to perform efficiently, not just

functionally.• Share your knowledge with the database

administrators.• Ensure that anything going to production is ready,

support your DBA!

18

When Communication Degrades

Focus on: • End-user experience instead of individual goals.• The value to the business• Do not personalize • Remember to show respect • Consult each other when opportunity presents

itself.• Support, do not sabotage the other group.• Possess higher authority when issues remain

unresolved.

19

Next Level…

• Review and verify that expectations were clearly defined.

• Verify that respect is being shown.• Don’t allow any negative competition.• Trust and confidence in the other’s capabilities to

complete their roles.• Live up to our own expectations.• Involve each group earlier in projects.• Final decision by higher authority when unable to

resolve disagreement is agreed to be followed.

20

What the DBA Should Always Do

• Ensure development database are FULL/recent copy of production environment.

• Ensure Development has FULL access to the development environment.

• Grant access to performance metrics.• Less than full copy allows for “assumptions” to

lead into testing scenarios.

If you have Enterprise Manager 12c, GRANT THEM ACCESS!!

21

Read Only Access in EM12c

• Create User, (Do not Create Like until you create first “read-only user”

• Choose to add the EM_ALL_VIEWER Role

22

Setting up Target AccessChoose Global Grants or Target Specific

23

Review and Submit

Set up target access with this login or use existing logins.

24

Target Level Logins

For logins to a target, they require the following:• Connect• View_any_dictionary• Advisor

Object Level Privileges for AWR:GRANT SELECT ON SYS.V_$DATABASE TO user; GRANT SELECT ON SYS.V_$INSTANCE TO user; GRANT EXECUTE ON SYS.DBMS_WORKLOAD_REPOSITORY TO user; GRANT SELECT ON SYS.DBA_HIST_DATABASE_INSTANCE TO user; GRANT SELECT ON SYS.DBA_HIST_SNAPSHOT TO user;

25

This is NOT GOOD

Or this:

26

What Developers Need to Know

• Know the difference between an explain plan and an execution plan.• The explain plan is the choice the CBO, (Cost

Based Optimizer) may choose.• The execution plan is the actual plan the

CBO made with a SQL statement.• Learn how to view temp usage.• Use SQL Monitor after DBA’s grant access.

27

Plans in 11g

Turn on Auto-Trace in SQL*Plus:SET AUTOTRACE ON

28

DBMS_XPLANCollect info from DBMS_XPLAN:

Execute Query,SELECT * FROM

TABLE(DBMS_XPLAN.DISPLAY_CURSOR(format=>'ADVANCED'));

29

What is the Cost Based Optimizer

The Cost Based Optimizer, aka CBO:Determines the most efficient path to executing a SQL statement.

CBO choices are impacted by:• Parameters, such as OPTIMIZER_MODE• Session level parameters.• Statement Hints• Statistics and Dynamic Sampling• Parallelism, (High DOP)• Complex design• THE SQL• ….

30

Viewing Temp and Memory Usage

select vst.sql_text, swa.sql_id, swa.sid, swa.tablespace, swa.operation_type, trunc(swa.work_area_size/1024/1024) "PGA MB", trunc(swa.max_mem_used/1024/1024)"Mem MB", trunc(swa.tempseg_size/1024/1024)"Temp MB"from v$sql_workarea_active swa, v$session vs, v$sqltext vstwhere swa.sid=vs.sidand swa.sql_id=vs.sql_idand vs.sql_id=vst.sql_idand vst.piece=0order by swa.sql_id

SELECT i.COL1, COUNT(t.col4) i.col3 4jv6ja2qa2p7z 515 GROUP BY (HASH) 996 15 SELECT i.COL1, COUNT(t.col4) i.col3 4jv6ja2qa2p7z 515 TEMP BUFFER 1 97 23

31

SQL Monitor

32

SQL Monitor Features

• Status of process- active or complete• Wait information, including legend color.

33

SQL Monitor with Parallel

• Parallel, requested vs. allocated.• Instance ID for RAC and SQL_ID links

34

We’re All In This Together!

• Trust and common vision should be the goal.

• Performance is part of the goal, not just functionality.

• If you aren’t helping, you’re hindering.• Its the business’ database, no one

else has a right to ownership. • Being right is not always the same as

doing the right thing.

35

ReferencesDBAs Gone Badhttp://c2.com/cgi/wiki?DbasGoneBadCan DBAs and Programmers Ever Get Along?http://www.creativemac.com/articles/viewarticle.jsp?id=37828-1Communication and the Database Worldhttp://www.scarydba.com/2011/03/21/communication/Kerry Osborne, Oracle Performance for Developers and the DBA’s that Love Themhttp://kerryosborne.oracle-guy.com/papers/Oracle_Performance_for_Developers_and_the_DBAs_Who_Love_Them-Final.pdfSolving the Problem of Prima-Donna Developershttp://www.techrepublic.com/article/solving-the-problem-of-prima-donna-developers/1046043Survival Tps for Developers/DBA’s: How to talk to [Each Other]http://thomaslarock.com/2012/08/survival-tips-for-developers-how-to-talk-to-your-dba/

36

Questions?

Fastest Growing Companies in Dallas

[email protected]://dbakevlar.comTwitter- @dbakevlarLinkedin- Kellyn Pot’vin