12
See what normal looks like. www.red-gate.com/sqlmonitor Effective SQL Server Monitoring By Tony Davis News, articles and advice from Red Gate How many databases were on each server? How big were these databases? How many users did they have? Which versions and editions of SQL Server were in use? Were they all patched and secure? Were all the databases getting regular backups? All of these were questions to which he had to find answers, and quickly. Having done so, he could then start to consider further questions relating to the performance of these servers, and the databases they housed. Were any of the specific databases resource hogs? Were there persistent/ recurring problems across any of the servers? It was a daunting task. The goal of this article is to offer a systematic roadmap for any DBA who lands in a similar situation, or more generally for any DBA who is not currently monitoring his or her SQL Server environment and wants to start. It describes what's required in terms of monitoring and A good DBA friend of mine recounted to me the tale of his first day at a new job. He received an Excel spreadsheet containing a list of server names, color-coded according to their purpose or availability level, and a pager. That was it. what options are available to fulfill the need. The monitoring solution must gather the metrics you need to diagnose any CPU, memory or I/O issues on your SQL Servers. It should also provide a set of accurate, reliable, configurable alerts that will inform us when jobs fail or fail to run, database or server properties that deviate from the established "standard", whether there are sustained spikes in resource usage or abnormal trends and so on. Why do we need all this monitoring? Two reasons, the first of which is capacity planning. Unless we know the server's resource limits (storage space, memory, I/O capacity and so on) and monitor current resource usage then we may not find out that we need to increase capacity until one of them "runs out". Continues on page 3 Everyday DBA? Database Administration as a Service By Grant Fritchey Database Administrators are, by our nature and the requirements of our job, control- oriented. We are like commissars in that we must maintain and enforce security mechanisms on the data from a business and regulatory standpoint. We prepare for disaster, outages and deletions of the information that defines and supports the businesses that pay us. We get up at 2:30AM on a Sunday to put out figurative, or even literal, fires. All of this reinforces that controlling nature and leads us to become, for want of a better term, jerks. This is a problem for the DBA profession. We need to stop. I think that we, as DBAs, can be better by embracing the ideas of "leadership through service". Continues on page 6 Stairway to Database Design By Joe Celko Not too surprisingly, the first step in database design is the data. But the truth is that too many programmers do not spend any time on designing their data and begin designing the schema first. It does not work. What SQL handles is structured data, as opposed to unstructured data like text or pictures. One of the basic concepts in RDBMSs is what Dr. Codd called the Information Principle. This rule states that all data in an RDBMS is modeled as scalar values in columns in rows in tables. Continues on page 9 10 ASK Essie Dating a Model db? Discover a secret child table? Essie has advice for you. 5 Learn Many Languages Why teach any other programming language when they will be using Modula-2 for all their working lives? 8 Eccentric? Pedantic? Correct? Living the life of a DBA.

Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

See what normal looks like.

www.red-gate.com/sqlmonitor

Effective SQL Server Monitoring

By Tony Davis

News, articles and advice from Red Gate

How many databases were on each server? How big were these databases? How many users did they have? Which versions and editions of SQL Server were in use? Were they all patched and secure? Were all the databases getting regular backups?

All of these were questions to which he had to fi nd answers, and quickly. Having done so, he could then start to consider further questions relating to the performance of these servers, and the databases they housed. Were any of the specifi c databases resource hogs? Were there persistent/recurring problems across any of the servers?

It was a daunting task. The goal of this article is to offer a systematic roadmap for any DBA who lands in a similar situation, or more generally for any DBA who is not currently monitoring his or her SQL Server environment and wants to start. It describes what's required in terms of monitoring and

A good DBA friend of mine recounted to me the tale of his fi rst day at a new job. He received an Excel spreadsheet containing a list of server names, color-coded according to their purpose or availability level, and a pager. That was it.

what options are available to fulfi ll the need. The monitoring solution must gather the

metrics you need to diagnose any CPU, memory or I/O issues on your SQL Servers. It should also provide a set of accurate, reliable, confi gurable alerts that will inform us when jobs fail or fail to run, database or server properties that deviate from the established "standard", whether there are sustained spikes in resource usage or abnormal trends and so on. Why do we need all this monitoring? Two reasons, the fi rst of which is capacity planning. Unless we know the server's resource limits (storage space, memory, I/O capacity and so on) and monitor current resource usage then we may not fi nd out that we need to increase capacity until one of them "runs out".

Continues on page 3

Everyday DBA?

Database Administration as a ServiceBy Grant Fritchey

Database Administrators are, by our nature and the requirements of our job, control-oriented. We are like commissars in that we must maintain and enforce security mechanisms on the data from a business and regulatory standpoint. We prepare for disaster, outages and deletions of the information that defi nes and supports the businesses that pay us. We get up at 2:30AM on a Sunday to put out fi gurative, or even literal, fi res. All of this reinforces that controlling nature and leads us to become, for want of a better term, jerks. This is a problem for the DBA profession. We need to stop. I think that we, as DBAs, can be better by embracing the ideas of "leadership through service".

Continues on page 6

Stairway to

DatabaseDesignBy Joe Celko

Not too surprisingly, the fi rst step in database design is the data. But the truth is that too many programmers do not spend any time on designing their data and begin designing the schema fi rst. It does not work. What SQL handles is structured data, as opposed to unstructured data like text or pictures. One of the basic concepts in RDBMSs is what Dr. Codd called the Information Principle. This rule states that all data in an RDBMS is modeled as scalar values in columns in rows in tables.

Continues on page 9

10ASK EssieDating a Model db? Discover a secret child table? Essie has advice for you.

5Learn Many LanguagesWhy teach any other programming language when they will be using Modula-2 for all their working lives?

5Learn Many Languages 8Eccentric? Pedantic? Correct? Living the life of a DBA.

Page 2: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

SQL Monitor now calculates and displays baselines automatically, using the performance data it already

records. If you use SQL Monitor, we hope you’ve been able to take advantage of the custom metrics

site http://sqlmonitormetrics.com – the site now has over 60 metrics available, with more being

added each month.

SQL Prompt 6 was released in early September to help people write, refactor, and explore

SQL effortlessly. SQL Tab Magic has been fully integrated into SQL Prompt, which now has tab

history, a custom snippets folder, and can suggest synonyms.

Deployment Manager 2 was launched in July and continues to receive a lot of developer attention. DM supports SQL Server database deployment

(including deployments to SQL Azure), in addition to .NET application deployment. Deployment Manager

comes in a starter edition where the fi rst fi ve projects and agents are free.

ANTS Memory Profi ler 8 was released as a public beta in August. This new version of AMP adds

support for profi ling .NET’s usage of unmanaged memory, so if the .NET code consumes unmanaged

APIs or legacy native code, AMP will display how much unmanaged memory those .NET objects

are responsible for. Get the beta from www.red-gate.com/labs.

SQL Backup Pro introduced hosted storage accounts in March. With a hosted storage account,

SQL Backup Pro users can get offsite backups and manage them online. Use the SQL Backup Pro wizards or scripts to create a backup on disk and

