我认为执行此操作的方法是转到 SSMS 中的现有数据库(Sql Server 16.0.1105.1 开发人员版)并运行 Tasks | 生成脚本...
这包括一个 FullTextTable。所以我得到了以下脚本(仅显示开始):
USE [master]
GO
/****** Object: Database [LouisHowe] Script Date: 11/15/2023 5:56:31 PM ******/
CREATE DATABASE [LouisHowe]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'LouisHowe', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\LouisHowe.mdf' , SIZE = 73728KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'LouisHowe_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\LouisHowe_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT, LEDGER = OFF
GO
ALTER DATABASE [LouisHowe] SET COMPATIBILITY_LEVEL = 160
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [LouisHowe].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [LouisHowe] SET ANSI_NULL_DEFAULT OFF
看来数据库已经创建好了。但我收到了近 200 条错误消息(仅显示前几条):
Msg 40508, Level 16, State 1, Line 1
USE statement is not supported to switch between databases. Use a new connection to connect to a different database.
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near 'ON'.
Msg 319, Level 15, State 1, Line 10
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Msg 5011, Level 14, State 5, Line 12
User does not have permission to alter database 'LouisHowe', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 12
ALTER DATABASE statement failed.
我需要做什么来修复脚本?
正如mustaccio在评论中提到的,使用微软提供的工具会更容易。
可以从市场添加的Azure Migrate 工具已经变得越来越好,使将数据复制到云变得非常容易,这是一个相当大的工具,可能有点无法满足您的需求。
另一个不同但非常易于使用的工具是Azure 数据迁移助手。该工具可以进行评估,检查您是否具有无法迁移到云目标(或任何其他目标/版本)的前提功能,之后它还可以为您进行最终迁移。对于 Azure SQL 数据库,它基本上会执行您想要执行的操作,创建脚本并在目标上运行它。
如果您想找到更多选项,还有更多工具/选项可以迁移到云。