Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
AnceSoko authored Nov 15, 2023
1 parent c5d2782 commit 37ea1d2
Show file tree
Hide file tree
Showing 57 changed files with 36,717 additions and 0 deletions.
486 changes: 486 additions & 0 deletions 1. Creation of the database.ipynb

Large diffs are not rendered by default.

348 changes: 348 additions & 0 deletions 10. Database migration from MySQL to SQL Server.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,348 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "5b315be0-bb35-4182-8861-e7253891bdf2",
"metadata": {},
"source": [
"# 10. Database migration from MySQL to SQL Server"
]
},
{
"cell_type": "markdown",
"id": "a764d8f1-a78f-4ae9-bdc1-f49c86c42f20",
"metadata": {},
"source": [
"Both My Structured Query Language(MySQL) and Microsoft SQL Server (MSSQL) are widely used by professionals and enterprise database systems. However, MySQL is an open-source database management system(RDBMS), whereas MSSQL Server is a Microsoft-developed RDBMS. Therefore, users can choose between multiple MS SQL Server and SQL Server editions as per their needs and budgets. But as a matter of fact, MySQL is an open-source database, so there is a possibility of hacking and virus attacks."
]
},
{
"cell_type": "markdown",
"id": "1508dc28-df81-4972-b8e8-fb5f3da9343a",
"metadata": {},
"source": [
"Some reasons to consider migrating data from MySQL to SQL Server include:"
]
},
{
"cell_type": "markdown",
"id": "9a9a2e82-ef32-4e26-a24f-2fad55c335b8",
"metadata": {},
"source": [
"- If your organization primarily uses Microsoft technologies and tools, migrating to SQL Server can lead to better integration with existing systems, such as Microsoft's .NET framework and Visual Studio."
]
},
{
"cell_type": "markdown",
"id": "7fdd691f-db3e-4231-b7a5-5fd9d52fad23",
"metadata": {},
"source": [
"- SQL Server offers robust security features, including built-in authentication, encryption, and advanced access control mechanisms, which can be attractive for organizations with stringent security requirements."
]
},
{
"cell_type": "markdown",
"id": "7f9879e8-def5-4ae7-8d6e-de318beb7a01",
"metadata": {},
"source": [
"- SQL Server is known for its scalability and high-performance capabilities. Organizations that expect their database to grow over time may choose SQL Server to handle increased data volumes efficiently."
]
},
{
"cell_type": "markdown",
"id": "2032e991-a9a3-447b-9f6d-51471703d7ba",
"metadata": {},
"source": [
"- SQL Server provides features and auditing capabilities that can help organizations meet compliance standards, such as HIPAA, PCI DSS, and GDPR, which may be critical in certain industries."
]
},
{
"cell_type": "markdown",
"id": "3a67173b-500d-42d0-bad4-c3cdf07611a9",
"metadata": {},
"source": [
"- SQL Server has integrated support for business intelligence and data analytics tools, making it easier to perform data analysis and reporting."
]
},
{
"cell_type": "markdown",
"id": "25215fb3-9d2e-4284-8a11-8c894d3113d7",
"metadata": {},
"source": [
"- SQL Server offers features like database mirroring, log shipping, and failover clustering for improved business continuity and disaster recovery capabilities."
]
},
{
"cell_type": "markdown",
"id": "a13546c9-604a-4a02-9027-f8505fdf79f1",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"## 1. How to move data from MySQL to SQL Server"
]
},
{
"cell_type": "markdown",
"id": "6aef1e5a-f3ff-4346-a425-305023aa5e4a",
"metadata": {},
"source": [
"### Prerequisites"
]
},
{
"cell_type": "markdown",
"id": "4b895f33-d0b0-4a53-9a3d-b0abe6f3e351",
"metadata": {},
"source": [
"- Make sure you have installed SQL Server. If not, here is a link to download it: https://www.microsoft.com/en-us/sql-server/sql-server-downloads"
]
},
{
"cell_type": "markdown",
"id": "7135151b-4490-4dce-9880-75c306d7a873",
"metadata": {},
"source": [
"- Make sure you have ODBC driver installed. Pres windows+R buttons on your keyboard to open the \"Run\" dialog. Type `odbcad32` and press Enter or click \"OK.\" In the ODBC Data Source Administrator window that opens, navigate to the \"Drivers\" tab. Look for the \"MySQL ODBC\" or \"MySQL ODBC Driver\" entry in the list of available drivers. If you see it listed, it means that you have the MySQL ODBC driver installed on your system."
]
},
{
"cell_type": "markdown",
"id": "f0e350b0-7779-4ec7-9432-7e36fd5b3e2c",
"metadata": {},
"source": [
"- Make sure you have Microsoft SQL Server Migration Assistant for MySQL downloaded. Download link: https://www.microsoft.com/en-us/download/details.aspx?id=54257"
]
},
{
"cell_type": "markdown",
"id": "783d788a-3201-4deb-a9a7-727b3bcb49ee",
"metadata": {},
"source": [
"### Assess:"
]
},
{
"cell_type": "markdown",
"id": "191315c1-e999-42f6-9b6e-bbd6a8619f18",
"metadata": {},
"source": [
"SSMA (SQL Server Migration Assistant) for MySQL allows you to review database objects and data and assess databases for migration. Follow the steps to To create an assessment:"
]
},
{
"cell_type": "markdown",
"id": "c27eef14-619a-4ec2-b4a5-87a9ce56e6a0",
"metadata": {},
"source": [
"1. Open SSMA for MySQL"
]
},
{
"cell_type": "markdown",
"id": "8b17605d-86e8-4192-af64-77bda8b051dc",
"metadata": {},
"source": [
"2. Go to File -> New Project"
]
},
{
"cell_type": "markdown",
"id": "0ab086d0-66ae-4874-a94d-156c062318d4",
"metadata": {},
"source": [
"3. Enter the project name and browse the path, select the SQL Server version where you want to move data(mine is SQL Server 2022)"
]
},
{
"cell_type": "markdown",
"id": "59ac5889-54f6-4394-bb0e-4da07c9bdbfc",
"metadata": {},
"source": [
"![first_step.png](images/first_step.png)\r\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "d315010a-b5a9-4a74-bb79-8ce2529ad0f0",
"metadata": {},
"source": [
" 4. Navigate to Connect to MySQL and enter the required connection details, and click Connect."
]
},
{
"cell_type": "markdown",
"id": "e6595c85-e672-4fe2-a04d-558e7a7a7aeb",
"metadata": {},
"source": [
"![second_step.png](images/second_step.png)\n"
]
},
{
"cell_type": "markdown",
"id": "57fc3856-7a29-4d13-a030-791f1daf94f7",
"metadata": {},
"source": [
" 5. In the next pop up window, select the database you want to migrate and click \"OK\""
]
},
{
"cell_type": "markdown",
"id": "91780d62-93c8-4aee-8641-4fd0ffe72b29",
"metadata": {},
"source": [
" 6. In MySQL Metadata Explorer move to MySQL database you would like to migrate and click the Create Report option from the list. Or you can also directly click on the Create Group button."
]
},
{
"cell_type": "markdown",
"id": "b9beb2d3-e977-4040-ac8c-00d2fd504e02",
"metadata": {},
"source": [
"![third_step.png](images/third_step.png)\n"
]
},
{
"cell_type": "markdown",
"id": "e47e7a46-5ea7-4fce-a66e-4d31cc41c01b",
"metadata": {},
"source": [
" 7. Finally, review the HTML report to understand the conversion process. Furthermore, you can also open the report to verify the process in detail."
]
},
{
"cell_type": "markdown",
"id": "b8d19ed7-4ca8-4185-ad65-cd9ff8346753",
"metadata": {},
"source": [
"![fourth_step.png](images/real_migration.png)\n"
]
},
{
"cell_type": "markdown",
"id": "84e87f5b-2749-4229-9d0e-412dd5d343fe",
"metadata": {},
"source": [
" 8. Click on Connect SQL Server and insert all the needed credentials to connect to it. In the drop down menu select the target database"
]
},
{
"cell_type": "markdown",
"id": "f81fc841-512e-4ebd-9584-d73ebdf33f0e",
"metadata": {},
"source": [
"![fifth_step.png](images/fifth_step.png)"
]
},
{
"cell_type": "markdown",
"id": "10b6a008-9764-48f2-9fa8-c8c277a3e727",
"metadata": {},
"source": [
" 9. Right-click source database from MySQL Metadata Explorer (in my case bookshopnearme) and click convert Schema"
]
},
{
"cell_type": "markdown",
"id": "39d93c17-c8f9-42a3-98c9-add6dd696eb4",
"metadata": {},
"source": [
"![sixt_step.png](images\\sixt_step.png)"
]
},
{
"cell_type": "markdown",
"id": "badad6ff-d16d-4d36-8ed4-4e99c5e941c6",
"metadata": {},
"source": [
" 10. Once the conversion is completed, compare and review the converted objects to the original objects."
]
},
{
"cell_type": "markdown",
"id": "1d9b58bd-f48b-424b-8a48-eb5f9bc031a0",
"metadata": {},
"source": [
" 11. You can also check the errors in the Error List pane by selecting the Review results option."
]
},
{
"cell_type": "markdown",
"id": "ffad12a5-53df-4d99-aeff-8ae3635ddae0",
"metadata": {},
"source": [
"12. Click on Migrate Data, once this is done, you will see a pop up window that allows you to Create a Report, press on that and save your report."
]
},
{
"cell_type": "markdown",
"id": "7e6fda4d-6c5a-4956-b08c-69ed050ca62b",
"metadata": {},
"source": [
" 13. Lastly, save the project locally by clicking on Save Project."
]
},
{
"cell_type": "markdown",
"id": "8113aa11-fd5a-4d66-b494-2a58c0b39152",
"metadata": {},
"source": [
"**CHECK IF DATA HAS BEEN MIGRATED PROPERLY IN BOTH - SOURCE AND TARGET DATABASES**"
]
},
{
"cell_type": "markdown",
"id": "d64c7157-57ac-4873-b976-2cddc6f2937a",
"metadata": {},
"source": [
"In SQL Server checking how many authors do I have:"
]
},
{
"cell_type": "markdown",
"id": "1dd7690c-ce8c-4c3e-b2fe-07f018d16c02",
"metadata": {},
"source": [
"![seventh_step.png](images/seventh_step.png)"
]
},
{
"cell_type": "markdown",
"id": "ba8b05fb-ff42-4b80-807a-3eab0e0fed9b",
"metadata": {},
"source": [
"In MySQL checking do I have the same number of authors in my database:"
]
},
{
"cell_type": "markdown",
"id": "72515d21-a550-4501-b18c-c2518834d90e",
"metadata": {},
"source": [
"![eight_step.png](images/eight_step.png)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 37ea1d2

Please sign in to comment.