Create a Developer’s Extract of a Production Database

Create a Developer’s Extract of a Production Database

aving a development environment provides excellent software change management because it ensures secure, isolated testing and production environments. However, for many IT shops, maintaining three environments is too much overhead. Besides the challenge of guaranteeing both data integrity and consistent metadata between the environments, it requires keeping the development database at a manageable size despite the large database requirements inherent in the other environments.

If these challenges aren’t met, the enhancements made during development may not have the anticipated results in testing or production. And even if they are successfully met, you still need to contend with the most important challenge: preserving the relational chain between parents and children so that developers’ prototypes produce the desired results.

With this 10-Minute Solution, you will meet the challenges of providing a manageable development environment. You will develop an extract of the production environment that is just like production in every way but size, enabling developers to work with a representation of the database in test and production?only smaller. Instead of generating or making up sample data, you’ll extract production data, allowing developers to work locally without needing to dedicate a new server for development.

The extraction solution also maintains the relational chain as well as all the other assumptions of the “real” database?the foreign key references are transported to the extract in tact. You control the size of the extract with a selectable percentage by using the Modulo operator, and even if you select just one percent of the data in production, all its consistency will be preserved. In effect, this Solution is like a data warehouse ETL procedure in reverse.



How do I preserve the metadata and data content of the test and production databases in a development environment without the database size requirements inherent in those environments?



Create an extract of the production database to support local development.

Extract, Transform, and Load in Reverse
The first step is to create a view that limits the size of the largest transaction record volume. Using the Modulo operator, copy the results of the view to a dummy table that replaces the original table (without the sp_rename). Use the Data Transformation Services (DTS) to do the heavy lifting. DTS has the intelligence to move related database objects between databases so you don’t have to manually do it yourself. Using the Northwind database, I’ll walk you through developing the extract.

First, you need to set the scene for your export. Create a view of the lowest-level transactional table in your database (in the case of Northwind, that table is Order Details). As the lowest level of transactions, Order Details has the largest volume of data. To control the size of the export while preserving the relational integrity of the copy, create a view that selects only a portion of the transactions and use DTS to mind the relational details for you.

Create a New View
Open the Northwind Database and right click Views. You’ll find a number of cool views on which you could build. For example, you could use the Order Details Extended view, but you play with enhancements only after the view details are created. For the purposes of this Solution and to ease the spoofing of the Order Details table, select New view.

The View Designer window opens with four design surfaces. In the top pane, right click to add Order Details to the view. Select All Columns. In the SQL pane, add the Where Clause as shown in Figure 1.

Figure 1. The View Designer Window: Get a close-up view of the view designer window.

Save the view as MiniOrderDetails and close the View Designer. If you return to Enterprise Manager and run the view, you’ll see that instead of returning the entire Order Details table (2,155 rows), it returns only 22 rows. You have effectively chopped the volume of data down to one percent of the table’s contents by using the Modulo operator in the Where clause, which also has the fortunate side effect of preserving all the parent records that belong to that Order Details’ keys. You get a consistent picture of the relational chain but with only one percent of the detail in the view, yet you still have all the parent records that support the records in the Order Details table. Now you can use this view as the basis for creating a mini version of the Northwind database.

Create the Extract
Right click on Northwind and select All Tasks Export Data. Use Northwind as the source database, and create a new database to hold the extract. I called mine Illwind and created it on the same server. In practice, I would point to the developer’s server to establish my copy of Illwind, the destination database.

Figure 2. Select Objects to Copy Form: View the details of the Select Objects to Copy form

On the next screen, select Copy Objects and Data Between Databases. Figure 2 shows the Select Objects to Copy screen. Leave Create Destination Object checked. Because this new database is empty, you can uncheck Drop Destination Objects. However, you should include all dependent objects so that Northwind reproduces the metadata, constraints, etc. of the source in the target. Leave Copy Data Replace Exiting Data selected to preserve the foreign key constraints in the copy.

Deselect the Copy All Objects radio button, and in the following window, pick the view you just created, MiniOrderDetails. This will inform DTS to move only the tables that are dependent on the keys in the view. It will also move the view so we can use its contents to replace the bulk of the Order Details data.