copy it to your secure hosted storage account – the fi rst 5GB of storage is free.

Questions of the DayWhich option would we use to encrypt the defi nition of the view and prevent users of the database from seeing it?

a SCHEMABINDINGb Transparent Data Encryption (TDE)c ENCRYPTIONd None of the above

True or false: With SharePoint 2010 and above, you can use FILESTREAM to store your SharePoint documents.

a Trueb False

I ran a back up of the ABC database, and stored it in D:\Backup\abc.bak. Now I want to retrieve the fi les' (data fi le and log fi les) names and location paths before restoring them in a new location. Which command should I use?

a RESTORE abc FROM DISK =’D:\Backup\abc.bak’b RESTORE FILELISTONLY FROM DISK=’D:\Backup\abc.bak’c RESTORE VERIFYONLY FROM DISK=’D:\Backup\abc.bak’ d None of the above

You come into work one morning and fi nd an SSMS query window on your computer open, with the following text in the Messages pane:Msg 2001, Level 1, State 1, Procedure OpenThePodBayDoors, Line 1 I'm sorry, Dave. I'm afraid I can't do that. What is the likely cause of this message?

a The connected instance of SQL Server has become self-aware, and is trying to reconcile confl icting orders.b Someone has played a prank on you using sp_addmessage.c Someone has typed that message in the Messages pane.d This could not happen.

1

2

3

4

SQL Server Transaction Log Management

by Tony Davis and Gail Shaw

www.red-gate.com/books

FreeeBook

RED GATE NEWS

LearnSomeSQL.com

www.learnsomesql.com

A learning-by-doing prototype for T-SQLLearn Some SQL currently provides six lessons, starting from simple SELECT statements, moving on to WHERE clauses, and showing results using ORDER BY.

Beta

Find the answers and pick up your free SQL Server Stumpers eBook at www.red-gate.com/puzzles

Page 3: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

Continued from page 1

As Rodney Landrum observes in his article, The Strategic Value of Monitoring SQL Servers:

"…if you turn up in your boss's office with the news that Server X requires 2 TB of extra disk space, immediately, due to unexpected growth," then expect his or her first question to be: "Why wasn't it expected?"

If we have proper monitoring, reporting and trend analysis, we can see the train crash coming, and "re-route the tracks" to avoid disaster. We can show the boss a report that says Server X will be out of space or memory in four months," and advise them to account for this in the project budget.

The second, equally important element is reaction time. With effective monitoring, alerting and reporting we can respond to an emergency before too many people are affected, and the crisis escalates.

When an organization under-invests in monitoring, DBAs are obliged to spend much of their time fighting fires. They respond when users complain of slow performance or other system problems. The DBA hunts down the problem by collecting the evidence, using tools such as Profiler, PerfMon, Extended Events and the Dynamic Management Views.

A better alternative is to collect the evidence these tools provide on an ongoing basis, and use it to start looking ahead, as well as back. Using predictive analysis of the monitoring data over time, you can detect looming issues before they become serious problems.

Build vs. BuyAs long as the monitoring system works efficiently to give accurate figures for capacity planning and allows the DBA to prevent problems where possible, it does not matter too much to management whether you design your own monitoring solution or buy a monitoring tool.

A third party tool isn't strictly necessary to do effective monitoring because SQL Server comes with several ways of gathering the diagnostic data. There are system tables, built-in functions, Dynamic Management Objects (DMOs), performance counter values, SQL Server Data Collector and so on. We can script this information using T-SQL or PowerShell.

We also need to consider how to automate data collection across all servers (likely comprising different versions and editions), and then the central storage of the data for analysis. With the appropriate scripts and tools plus a means to collect data across all servers (such as SSIS), it's possible for DBAs to build their own "monitoring data warehouses".

However, assuming you need to monitor more than one server, there will come a point, quite quickly, where it saves time and resources to use a third-party monitoring tool. It will probably provide 90% of the coverage you need, certainly enough to cover basic server and performance monitoring metrics, including disk, I/O and memory usage, as well as monitoring for specific problems such as prolonged blocking, abnormal job duration and so on. For the rest, most tools will offer as standard a way to customize monitoring scripts and alerts. Some offer built in data analysis features such as the ability to examine the health and performance of our SQL Server environment at a specific point in the past, or directly compare a certain metric over two periods (e.g. Tuesday this week versus Tuesday last week).

Configuring a Monitoring System: Dos and Don'ts

Regardless of whether we choose to build or buy a monitoring solution, there are a few key factors to consider when setting up and running it.

Use a separate monitoring server – it's of little help if the monitoring service responsible for telling you that something's failed on your server goes down at the same time as the server. You should also consider monitoring the monitoring service via a simple "ping" from the production server, or perhaps using Policy Based Management.

Use a separate monitoring database Monitor its growth and plan for it to grow quite large.

Test your monitoring scripts and queries These queries will run automatically against all servers and databases on your system so it's very important to understand exactly what sort of impact they're likely to have when you run them. It's common for perfectly benign queries to become resource-hungry monsters when run once each against 100 databases on a server.

Start small and expand graduallyStart with a relatively small set of base alerts, across your servers and databases. Get comfortable with the level of alerting, monitor growth of the central repository to get a feel for how much data you're collecting, tweak the strategy as appropriate, and once satisfied, consider expanding.

Avoid the Observer effect Don't go so overboard that the monitoring affects the server. Likewise, be wary of changing options just because they help with the monitoring (such as enabling a trace flag for verbose query output), and make sure any third party solution isn't doing this either.

By Tony Davis

Effective SQL Server Monitoring

Step 1 Discover your Servers

If you are a new DBA on a SQL Server environment that lacks monitoring, the first step is to automate the process of discovering and adding the SQL Servers that you wish to document and monitor. There are several ways to do this, but one possibility, provided free, is the Microsoft Assessment and Planning (MAP) Toolkit. Some of the documentation for the tool reads like an open invitation from Microsoft to decide how much money you'd like to give them ("assess your current IT infrastructure and determine the right Microsoft technologies for your IT needs"). However, it's a very useful tool during this initial discovery phase, when you're wondering just how many SQL Servers you need to monitor, and where they are physically located.

If you have a Windows network (and hence an AD domain controller), you run the tool as a domain admin and it can tell you exactly what is on your network, including SQL Server, Windows OS, Office installations, Exchange and a whole lot more. It tells you version, edition and patch level for each instance on the network, it can find out if it's a named or default instance and it can tell you how many processors the machine has and how much memory.

Another possibility is to use PowerShell to discover and document your servers. For example, see Kendal Van Dyke's SQL Power Doc tool.

Step 2 Basic Server and Database Documentation

We need solid documentation of all of our servers, instances and databases. This includes documentation and monitoring of database and server configuration settings, in order to assess how closely they adhere to company standards and the normal default values. If someone enables the "Auto Shrink" database option, or turns off "Auto Update Statistics", we need to know about it. Likewise, if someone changes the SQL Server setting "Max Server Memory", we need to know. This also includes security monitoring – in other words, who has access to what and with which permissions.

