백업 파일을 사용하여 SQL Server 2008과 SQL Server용 Cloud SQL 간 데이터 마이그레이션
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 튜토리얼에서는 데이터를 SQL Server 2008에서 SQL Server 2017 Enterprise용 Cloud SQL로 마이그레이션합니다. 이 튜토리얼에서는 SQL Server 2008에서 데이터를 내보내고, 데이터를 SQL Server 2017용 Cloud SQL로 가져오고, 데이터 가져오기가 성공했는지 검증하는 방법을 보여줍니다.
이 튜토리얼은 SQL Server 2008에서 SQL Server 2017용 Cloud SQL로 데이터를 마이그레이션하거나 SQL Server 2008에서 SQL Server 2017로 업그레이드하려는 시스템 관리자, 개발자, 엔지니어, 데이터베이스 관리자, DevOps 엔지니어에게 유용합니다.
이 튜토리얼에서는 사용자가 SQL Server 2008 라이선스를 갖고 있고 다음 항목에 익숙하다고 가정합니다.
Google Cloud 콘솔 하단에서 Cloud Shell 세션이 열리고 명령줄 프롬프트가 표시됩니다. Cloud Shell은 Google Cloud CLI가 사전 설치된 셸 환경으로, 현재 프로젝트의 값이 이미 설정되어 있습니다. 세션이 초기화되는 데 몇 초 정도 걸릴 수 있습니다.
Cloud SQL 인스턴스 및 Cloud Storage 버킷 만들기
Cloud Shell에서 나중에 데이터베이스를 마이그레이션할 SQL Server 2017 Enterprise용 Cloud SQL 인스턴스를 만듭니다.
인스턴스를 만드는 데 몇 분 정도 걸릴 수 있습니다. 기본 루트 사용자 이름은 sqlserver이고 기본 비밀번호는 sqlserver12@입니다. 이 튜토리얼에서는 us-central1-f 영역에 인스턴스를 만듭니다. 영역에 대한 자세한 내용은 Cloud 위치를 참조하세요.
데이터를 Cloud SQL로 가져오기 전에 백업 파일을 저장할 Cloud Storage 버킷을 만듭니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-28(UTC)"],[],[],null,["*** ** * ** ***\n\nIn this tutorial, you migrate data from SQL Server 2008 to Cloud SQL for SQL Server 2017 Enterprise. The tutorial shows you how to export the data from SQL Server 2008, import the data to Cloud SQL for SQL Server 2017, and validate that the data was successfully imported.\n\n\u003cbr /\u003e\n\nIf you want to migrate data from SQL Server 2017, see\n[Migrating data between SQL Server 2017 and Cloud SQL for SQL Server using backup files](/solutions/migrating-data-between-sql-server-2017-and-cloud-sql-for-sql-server-using-backup-files).\n\nThis tutorial is useful if you are a sysadmin, developer, engineer, database\nadmin, or DevOps engineer who wants to migrate data from SQL Server 2008 to\nCloud SQL for SQL Server 2017 or who wants to upgrade from SQL Server\n2008 to SQL Server 2017.\n\nThe tutorial assumes that you have a license for SQL Server 2008 and that you're\nfamiliar with the following:\n\n- Microsoft SQL Server 2008\n- Microsoft SQL Server 2017\n- Microsoft PowerShell\n- [Cloud Storage](/storage)\n- [Cloud SQL](/sql/docs/sqlserver)\n\nObjectives\n\n- Create a Cloud SQL for SQL Server instance.\n- Create a Cloud Storage bucket.\n- Back up your database.\n- Import the database into Cloud SQL for SQL Server.\n- Validate the imported data.\n\nCosts\n\n\nIn this document, you use the following billable components of Google Cloud:\n\n\n- [Cloud SQL](/sql/pricing)\n- [Cloud Storage](/storage/pricing)\n\n\nTo generate a cost estimate based on your projected usage,\nuse the [pricing calculator](/products/calculator). \nNew Google Cloud users might be eligible for a [free trial](/free). \n\n\u003cbr /\u003e\n\nWhen you finish the tasks that are described in this document, you can avoid\ncontinued billing by deleting the resources that you created. For more information, see\n[Clean up](#clean-up).\n\nBefore you begin\n\n1. In the Google Cloud console, on the project selector page, select or\n create a Google Cloud project.\n\n | **Note:** If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [GO TO THE PROJECT SELECTOR PAGE](https://console.cloud.google.com/projectselector2/home/dashboard)\n2. Make sure that billing is enabled for your Google Cloud project.\n [Learn how to confirm billing is enabled for your project](/billing/docs/how-to/modify-project).\n\n3. Enable the Cloud Storage and Cloud SQL APIs.\n\n [ENABLE THE APIS](https://console.cloud.google.com/flows/enableapi?apiid=sqladmin,storage_component)\n4. [Install and initialize the Google Cloud CLI](/sdk/docs/install)\n on the server that's running SQL Server 2008.\n\n5. In the Google Cloud console, go to Cloud Shell.\n\n [GO TO Cloud Shell](https://console.cloud.google.com/?cloudshell=true)\n\n At the bottom of the Google Cloud console, a\n [Cloud Shell](/shell/docs/features)\n session opens and displays a command-line prompt. Cloud Shell is a shell\n environment with the Google Cloud CLI already installed, and with\n values already set for your current project. It can take a few seconds for\nthe session to initialize. \n\nCreating the Cloud SQL instance and Cloud Storage bucket\n\n1. In Cloud Shell, create the Cloud SQL for SQL Server\n 2017 Enterprise instance that you later migrate the database to:\n\n gcloud beta sql instances create target \\\n --database-version=SQLSERVER_2017_ENTERPRISE \\\n --cpu=2 \\\n --memory=5GB \\\n --root-password=sqlserver12@ \\\n --zone=us-central1-f\n\n It can take a few minutes to create the instance. The default root username\n is `sqlserver` with a default password of `sqlserver12@`. For this tutorial,\n you create the instance in the `us-central1-f` zone. For more information\n about zones, see\n [Cloud locations](/about/locations).\n2. Create a Cloud Storage bucket to store the backup file before\n the data is imported into Cloud SQL:\n\n ```\n gcloud storage buckets create \"gs://bucket-name\" --location=US\n ```\n\n Replace \u003cvar translate=\"no\"\u003ebucket-name\u003c/var\u003e with a unique name for the\n Cloud Storage bucket.\n\nBacking up your database\n\nIn this section, you connect to your Windows server running SQL Server 2008,\ncreate a backup of your database, and upload the backup database to\nCloud Storage.\n\n1. Connect to your Windows server running SQL Server 2008 by using RDP. It\n can be the primary or a replica server.\n\n2. Launch the PowerShell command-line tool.\n\n3. In the terminal where you\n [installed the gcloud CLI](/sdk/docs),\n create a backup folder:\n\n mkdir c:\\backup\n\n4. Create a backup of the database in the backup folder:\n\n ```\n osql -E -Q \"BACKUP DATABASE db-name TO DISK='c:\\backup\\db-name.bak'\"\n ```\n\n Replace \u003cvar translate=\"no\"\u003edb-name\u003c/var\u003e with the name of the database that\n you want to migrate to Cloud SQL.\n5. Copy the backup file to the Cloud Storage bucket:\n\n ```\n $PROJECT_ID = (gcloud sql instances describe target --format='value(project)' )\n gcloud storage cp c:\\backup\\db-name.bak gs://bucket-name --no-clobber\n ```\n\nImporting the backup file to Cloud SQL\n\n1. In Cloud Shell, retrieve the service account that's associated with\n the Cloud SQL instance and save it in a variable:\n\n SVC_EMAIL_ADDRESS=$(gcloud sql instances describe target \\\n --format='value(serviceAccountEmailAddress)')\n echo $SVC_EMAIL_ADDRESS\n\n Google Cloud creates a service account when you created the\n Cloud SQL instance. You use the service account to give the\n Cloud SQL instance permission to access the resources it needs.\n2. Give the service account permission to write to the\n Cloud Storage bucket:\n\n ```\n gcloud storage buckets add-iam-policy-binding gs://bucket-name \\\n --member=serviceAccount:${SVC_EMAIL_ADDRESS} \\\n --role=roles/storage.legacyBucketWriter\n ```\n3. Give the service account permission to read files in the\n Cloud Storage bucket:\n\n ```\n gcloud storage buckets add-iam-policy-binding gs://bucket-name \\\n --member=serviceAccount:${SVC_EMAIL_ADDRESS} \\\n --role=roles/storage.legacyObjectReader\n ```\n4. Import the backup file to the Cloud SQL database:\n\n ```\n gcloud beta sql import bak target \\\n gs://bucket-namedb-name.bak \\\n --database db-name\n ```\n\nValidating the data import\n\nIn this section, you check that the data was successfully imported.\n\n1. In Cloud Shell, install the\n [SQL Server toolkit](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-ver15):\n\n sudo apt-get install -y mssql-tools\n\n If you accept the license terms, enter `yes` when you're prompted.\n2. To securely access your Cloud SQL instance, download the\n [Cloud SQL proxy](https://cloud.google.com/sql/docs/mysql/sql-proxy):\n\n wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy\n\n3. Start the Cloud SQL proxy:\n\n CONNECTION_NAME=$(gcloud sql instances describe target --format='value(connectionName)')\n ./cloud_sql_proxy -instances=${CONNECTION_NAME}=tcp:1433 &\n\n4. Run a query to validate the data in one or more of the tables:\n\n ```\n /opt/mssql-tools/bin/sqlcmd -U sqlserver -S 127.0.0.1 -Q \"query-string\"\n ```\n\n Replace \u003cvar translate=\"no\"\u003equery-string\u003c/var\u003e with the SQL query that you\n want to run.\n\n When you're prompted, enter the `sqlserver12@` password.\n\nClean up The easiest way to eliminate billing is to delete the Google Cloud project you created for the tutorial.\n\n\u003cbr /\u003e\n\nDelete the project\n\n| **Caution** : Deleting a project has the following effects:\n|\n| - **Everything in the project is deleted.** If you used an existing project for the tasks in this document, when you delete it, you also delete any other work you've done in the project.\n| - **Custom project IDs are lost.** When you created this project, you might have created a custom project ID that you want to use in the future. To preserve the URLs that use the project ID, such as an `appspot.com` URL, delete selected resources inside the project instead of deleting the whole project.\n1. In the Google Cloud console, go to the **Manage resources** page.\n\n [Go to Manage resources](https://console.cloud.google.com/iam-admin/projects)\n2. In the project list, select the project that you want to delete, and then click **Delete**.\n3. In the dialog, type the project ID, and then click **Shut down** to delete the project.\n\nWhat's next\n\n- Read about [customer-managed encryption keys (CMEK) for Cloud SQL for SQL Server](/sql/docs/sqlserver/configure-cmek).\n- Read about [configuring private IP connectivity for Cloud SQL for SQL Server](/sql/docs/sqlserver/configure-private-ip).\n- Explore reference architectures, diagrams, and best practices about Google Cloud. Take a look at our [Cloud Architecture Center](/architecture)."]]