Uncheck the Default Options checkbox and relieve the target of the security constraints, but leave all the Table Options and Quoted Identifiers checked. Click OK. This setup lets the system do the work of minding the relations and constraints. Click Next when the Select Objects to Copy form returns. On the Save, Schedule and Replicate Package form, leave Run Immediately checked and save the package on the server. You can use this DTS package to create Illwind on another developer’s workstation, so that his or her development can proceed in parallel. I saved the DTS package as “Mini Northwind.” Just click OK and you have created the extract of Northwind as Illwind on the destination server.

Check the Results

Figure 3. Query Analyzer: View of the Query Analyzer with the commands needed for the extract database Illwind.

After the thermometers and status messages, you should see the DTS Import/Export Wizard message: “Successfully copied objects from MSSQL Server to MSSQL Server.” Click Done and return to Enterprise Manager. If Illwind doesn’t appear on your list of databases, right click on the Databases folder and select Refresh. Illwind should now appear in the list. Remember to back up everything that you’ve changed on the server, like Master (standard operating procedure), Northwind (to keep your new view alive), and Illwind.

Open Illwind | Tables and you’ll notice that DTS moved all the related tables based on the foreign key relationships, even though you selected only the view for export. Open Views, and you’ll see the MiniOrderDetail view you created. You’ll use this view to replace the contents of Order Details, which still has all its original records.

In the extract database Illwind, open Query Analyzer and run the series of commands shown in Figure 3.

Run sp_spaceused and Query Analyzer will reveal the results shown in Figure 4.

Figure 4. Query Analyzer Results: View the results from running the Query Analyzer.

Although the differences between the databases are not dramatic because they were both pretty small to begin with, creating an extract of the database does offer an advantage: developers can do their work in an environment identical to production and testing without having to connect to or porting around a giant database copy. Additionally, you should take note of a couple of assumptions. In order for the modulus operator to work, the primary keys need to be integers and not natural business keys because dividing characters is tough. Another assumption of this requirement is that the primary keys are surrogate keys with no business meaning.

In practice, the testing process must have the same volume of data as production so you can measure any performance differences that enhancements create. An enhancement may not have the performance characteristics required for use in production. Yet developers need a reliable mirror of the production environment to carry out their development ideas?something like a sandbox?before they are ready to release their products for testing. There is no good way to replace the size factor in the testing environment. Testing is your last chance to evaluate and correct any errors before an enhancement goes live, and as such, having identical production and testing environments is an indispensable and irreplaceable part of software change management.

devx-admin

devx-admin

Share the Post:
USA Companies

Top Software Development Companies in USA

Navigating the tech landscape to find the right partner is crucial yet challenging. This article offers a comparative glimpse into the top software development companies

Software Development

Top Software Development Companies

Looking for the best in software development? Our list of Top Software Development Companies is your gateway to finding the right tech partner. Dive in

India Web Development

Top Web Development Companies in India

In the digital race, the right web development partner is your winning edge. Dive into our curated list of top web development companies in India,

USA Web Development

Top Web Development Companies in USA

Looking for the best web development companies in the USA? We’ve got you covered! Check out our top 10 picks to find the right partner

Clean Energy Adoption

Inside Michigan’s Clean Energy Revolution

Democratic state legislators in Michigan continue to discuss and debate clean energy legislation in the hopes of establishing a comprehensive clean energy strategy for the

Chips Act Revolution

European Chips Act: What is it?

In response to the intensifying worldwide technology competition, Europe has unveiled the long-awaited European Chips Act. This daring legislative proposal aims to fortify Europe’s semiconductor

USA Companies

Top Software Development Companies in USA

Navigating the tech landscape to find the right partner is crucial yet challenging. This article offers a comparative glimpse into the top software development companies in the USA. Through a

Software Development

Top Software Development Companies

Looking for the best in software development? Our list of Top Software Development Companies is your gateway to finding the right tech partner. Dive in and explore the leaders in

India Web Development

Top Web Development Companies in India

In the digital race, the right web development partner is your winning edge. Dive into our curated list of top web development companies in India, and kickstart your journey to

USA Web Development

Top Web Development Companies in USA

Looking for the best web development companies in the USA? We’ve got you covered! Check out our top 10 picks to find the right partner for your online project. Your

Clean Energy Adoption

Inside Michigan’s Clean Energy Revolution

Democratic state legislators in Michigan continue to discuss and debate clean energy legislation in the hopes of establishing a comprehensive clean energy strategy for the state. A Senate committee meeting

Chips Act Revolution

European Chips Act: What is it?

In response to the intensifying worldwide technology competition, Europe has unveiled the long-awaited European Chips Act. This daring legislative proposal aims to fortify Europe’s semiconductor supply chain and enhance its