In each case, we then need a method to automate the collection of all of this data, across all servers, and then store it in a central repository for reporting and analysis. Viable tools include T-SQL and SSIS, PowerShell and others.

Step 3Backups and SQL Agent Jobs

For our backups, we need to be sure that all required backups (full and differential database and log backups) are running and we need to know the storage location. For our backup jobs, and any other SQL Server Agent jobs we need to monitor:

• Failed jobs• Jobs of abnormal duration• Jobs that fail to run – it is often as

important to know about jobs that don't run, as jobs that run but fail

We also need to monitor for any changes in status of core services, such as SQL Server Agent, or even SQL Server itself.

We can get all the basic information we need about our backups and Agent jobs from the appropriate set of systems tables, namely the Backup and Restore tables and the SQL Server Agent tables.

Again, various tools and techniques will allow us to collect this data from each server, for central storage and monitoring.

Step 4 Space and Growth Rates (Capacity Planning)

Two of the first metrics that a DBA needs are disk space and database file sizes. This is popular in those cases where a system administrator needs an alert when disk space reaches a threshold of, say, 90% of disk size, so that there is time to plan to add disk capacity before space runs out and the application errors-out.

For enterprise-scale database systems, this isn't enough. It isn't just the bare figures we need, but the trend over time; is growth linear, or exponential? There is little that the DBA can do to control this growth beyond checking that the data housekeeping routines are effective, but knowledge of the growth trend is essential to make an educated guess as to when extra disk space needs to be added.

Read Steps 5-8 at www.simple-talk.com

Page 4: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

Columnstore indexes are based on xVelocity (formerly known as VertiPaq), an advanced storage and compression technology that originated with PowerPivot and Analysis Services but has been adapted to SQL Server 2012 databases. At the heart of this model is the columnar structure that groups data by columns rather than rows.

Compression certainly isn’t new to SQL Server. However, because data in a columnstore index is grouped by columns, rather than by rows, data can be compressed more effi ciently than with rowstore indexes. Data read from a single column is more homogenous than data read from rows, and the more similar the data, the easier it is to compress. Add to that equation a low number of distinct values and the use of dictionaries, and the advantages only grow.

The xVelocity technology also brings with it sophisticated compression algorithms that can take full advantage of the indexes’ columnar nature. And the more effectively you can compress your data, the more data you can fi t on a single page and the more data you can pull into memory, both

of which lead to lower I/O costs. If you consider the nature of BI workloads, which often involve aggregating large data sets, you can see the clear advantage of the columnstore structure. The need for the increased CPU power that such aggregation requires can be offset by the I/O savings, helping to improve the performance of those gargantuan queries that were bogging down your systems before the columnstore index came along.

Working with highly compressed columnar indexes is certainly a great start when taking on those BI workloads, but SQL Server 2012 adds another element to the mix to improve performance even more: batch mode processing. Analytical BI queries must often scan extremely large sets of data and perform numerous complex operations, even to produce a small result set. Batch mode processing can operate on many rows at a time—a batch—rather than one row at a time, as is typical with row-mode processing, the type used for most online transactional processing (OLTP) operations.

In SQL Server 2012, when the query processor executes a query, it can use batch mode, row mode, or both. To use both, the query optimizer can create plans that include sub-trees in batch mode even if the main tree is in row mode. However, the goal is to try to get your queries to run in batch mode from beginning to end, and if that’s not possible, to get as much of the query as you can to use batch mode. Even in mix mode, you’re likely to see performance gains.

But not all operations will run in batch mode. Some of these limitations are inherent in SQL Server 2012, and there’s little you can do to work around them. In other cases, you might be able to tweak your queries to maximize batch mode processing. For information on several steps you can take to get your queries to use batch mode, refer to the TechNet Wiki article “SQL Server Columnstore Performance Tuning.” Keep in mind, however, the advantages of batch processing can be realized only if

you’re joining, fi ltering, or aggregating large data sets. Without these elements, batch processing is not possible.

Columnstore indexes, along with batch mode processing, have been optimized with data warehouses in mind, specifi cally when the indexes are created on fact tables. You’ll see the best performance on large fact tables with small-to-medium dimension tables confi gured in a star schema, better still if the included columns contain many repeated values. Yet even if you meet these criteria, the performance gains might be minimal if you’re returning large, non-aggregated result sets, joining tables too large to fi t into memory, returning or joining too many columns, or running queries not using batch processing mode.

A columnstore index also has a number of limitations and restrictions (too many to list here), such as which data types can be indexed, the number of columns that can be included, the type of objects that support columnstore indexing, and numerous other considerations. For more details about what you can and cannot do with column store indexes, see the topic “Columnstore Indexes” in SQL Server Books Online or at MSDN. The topic also includes details about how to update data in a columnstore index. Essentially, you can’t do it, but you can take steps such as dropping the index or partitioning the table.

Despite the limitations of columnstore indexes, they can provide performance improvements that far exceed what you can get with the rowstore structures of clustered and nonclustered indexes. When used under the right circumstances, columnstore indexes can signifi cantly reduce disk I/O and well as utilize memory more effi ciently. These indexes are made for the type of analytical processing your BI workloads often require, an important consideration in this age of ever increasing data.

See the columnstore index in action in the full article on www.simple-talk.com

COLUMNSTORE INDEXES IN SQL SERVER 2012By Robert Sheldon

Beginning with SQL Server 2012, you can now defi ne columnstore indexes on your database tables. A columnstore index stores data in a column-wise (columnar) format, unlike the traditional B-tree structures used for clustered and nonclustered rowstore indexes, which store data row-wise (in rows). A columnstore index organizes the data in individual columns that are joined together to form the index. This structure can offer signifi cant performance gains for queries that summarize large quantities of data, the sort typically used for business intelligence (BI) and data warehousing.

6

Make SQL Effortless Download a 14-day free trial at

www.red-gate.com/sqlprompt

6

Newv6

Careers at Red Gate

Business Intelligence DeveloperRed Gate is looking for a Business Intelligence Developer to work with our internal development team on creating business intelligence solutions. Reporting to a Business Intelligence Manager, you'll help to build the foundations of our business intelligence platform.

Software EngineerRed Gate is looking for experienced developers to join us as we tackle the challenge of building simple tools to solve complex problems. You'll work with a world class team to build ingeniously simple software that solves complicated customer problems, from backing up SQL Server databases to the cloud, to managing deployment infrastructure, to development software for mobile applications.

Web Systems DeveloperRed Gate is looking for an experienced Web Systems Developer who will take a lead role in developing our world-class software systems in-house. As one of Red Gate's experts in web technologies, we'll expect you to work designing architectures, user interfaces, and software systems that support all aspects of the business.

To read more about these and other opportunities, visit www.red-gate.com/careers

Personals

Page 5: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

I anticipated a harmonious chat where we could suggest to them the idea of mentioning our name to some of their graduates. It didn’t go well.

