1.数据库的迁移方案
->分离 附加
->权限问题:
->启用Administrator账号
->把数据库文件放到默认的数据库文件存放目录。
->数据库文件兼容级别,设置成2005兼容
->脱机 附加
->备份 还原
->生成SQL脚本(最保险)
设置脚本编写选项——保存到新建查询窗口;
高级——要编写脚本的数据的类型——架构和数据
USE [master]
GO
/****** Object: Database [LJK_SQLServerDB] Script Date: 2019/11/1 9:33:50 ******/
CREATE DATABASE [LJK_SQLServerDB]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'LJK_SQLServerDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\LJK_SQLServerDB.mdf' , SIZE = 5120KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'LJK_SQLServerDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\LJK_SQLServerDB_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = %)
GO
ALTER DATABASE [LJK_SQLServerDB] SET COMPATIBILITY_LEVEL =
GO
IF ( = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [LJK_SQLServerDB].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [LJK_SQLServerDB] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET ANSI_NULLS OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET ANSI_PADDING OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET ARITHABORT OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [LJK_SQLServerDB] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [LJK_SQLServerDB] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [LJK_SQLServerDB] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET DISABLE_BROKER
GO
ALTER DATABASE [LJK_SQLServerDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [LJK_SQLServerDB] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET RECOVERY FULL
GO
ALTER DATABASE [LJK_SQLServerDB] SET MULTI_USER
GO
ALTER DATABASE [LJK_SQLServerDB] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [LJK_SQLServerDB] SET DB_CHAINING OFF
GO
ALTER DATABASE [LJK_SQLServerDB] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [LJK_SQLServerDB] SET TARGET_RECOVERY_TIME = SECONDS
GO
USE [LJK_SQLServerDB]
GO
/****** Object: Table [dbo].[User_Info] Script Date: 2019/11/1 9:33:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[User_Info](
[User_ID] [int] IDENTITY(,) NOT NULL,
[User_Name] [nchar]() NULL,
[User_Gender] [bit] NULL,
[User_Age] [int] NULL,
[User_Address] [nvarchar]() NULL,
[User_Birthday] [datetime] NULL,
[User_Remark] [nvarchar](max) NULL,
[User_Money] [money] NULL,
[User_GUIDDemo] [uniqueidentifier] NULL,
CONSTRAINT [PK_User_Info] PRIMARY KEY CLUSTERED
(
[User_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO
SET IDENTITY_INSERT [dbo].[User_Info] ON GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'li ', , , NULL, CAST(0x00009F9800000000 AS DateTime), NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'koko ', , , NULL, CAST(0x0000A04900000000 AS DateTime), NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'ali ', , , NULL, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'wang ', , , NULL, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'kong ', , , NULL, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'ii ', , , NULL, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'ii ', , , NULL, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'mm ', , , NULL, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'tt ', , , NULL, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'gg ', , , NULL, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'dd ', , , NULL, NULL, NULL, NULL, NULL)
GO
INSERT [dbo].[User_Info] ([User_ID], [User_Name], [User_Gender], [User_Age], [User_Address], [User_Birthday], [User_Remark], [User_Money], [User_GUIDDemo]) VALUES (, N'rr ', , , NULL, NULL, NULL, NULL, NULL)
GO
SET IDENTITY_INSERT [dbo].[User_Info] OFF
GO
USE [master]
GO
ALTER DATABASE [LJK_SQLServerDB] SET READ_WRITE
GO