Revolutionized Low-Code

You Should Use Low-Code Platforms for Apps

As the demand for rapid software development increases, low-code platforms have emerged as a popular choice among developers for their ability to build applications with minimal coding. These platforms not

Cybersecurity Strategy

Five Powerful Strategies to Bolster Your Cybersecurity

In today’s increasingly digital landscape, businesses of all sizes must prioritize cyber security measures to defend against potential dangers. Cyber security professionals suggest five simple technological strategies to help companies

Global Layoffs

Tech Layoffs Are Getting Worse Globally

Since the start of 2023, the global technology sector has experienced a significant rise in layoffs, with over 236,000 workers being let go by 1,019 tech firms, as per data

Huawei Electric Dazzle

Huawei Dazzles with Electric Vehicles and Wireless Earbuds

During a prominent unveiling event, Huawei, the Chinese telecommunications powerhouse, kept quiet about its enigmatic new 5G phone and alleged cutting-edge chip development. Instead, Huawei astounded the audience by presenting

Cybersecurity Banking Revolution

Digital Banking Needs Cybersecurity

The banking, financial, and insurance (BFSI) sectors are pioneers in digital transformation, using web applications and application programming interfaces (APIs) to provide seamless services to customers around the world. Rising

FinTech Leadership

Terry Clune’s Fintech Empire

Over the past 30 years, Terry Clune has built a remarkable business empire, with CluneTech at the helm. The CEO and Founder has successfully created eight fintech firms, attracting renowned

The Role Of AI Within A Web Design Agency?

In the digital age, the role of Artificial Intelligence (AI) in web design is rapidly evolving, transitioning from a futuristic concept to practical tools used in design, coding, content writing

Generative AI Revolution

Is Generative AI the Next Internet?

The increasing demand for Generative AI models has led to a surge in its adoption across diverse sectors, with healthcare, automotive, and financial services being among the top beneficiaries. These

Microsoft Laptop

The New Surface Laptop Studio 2 Is Nuts

The Surface Laptop Studio 2 is a dynamic and robust all-in-one laptop designed for creators and professionals alike. It features a 14.4″ touchscreen and a cutting-edge design that is over

5G Innovations

GPU-Accelerated 5G in Japan

NTT DOCOMO, a global telecommunications giant, is set to break new ground in the industry as it prepares to launch a GPU-accelerated 5G network in Japan. This innovative approach will

AI Ethics

AI Journalism: Balancing Integrity and Innovation

An op-ed, produced using Microsoft’s Bing Chat AI software, recently appeared in the St. Louis Post-Dispatch, discussing the potential concerns surrounding the employment of artificial intelligence (AI) in journalism. These

Savings Extravaganza

Big Deal Days Extravaganza

The highly awaited Big Deal Days event for October 2023 is nearly here, scheduled for the 10th and 11th. Similar to the previous year, this autumn sale has already created

Cisco Splunk Deal

Cisco Splunk Deal Sparks Tech Acquisition Frenzy

Cisco’s recent massive purchase of Splunk, an AI-powered cybersecurity firm, for $28 billion signals a potential boost in tech deals after a year of subdued mergers and acquisitions in the

Iran Drone Expansion

Iran’s Jet-Propelled Drone Reshapes Power Balance

Iran has recently unveiled a jet-propelled variant of its Shahed series drone, marking a significant advancement in the nation’s drone technology. The new drone is poised to reshape the regional

Solar Geoengineering

Did the Overshoot Commission Shoot Down Geoengineering?

The Overshoot Commission has recently released a comprehensive report that discusses the controversial topic of Solar Geoengineering, also known as Solar Radiation Modification (SRM). The Commission’s primary objective is to

Remote Learning

Revolutionizing Remote Learning for Success

School districts are preparing to reveal a substantial technological upgrade designed to significantly improve remote learning experiences for both educators and students amid the ongoing pandemic. This major investment, which

Revolutionary SABERS Transforming

SABERS Batteries Transforming Industries

Scientists John Connell and Yi Lin from NASA’s Solid-state Architecture Batteries for Enhanced Rechargeability and Safety (SABERS) project are working on experimental solid-state battery packs that could dramatically change the

Build a Website

How Much Does It Cost to Build a Website?

Are you wondering how much it costs to build a website? The approximated cost is based on several factors, including which add-ons and platforms you choose. For example, a self-hosted