Export and Import the database objects using BACPAC file

In this post i will be explaining about how to export the database objects to backpac and import from bacpac file.

  1. Connect to SQL Server , Right click on the database and Go to Tasks –> Export Data Tier Application

1

 

2. Introduction screen will be appeared as shown below, click next to continue

2.PNG

3. Export setting screen , please select where you want to store the bacpac file. It can be either on windows azure machine or on local machine. I have selected local in this example.

3

4. Please provide the location of the file to save the bacpac file.

4.PNG

5. Same export settings screen, click on advance tab to select the objects you would like to export. Once you have selected, click next to proceed

5.PNG

6. Progress screen will appear, it will show the progress of the export as shown in below figure

7

7. Results screen will appear after completion of export as shown in below figure.

8.PNG

8. You have successfully exported the database objects as bacpac file. Let us create new database by importing the bacpac file in another server. Right click on databases and select import Data-tier Application as shown in below screen

`

9.png

9.  Introduction screen will appear as show in below figure. Click next to continue

10.PNG

10. Import settings screen will appear and specify the bacpac file which was created before. If you have stored the bacpac file in windows azure blob storage then you can select second option to import the bacpac file. In this example, i have saved the bacpac file on the local machine.  Click next to continue.

11.PNG

11. Database settings screen will appear as below, specify the name of the database , data and log file path. In this case i have specified database name as “Hello_Test” and the paths are on the same drive. Best practice is to keep the data and log files separated. Click next to continue.

12.PNG

12. You would see summary screen as below after the above step. Click next to continue.

13.PNG

13. Progress screen will appear and will display the progress of the database import as show in the below figure. Click next to continue.

14.PNG

14. Results screen will show you the results of import progress. As you can see in the below screeshot, the import operation completed. Let us see the new database “Hello_Test” and the objects.

15.PNG

15. There you go. New database “Hello_Test” has been created.

 

16

So far you have learned how to export database objects as bacpac and import the bacpac to create a database. You may think, the same can be achieved by doing backup and restore. Yes, we can achieve using backup and restore. But,

  1. You do not have an option to chose few database objects/Schemas to import rather than complete database, unless you maintain separate file groups for different objects.
  2. Import a BACPAC file to create a new Azure SQL database.
  3. Restore SQL Azure database to MS SQL Server.

 

Cheers

Hope you like the post!

Ramasankar Molleti

LinkedIn: LinkedIn Profile

Twitter: Twitter

 

Advertisements

About Ramasankar

My name is Ramasankar Molleti, and I have been working on sql server over 10 years, primarily focusing on Database Administration, Architect , Development and Business intelligence of sql server. I also hold various Microsoft certifications (Microsoft Certified Information Technology Professional, Microsoft Certified Technology Specialist, and Microsoft Certified Solution Associate). Disclaimer The views expressed on this website/blog are mine alone and do not reflect the views of my company. All postings on this blog are provided “AS IS” with no warranties, and confers no rights. The owner of https://sqlram.wordpress.com will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.
This entry was posted in Database Administration. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s