The academic staff displayed a degree of revulsion towards the whole topic of IT in the world of commerce that surprised me; tweed met charcoal-grey, trainers met black shoes. However, their antipathy to commerce was something we could have worked around, since few of their graduates were destined for a career as university lecturers.

They asked me what sort of language skills we needed. I tried ducking the invidious task of naming computer languages, since I wanted recruits who were quick to adapt and learn, with a broad understanding of IT, including development methodologies, technologies, and data. However, they pressed the point and I ended up saying that we needed good working knowledge of C and BASIC, though FORTRAN and COBOL were, at the time, still useful. There was a ghastly silence. It was as if I’d recommended the beliefs and practices of the Bogomils of Bulgaria to a gathering of Cardinals. They stared at me severely, like owls, until the head of department broke the silence, informing me in clipped tones that they taught only Modula-2.

Now, I wouldn’t blame you if at this point you hurriedly had to look up ‘Modula-2′ on Wikipedia. Based largely on Pascal, it was a specialist language for embedded systems, but I’ve never ever come across

it in a commercial business application. Nevertheless, it was an excellent teaching language since it taught modules, scope control, multiprogramming, and the advantages of encapsulating a set of related subprograms and data structures. As long as the course also taught how to transfer these skills to other, more useful languages, it was not necessarily a problem. I said as much, but they gleefully retorted that the biggest local employer, a defense contractor specializing in radar and military technology, used nothing but Modula-2. “Why teach any other programming language when they will

Learn Many LanguagesBy Phil Factor

Around twenty-five years ago, I was trying to solve the problem of recruiting suitable developers for a large business. I visited the local university (it was a technical college then). My mission was to remind them that we were a large, local employer of technical people and to suggest that, as they were in the business of educating young people for a career in IT, we should work together.

be using Modula-2 for all their working lives?” said a complacent lecturer. On hearing this, I made my excuses and left. There could be no meeting of minds. They were providing training in a specific computer language, not an education in IT.

Twenty years later, I once more worked nearby and regularly passed the long-deserted ‘brownfield’ site of the erstwhile largest local employer; the end of the Cold War had led to lean times for defense contractors. A digger was about to clear the rubble of the long demolished factory along with the accompanying growth of buddleia

and thistles, in order to lay the infrastructure for ‘affordable housing’. Modula-2 was a distant memory. Either those employees had short working lives or they’d retrained in other languages.

The university, by contrast, was thriving, but I wondered if their erstwhile graduates had ever cursed the narrow specialization of their training in IT, as they struggled with the unexpected variety of their subsequent careers.

Why teach any other programming language when they will be using Modula-2 for all their working lives?

“”

You shrug it off. ‘It’s just a little slow today. It’ll perk up tomorrow.’ But that bug won’t go away on its own.Under the healthy veneer of your application, bugs are making themselves at home. Eating your memory. Hurting your performance.

Your code looks healthy, but that bug is deadly!

Download a 14-day free trialwww.vsnomad.com

Build iOS and Androidapps in Visual Studio

NOMAD

Find and fight those bugs with ANTS Memory Profiler!Get your 14-day free trial at www.red-gate.com/ants-memory-profiler

Page 6: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

Continued from page 1

As DBAs, we want to have as clean a production environment as possible. We want to know, as far as we can, exactly what is going into it, and when, so that we can manage backups, disaster recovery, downtime and all the rest. We want these things - in fact, we're required to provide these things on production - so when we look over our shoulder at what is coming towards us from development, we instinctively cringe. This is the moment where the control over development starts, in order to tame the beast, and it's at this moment that we've gone wrong.

Our responsibilities as DBAs require us to set some direction on how to manage information within our databases and the organization. The organization has tasked us with those responsibilities, but they didn't tell us to become little martinets, jealously guarding our territory, privileges and access. They didn't require us to force developers to become supplicants who must kowtow in order to get the database they need to start developing. No. The business expects us to provide a service, and deliver it like any other well-run service.

If you make the development team jump through hoops in order to get a new database into development, implement continuous integration, try out an Object Relational Mapping tool or experiment with a new development paradigm, then you're making them feel like they're working with the cable company. As soon as a viable alternative to cable presented itself, I jumped at it. When your developers find a viable alternative to working through you, even if it's not actually viable, what do you think will happen?

Instead of barking at the developers the next time they come up with a harebrained scheme to only ever do inserts and deletes in order to avoid waits caused by updates (and yeah, I had this discussion with a development team), we need to try working with them, and we need to start working towards leadership through service.

Leadership skills aren't part of the average DBA's training. My first insight of the way to learn, and teach, these skills came from my long-time role in scouting. The Scouts of America do a great job of turning out leaders. You can do your own searches on the internet to find the number of presidents or astronauts or other business leaders that were either Eagle Scouts, or were involved

with the Scouts for some period. Scouting teaches, among many other things, the concept of leadership through service.

A campout with the Scouts looks chaotic, with people running in circles shouting, gathering sticks for fires, some tents getting set up and so on. You soon start to realize, however, that despite the apparent pandemonium, there is progress, and organization. Look harder and you start to see how it's happening. On the side, experienced scouts are talking to new scouts, scout masters are talking to scouts, pointing out what has to happen, suggesting how something should get done, stepping in to do things where absolutely necessary, teaching and then walking away, where possible. It's leadership through service.

Leadership through service teaches us that we can best set direction if we best serve, best help, best provide an environment through which people can get what they need, but do it within a paradigm that also moves in a good direction. In short, DBAs can act as a roadblock or as a pathway. I'm here to tell you that acting as a pathway will absolutely give you more control over what goes into your production system than acting as a roadblock.

Here are my suggestions for how to get this done: define a process, work backwards from production, integrate tightly with the development team, automate as much as possible.

You'll need to have a process to get code from development to production, but you don't want to control development. You just want to control production. So, work backwards from there. Figure out what you need in order to establish a safe production environment that will support the business, then layout a pathway and a process that enables the developers to get there. Provide this as a service for them.

This means talking to them, getting to know their development paradigm and supporting it. Be a service. Be a servant. Never be a roadblock. Help them get things done, but always keeping in sight your end goal of a safe production landing. To make this work, automate everything you can. The more manual your processes, the more pain you're going to feel.

A word of caution, though, and a bit of a brush back for any developers who are rubbing their hands thinking, "Oh boy, the DBA has to do anything I say." Nothing I've suggested here should change the fact

that the DBA's job is to keep the production environment online and secure. Yes, we want to provide a service, but we need to provide leadership as well. Combining the two is the important point. So when developers have that crazy idea, support it, but guide it. Find out why they want to do it. Is it a good idea? Do you have viable alternatives? Is there a better way? Work with them and help guide their efforts, where necessary, without setting the absolute direction, or doggedly imposing your own ideas.

As DBAs, we need to engage. We need to talk to the business in order to understand their needs, so we know what services we need to provide. We can't even set up a simple backup scheme without first understanding the recovery time objectives and recovery point objectives. We can't even meet those requirements without communicating to the business some level of the technology that might be required to meet those times, if they're seriously difficult. That's a heck of a

Database Administration as a ServiceBy Grant Fritchey

lot of talking to the business.If you're one of those DBAs who has

grown to like being in a dank cubicle in the basement, this is not going to be easy. Your skills at influencing others in the workplace may be rusty, but the one constant in our universe is change, so you may as well embrace it and manage it, or it's going to manage you. Just remember that these changes are going to be iterative. You're going to have to adjust as you gain understanding of what your organization needs.

As a DBA, you're providing two things, a service and leadership. Start working on your soft skills. Provide a good service. Be a good servant. The leadership will flow naturally from this as you demonstrate your interest in being a pathway, not a roadblock.

This article has been abridged. Read the full article and others like it at www.simple-talk.com

"Oh boy, the DBA has to do anything I say."

Download free trials of Red Gate tools at www.red-gate.com

Red Gate's tools are generally considered to be the gold standard... I wouldn't bother messing around with anything else.Adam Machanic, SQL Server MVP

Page 7: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

The idea of these gatherings is for the young people to get out of their bedrooms where they hack away at code – either their own or someone else’s. They gather in groups and on a typical Monday they’ll all “storm” their ideas and decide who wants to do what for the rest of the week.

The nine participants all decided they wanted to work on a project they called ‘A2B’ – a social route planner allowing people to comment on why they should choose one route over another; whether that’s because the coffee is better going via a particular train station or it means waiting 15 minutes for a less busy train. A solid idea and one that would give the participants a fair challenge.

The groups split quickly into a ‘Back end’ & ‘Front end’ team, with Python, JavaScript, HTML, SQL, Java and Objective C all in the mix. It really is fascinating to watch how quickly a group of young people can organize themselves.

The team built a website, Android app and iPhone app during the week. It was humbling to watch the youngest in our group (aged 11) not only learn and use jQuery for the first time, but also teach the two older developers in the web team and make sure the work was distributed so that everyone had something to get on with. They certainly didn’t teach that in my primary school.

At the end of the week the participants all pile into buses, trains and cars for a meet in Birmingham for the ‘Festival of Code’. Here they present to their peers and a panel of judges in the hope they can progress

to the Finals which this year they presented to Conrad Wolfram and other famous geeks from the tech sector. Winners are then chosen from one of five categories (Code a Better Country, Best Example of Design, Best Example of Coding, Should Exist and Best in Show).

The Cambridge team won their heat in the ‘Code a Better Country’ category, but were defeated in the final by a Kickstarter-type website called “Establish.me”.

There are many reasons to get involved with YRS, some commercial and some personal. I got involved because I felt it was important to provide the next generation of coders the chance to build world-beating skills to help with the ongoing IT skills and youth unemployment crisis we have in the UK today. But if you enjoyed coding when you were young and feel you could’ve benefited from this type of event, then you really should help. A half day, a week, a weekend or some office space. These are all useful.

If you’re looking for a commercial reason, and your company is in the tech industry, it’s great to see how these people work. If you don’t see how these young people work, how they build code and their demands around open APIs and open data you will fall behind. A code and interface-driven open platform with integrated and connected systems and a completely revolutionary way of getting things working is coming our way and it’s coming fast. Chances are these young people probably understand the Hows, Whys and Whats way better than your current coders do.

Find other blog posts at www.simple-talk.com

Young Rewired Stateat Red GateBy Alan Smith

Source Control for Oracle is a new product launched by the Red Gate Oracle team in March, with version 2 released in August. Source Control for Oracle enables

database source control with Subversion or Team Foundation Server.

Nomad is growing! This autonomous team within Red Gate is looking to hire a software engineer and product marketing manager. Nomad is a Visual Studio extension that lets you develop, test, and deploy iOS and Android mobile apps with HTML5 and JavaScript that’s proving

very popular for rapid app prototyping.

Glimpse is an open-source diagnostics platform for the web supported by Red Gate. In June Glimpse released its Heads-Up Display, a mini-dashboard that pulls out the most important details about a request. The HUD

includes sections for HTTP, Host, and Ajax to see how a request is handled during its lifecycle.

Cerebrata released Azure Management Studio in March which includes all the functionality of Cerebrata’s

standalone products (Cloud Storage Studio, Azure Diagnostics Manager, Azure Management CMDlets) in one discounted package. April also saw the release of Cerebrata’s new website and a very popular free tool

called Azure Explorer.

CodeLab is the latest product idea to come out of the Red Gate Labs. It’s a Visual Studio extension which

provides a simple interface to evaluate expressions right next to your code. This is a new experiment (released in May) so head over to www.red-gate.com/labs to try it out

and let the team know what you think.

RED GATE NEWS

Rewired State arranges for Young Rewired State (YRS) Centers to be created up and down the UK from Aberdeen to Brighton. In each of these centers young coders cram into offices, schools, universities and libraries - anywhere with wi-fi and power. During the first week of August, it was Red Gate’s turn to play host to nine young participants.

Recommended reading for web developers, by web developers. The best content for ASP.NET MVC from across the web.

webdev.simple-talk.com

Page 8: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

So you’ve developed an amazing SSIS package. It runs flawlessly on your local machine and every little task lights up with this joyful green. But what now? You can’t keep running this package in Business Intelligence Development Studio (BIDS). If the package needs to run during the nightly processing window, they can’t expect you to sit by your computer to execute the package at 2 A.M., can they?You need to deploy your package to a server. Preferably a development or test server, because you need to test if your package integrates well with the entire environment. And if your DBA has done his work, you’re not even allowed to look at the production server.

This introductory article describes various methods on how you can deploy your individual packages stored on your local desktop to the server. The project deployment model, introduced in SQL Server 2012, is outside the scope of this article. However, the package deployment model of SSIS 2012 can use the same methods described here.

There are four ways of deploying a package : the traditionalist, manual, old school, and pragmatic way.

In the traditionalist way we use the built-in deployment method to get our packages to the server: the SSISDeploymentManifest. This is basically simple XML describing which packages need to be deployed to the server. If you double-click this manifest, a wizard will launch that assists you in deploying the packages to the server.Right-click on the project and select Properties. In the Configuration Properties, select the Deployment Utility pane. Set the CreateDeploymentUtility property to True.Right-click the project and select Build. This will create the manifest in the folder you configured and copy all the packages to that folder.

Go to the deployment folder, default .\bin\Deployment, and double-click

Have you ever wondered how everyday life would pan out if you took the DBA approach to life's events? Here are a few thoughts.Backups: You have a nightly backup routine. This means a differential backup every night, when you tell your spouse everything that has happened during the day in minute detail, and a full backup on weekends when you tell them everything that has happened during the week in your entire life. I don't think either of you would sleep much.

Replication: You are on the phone continuously, telling your twin sibling at a remote location everything that you are experiencing. Everything. What you see, hear, smell, eat, work on etc. Your twin, of course, has no life of her own, and is living vicariously through you, ever prepared for you to drop dead so she can take over. Talk about sibling rivalry.

Restores: Remember that nightly backup you transferred to your spouse earlier? You periodically and randomly ask your spouse to repeat some of those conversations back to you, ensuring no detail is skipped, so you can confirm that the backup is working. Marriage counselor's number handy?

Scans: When you go looking for the soy sauce in your pantry, you read the label on every single item in there: all the spices, all the jars and bottles, every bag of chips, every bottle of juice and soda, everything, because the items are arranged in no particular order. It takes you a few hours to put together one meal, and your kids have gone to bed hungry.

Seeks: After scanning through your pantry multiple times and getting tired of how long it takes each time, you decide to rearrange all the items in order by alphabet. Now you can retrieve the soy sauce in no time. The kids are happy again.

Fragmentation and Re-indexing: Over time, as your spouse adds items, to the pantry at random locations (because he is not a DBA) and removes items leaving

on the manifest to launch the Package Installation Wizard. Follow the wizard to deploy your packages.

For people who like to have control (DBA anyone?) and do everything by hand: you can deploy the packages the manual way.Log into the SSIS service using Management Studio and browse to the folder you want the package deployed to. Right-click on the folder and choose "Import Package". In the dialog, specify the source of the package, locate the package on your desktop and click OK.

If you’re one of these guys who absolutely adore command lines, we have the old school way. You can directly use the command line utility dtutil to deploy your package. Keep in mind that the destination package name doesn’t have the .dtsx extension.

Lastly my favorite, the pragmatic way, uses BIDS Helper, a free add-in for BIDS, to deploy packages to a server. This neat little add-in adds a ton of features to BIDS, including the simplified deployment feature.

First you need to configure the deployment properties. Right-click on the project and select Properties. In the Configuration Properties, select the Deploy (BIDS Helper) pane. Choose your favorite destination type and configure the location.

Now you can simply deploy a package by right-clicking on it in the Solution Explorer and by selecting Deploy. The result of this deployment can be consulted in the Output window of BIDS.

The biggest advantage, however is that you can easily deploy multiple packages at once: simply right-click on your project and select Deploy. All the packages in the project will now be deployed!

Read the full version of this article (with screenshots) over at www.sqlservercentral.com

gaps on the shelves, the ordering gets so out of whack that you revert to going through all items again to find the soy sauce. Eventually, you decide to create an automated re-indexing plan by having your spouse rearrange everything by alphabet once a week. Divorce lawyer's number handy?

More Backups: When you prepare a sandwich for your kid's school lunch, you also make a second sandwich. You pack the first one in your child's lunch box, and you courier the second one to arrive at school just in time for lunch. You don't tell anybody that you have a third one in your car, you know, just in case.

Adding Records: When you discuss baby names with your spouse for the upcoming addition to your family, you very briefly consider an integer for the name, and then even more briefly think that a tinyint would be more appropriate, before you think of the divorce lawyer and decide to shut up. You do, however, bring up the Bobby Tables joke because you think it's funny. Your spouse does not.

Searching: You wonder on a daily basis why you can't just enter this into Google's search box: select * from closeby_restaurants where cuisine = 'chinese' and distance_from_home <= 2 miles and deliciousness = 'awesome' and service_time = 'quick'.

Normalization: When your spouse asks you for a copy of your shopping list before he goes shopping, you point him to the location of the original list instead because you do not want to create duplicates. He throws his hands up and leaves without your list. Your items never get bought.

Normalization 2: You do not have a driver's license, or a bank account, or a passport, or a mortgage in your name, because you are incapable of filling out any forms in duplicate, leave alone triplicate.If your domestic life isn't exactly a picture of happiness and you're getting grief from your spouse, kids, and siblings, now you know why. You're a DBA!

Find more editorials like this at www.sqlservercentral.com

Everyday DBA

SSIS Deployments

By Hakim Ali By Koen Verbeeck

Total Deploymentfor .NET apps, services,& databasesDEPLOYMENT

MANAGER www.red-gate.com/dmDownload the free tool at

Free

Page 9: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

Continued from page 1

This means that all the rows in a table have exactly the same structure. That means a properly designed table cannot have one row that models automobiles, another that models squids and a third that represents Lady Gaga.

Likewise, each column in a row is a value for the same data element. A column does not change from shoe size, to temperature to something else in the table. It also means that the scale does not change – if you measured temperature in Celsius, then all values in the column use the Celsius scale.

Picking the scales and data types is important. It makes sense to do math and comparisons with some scales and not with others.

The ISO_11179 format is “[<role>_]<attribute>_<property>” for data elements. A data element has one and only one name in the entire schema. Better, it should have one and only one name in the enterprise. Best of all, a data element has one and only one name in the universe.

We want the data to come when we call it. Logic has the Law of Identity, which is often abbreviated as “A is A” in the literature. For example, there is no such thing as “id” – it is too vague and generic (is it an identifier for automobiles, squids or Britney Spears?). It is a property without an attribute. A better name would be “vehicle_id” if that is the attribute property we have. The best data element name is “vin”, which is universally used and defined by the ISO 4030 “Vehicle Identification Number” Standard. VIN is precise and well-understood.

Likewise, you will see attributes without properties, but perhaps the silliest error is

a chain of properties. Think about what a “type_code_id” means. If it is an identifier, then it is unique and belongs to one entity in the data model (think “emp_id”). If it is a code, then there is an external authority for it (think “postal code”). If it is a type, then there is a test for it (think “blood type”). This is like a chain of adjectives without a noun to modify. Adding an attribute to the chain will not cure the ambiguity problem.

The <role> is used when the same data element appears in two or more roles in the same table. For example, a report on an organization might have “supervisor_emp_id” and “subordinate_emp_id” both drawn from the employee identification “emp_id” data element in the Personnel table.

Data element names that are too short and too long are both bad. An overly short name can be hard to understand unless it is a standardized abbreviation. They can also be ambiguous; my favorite example was a system that had several ways to abbreviate “student” in data element names, one of which was “std” - often mistaken for “standard” and “sexually transmitted disease” in various places.

Avoid all special characters in names. Stick to letters in the Latin-1 alphabet, digits and underscores. They will port to other programming languages. Yes, data element names are not just for SQL. Likewise, avoid quoted identifiers with either the Microsoft-only square brackets or the ANSI/ISO double quote marks.

This list of standardized property postfixes for data element names is built on Teradata's internal standards and common usage in the trade press (CMP, MKP, and other trade publishers). These postfixes have exact meanings. If you need to invent your own, then they need to be exact, too.

By Joe Celko

Stairway to Database Design

"_id" Identifier. It is unique in the schema and refer to one entity anywhere it appears in the schema. Uniqueness is not the same thing as being an identifier. The number pi is unique, but it does not identify an entity. Never use "<table name>_id"; that is a name based on location and tell you this is probably not a real key at all. Just plain "id" is too vague and screws up your data dictionary when you have a zillion of them. Obviously, auto-incrementing values are not identifiers. I will get into that fallacy later.

"_date" or “_dt" date temporal dimension. It is the date of something -- employment, birth, termination, and so forth. >There is no such column name as just a date by itself that would be really awful since DATE is a reserved word in SQL. That would be really awful since DATE is a reserved word in SQL

"_nbr" or “_num" tag number; this is a string of digits that names something. Do not use "_no" since it looks like the Boolean yes/no value. I prefer "nbr" to "num" since it is used as a common abbreviation in several European languages and the combination of similar shaped letters in “_num” are visually confusing.

"_name" or “_nm" This is an alphabetic name and it explains itself. It is also called a nominal scale.

"_code" or "_cd"= A code is a standard maintained by a trusted source, usually outside of the enterprise. For example, ZIP code is maintained by the United States Postal Service. A code is well understood in its context, so you might not have to translate it for humans.

"_size" An industry standard or company scale for a commodity, such as clothing, shoes, envelopes or machine screws.

"_seq" Sequence, ordinal numbering. This is not the same thing as a tag number, since it cannot have gaps.

"_tot" A sum, an aggregated dimension which is logically different from its parts.

"_tally" A count of values, an aggregated dimension. Also called an absolute scale.

"_status" An internal encoding that reflects a state of being that changes in a known pattern. Consider martial status. You have to be born, then change status to legal age. You cannot be married to several people at the same time. You can change from married to divorced, and from divorced to married. You cannot be married if you are dead.

"_cat" Category, an encoding from an external source that that requires an official judgment. For example, a Category Five hurricane. This is not like a code, which requires no such official judgment.

"_class" An internal encoding that does not have an external source. A class is a set of things that have some commonality; you have rules for classifying an animal as a mammal or a reptile. You may have some cases where it is harder to apply the rules, such as the egg laying mammal in Australia, but the exceptions tend to become their own classification -- monotremes in this example.

"_type" An encoding that has a common meaning both internally and externally. Blood types have a new-defined testing procedure. Types are usually less formal than a class and might overlap. A type is the weakest of the three, and it might call for a judgment. In some states a three-wheeled motorcycle is licensed as a motorcycle. In other states, as an automobile. And in some states, as an automobile only if it has a reverse gear.

The three terms are often mixed in actual usage. so stick with the industry standard, even if violates the definitions given above.

"_addr" or "_loc" An address or location for an entity. There can be a subtle difference between an address and location. An address can refer to a street address or some external geographical system. Location might refer to an internal scheme such as a warehouse bin number. The bin number can stay the same while its physical location is changed.

"_img" An image data type, such as .jpg, .gif and so forth. It might be important to use the particular format as the property.

Read the full series of Stairways articles over at www.sqlservercentral.com

Get your SQL Server database under version control now!

www.red-gate.com/sqlsourcecontrol

Page 10: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

Hi Jen,

Don’t worry, you’re not alone here, and you’ve done the right thing by asking. I know that you feel like you’re doing well enough physically on your own, but keep an open mind and you might discover some things that VM brings to the table you didn’t know about. First of all, did you know you can control behavior at the OS level, rather than simply at the instance level? You can also take advantage of some of the disaster recovery technologies offered by VM. There are places where he shouldn't be used. If you've got systems that are already stressing big iron, putting them on VM will NOT help you. But overall, the flexibility and fine grained control may make the investment worth it in most circumstances. The choice is yours, and you have to follow your heart, just don’t be too quick to judge.

Essie

Dear Cursor mad,

I cannot tell you whether you are or are not a bad person. Of all the times one would use a cursor on a production database, this looks like a good example, so I don’t think this alone is putting too much stress on your relationship with the database. However, you may want to think about creating scripts to drop the foreign keys and reapply them after and use sqlmd to call the scripts you’ve saved in a file. At the end of the day, you have to do what works for you. Keep an eye on performance levels. If they hold up I think you two kids will be just fine.

Essie

ASK EssieRelational trouble with your database? Essie is here to help

Dear Essie,

I need some help. My parents are making me meet this boy, Virtual Machine (goes by VM, thinks he’s so cool). He and his parents are scheduled to come in today to talk to me about SQL in a virtual environment. I need some advice on what to do. I think I’m doing fine on my own, but everyone keeps telling me how great VM is and how I should give him a chance. I just don’t see what he can possibly do for me. Am I wrong? Please help.

Jen

Dear Essie,

There’s this database girl I love in SQL Server 2008, but I also have a backup in SQL Server 2008 R2. I keep receiving a compatibility error, which is strange because I think they are both very compatible with me. I can’t restore the database in SQL Server 2008 with the backup in

2008 R2. What gives?

Data Playa

Dear Essie,

I'm using a cursor in production code. Does that make me a bad person? I feel like I’m a cheater, but I can can’t help myself. I’m so ashamed! You see, the thing is, I need to disable foreign keys that point to a particular set of tables while those tables are modified (dropped and recreated) and then have their data re-inserted (it is stored in a separate table first).

I am using a cursor to iterate through the foreign keys which point to any of the tables in question and disable them. I then use another cursor to re-enable them after the operation is complete.

I need to do this at run-time, because the code can run on anyone's database, so I can't avoid having to deal with foreign keys which could potentially be system-named constraints.

In this instance, I chose to use a cursor because I think the performance differences will be very minimal (if noticeable at all), and it actually makes the code more readable for generating and executing the DDL that I need.Do you think the database will forgive me, or am I causing irreparable damage to our relationship?

Cursor mad

Dear Data Playa,

It seems your backup in SQL Server 2008 R2 is just too good for you. You can’t restore backwards, once a database is created in a newer version of SQL Server. Changes have been made to it, even in compatibility mode, that make it impossible to restore to an older version of SQL Server. This is what you get for trying to mess around with a database who is out of your league.

Essie

Page 11: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

1 The I in SSIS (11)3 With 4 Across - A group of

independent computers that work together to increase the availability of applications and services (8)

5 Newest city to host a Red Gate office (9)

7 SQL _ is a nefarious technique allowing an attacker to run SQL statements in your database (9)

8 SQLServerCentral.com editor (5)12 A Visual Studio extension that lets you

develop, test, and deploy iOS and Android mobile apps (5)

14 Technically, any computerized process that shares a resource to one or more client processes (6)

15 Many DBAs schedule these nightly (7)16 The new voices in SQL Server

combined together to write this book (9)

17 Best practice for for application code, growing movement to be used with database code (6, 7)

19 Peter Parker’s love (2)22 A site to help beginners write basic

T-SQL statements (5, 4, 3)24 ___ your databases is vital to keep

track of performance issues like long running queries and deadlocks (10)

25 Stored Procedure taking too long? It’ll get one of these errors (7)

27 Red Gate office location and site of a SQL in the City event in 2013 (8)

29 So precious to an organization that it gets replicated, backed up, copied, made highly available, stored offsite, and sometimes hosted in the cloud (4)

2 One of the best ways to improve performance in a database application (8)

4 See 3 Down (7)6 Open source tool that’s like Firebug for

your server. (7)9 Newest feature in SQL Monitor (10)10 Binary large object (4)11 Copying and distributing data and

database objects from one database to another and then synchronizing between databases to maintain consistency (11)

13 The deprecated popular source control product from Microsoft (3)

16 Guidance on managing this can be found in Tony Davis and Gail Shaw’s latest book (11, 3)

18 Use this to find out about the current state of SQL Server, or apply for a license (3)

20 Author of the Art of Programming (3, 5)21 With David Farley, author of

Continuous Delivery (3, 6)23 Use 9 Across to see if your SQL Server

___ is normal and whether it can be optimized (11)

26 This handy Red Gate tool formats code, saves snippets, and lets you manage tabs in SSMS (3, 6)

28 That which houses 29 Down (8)30 A brain teaser from SQL Server Central

(7)31 Sounds like currency, used by your

browser history (5)32 What Sheryl Sandberg and Eric Ries

have in common (4)33 Missing a semi-colon? You’ll get this

error (6)34 All-in-one productivity tool for

Windows Azure pros by Cerebrata (3)35 The Scary DBA (5)

13

2

1

5

6

10

14 15

16 17

18 19

21

20

23

26 27

28

29 30

31

32

33 34 35

24

25

22

11 12

7

8 9

3 4

This Christmas, take her breath away with the SQL Developer BundleDelight her with the smooth database

comparison action of SQL Compare and SQL

Data Compare. Dazzle her with effortless code

using SQL Prompt. Add a touch of SQL Source

Control, and she’ll be well on her way to

continuous integration.

This year, give her what she really wants: a

bundle full of possibilities. The SQL Developer

Bundle, crafted with passion by Red Gate.

CROSSWORD

www.tribalsql.com

Tribal SQL, is a reflection of howa DBA’s core and long-standingresponsibilities sit alongside new thinking and fresh ideas.

NEW BOOK

I had a great time last night. Call me. What’s your problem?

You know I’m just a TempDB.

Ah, that’s probably not going to happen.

! ! ! ! ? ! ! ! !

Find the answers and pick up your free SQL Server Stumpers eBook at www.red-gate.com/puzzles

Get DROPped

Page 12: Why teach any other programming Eccentric? Pedantic ... · a secret child table? Essie has advice for you. Learn Many Languages 5 Why teach any other programming language when they

There are many reasons why you should consider using BLOB storage. Perhaps you want to share fi les with clients, or off-load some of the static content from your web servers to reduce the load on them. However, if you are using Azure’s Platform as a Service (PaaS), also known as Cloud Services, you’ll most likely be very interested in BLOB storage because it provides persistent data storage. With Cloud Services you get dedicated virtual machines to run your code on without having to worry about managing those virtual machines. Unlike the hard drives found in Windows Azure Virtual Machines (the Infrastructure as a Service -IaaS- offering from Microsoft), the hard drives used in Cloud Services instances are not persistent. Because of this, any fi les you want to have around long term should be put into a persistent store, and this is where BLOB storage is so useful.

Any fi le type can be stored in the Windows Azure BLOB Storage service, such as Image fi les, database fi les, text fi les or virtual hard drive fi les. However, when they are uploaded to the service, they are stored as either a Page BLOB or a Block BLOB depending on how you plan on using that fi le or the size of the fi le you need to work with.

Page BLOBs are optimized for random reads and writes so they are most commonly used when storing virtual hard drive fi les for virtual machines: in fact, the Page BLOB was introduced when the fi rst virtual drive for Windows Azure was announced: the Windows Azure Cloud Drive (at the time they

were known as Windows Azure X-Drives). Nowadays, the persisted disks used by Windows Azure Virtual Machine (Microsoft’s IaaS offering) also use the Page BLOB to store their data and operating system drives. Each Page BLOB is made up of one or more 512-byte pages of data, up to a total size limit of 1 TB per fi le.

The majority of fi les that you upload would benefi t from being stored as Block BLOBs, which are written to the storage account as a series of blocks and then committed into a single fi le. We can create a large fi le by breaking it into blocks, which can be uploaded concurrently and then committed together into a single fi le in one operation. This provides us with faster upload times and better throughput. The client storage libraries manage this process by uploading fi les of less than 64 MB in size in a single operation, and uploading larger fi les across multiple operations by breaking down the fi les and running the concurrent uploads. A Block BLOB has a maximum size of 200 GB.

There are many ways that BLOB storage can help your applications and processes, such as storing fi les off-site, creating a fi le-sharing mechanism with partners or even sharing fi les with anyone.

One of the really neat features of BLOB storage is that we can add metadata to a BLOB. This lets us provide some additional information to a BLOB to give it context. For example, we might add a DocumentSource value to a BLOB so as to indicate where a BLOB came from, or perhaps give a Word

document a metadata value for the author of the document. These metadata values can then be looked at either in code or from tools like Azure Explorer. Metadata for a BLOB are Key-Value pairs of data. The keys must adhere to the C# Identifi er naming conventions and are case in-sensitive, but they do retain the casing they were created with. The whole metadata item (key and value together) cannot exceed 8K in size. Keep in mind the metadata we add to the BLOBs is different from an embedded fi le property. The metadata only has meaning within BLOB storage.

As you work with learning more about the BLOB storage services I recommend using Azure Explorer. You’ll fi nd a storage tool indispensable if you work with BLOB storage regularly. Cerebrata is always looking to improve their products so feel free to contact them with your ideas and any issues you may run into. Also, if you fi nd that you need a few more features than are offered by Azure Explorer you ought to look at the Azure Management Studio product from Cerebrata which is a more wide-ranging management tool covering not only BLOB storage, but also table storage, storage queues and even managing your deployed compute nodes in Windows Azure.

This is just an excerpt. The full article can be found on www.simple-talk.com

An Introduction to Windows Azure BLOB StorageBy Mike Wood

Windows Azure BLOB storage service can be used to store and retrieve Binary Large Objects (BLOBs), or what are more commonly known as fi les. In this introduction to the Windows Azure BLOB storage service we will cover the differences between the types of BLOBs you can store, how to get fi les into and out of the service, how you can add metadata to your fi les and more.

Azure Management StudioManage your Windows Azure applications, storage and diagnostics

Free 30 day trial at www.cerebrata.com/ams

Dear Simple-Talk Editor

Why have you removed the links in my profi le? Where will people fi nd out important informati on regarding premium high end inexpensive discount basketball shoes?

This is vital!!

BASKETBALLSHOESVUITTONDIOR

Dear Simple-Talk Editor

I am a 55 year old dance instructor looking to write some guest posts on your site. I have writt en a lot of poetry, mostly haikus, and I parti cipate in weekly performance art pieces. I would like to write for <insert site here>, I will write honest, beauti ful arti cles about whatever topic you want. Please respond ASAP.

Ember Blazes

Dear SQL Server Central Editor

Why do you keep deleti ng my posts? Surely my adverti sement for a secretary is an appropriate topic for a forum area called Administrati on? I will assume deleti ng my post was a mistake, give me a minute and I will go ahead and repost it. Thanks!

Increase credit in 3 Easy Steps!

Appro Priate

Letters to the editor

MISSINGHave you seen this man?

Last seen Monday, pushing the "Deploy" button.

Since using Deployment Manager his weekends are free. His days are productive.

He's taken his fi rst vacation in 5 years.

Have you seen this man?