SQL SERVER 数据库选项设置错误导致跨数库访问效率低下,及解决办法

 

在我本机有一数据库BillData,一数据库SystemData
其中BillData库中有一表bill_salesPro,
在SystemData
库中创建一视图
create view bill_salesPro as select * from A.dbo.bill_salesPro

在SystemData库中执行检索语句:select * from bill_salesPro 所花的时间:0.1ms
在BillData库中执行检索语句:select * from bill_salesPro 所花的时间:0.001ms

经过仔细查看数据库选项设置,发现是选项设置错了,修改如下,即可以解决:
use SystemData
GO
ALTER DATABASE [SystemData] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [SystemData] SET ANSI_NULLS OFF
GO
ALTER DATABASE [SystemData] SET ANSI_PADDING OFF
GO
ALTER DATABASE [SystemData] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [SystemData] SET ARITHABORT OFF
GO
ALTER DATABASE [SystemData] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [SystemData] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [SystemData] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [SystemData] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [SystemData] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [SystemData] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [SystemData] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [SystemData] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [SystemData] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [SystemData] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [SystemData] SET  DISABLE_BROKER
GO
ALTER DATABASE [SystemData] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [SystemData] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [SystemData] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [SystemData] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [SystemData] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [SystemData] SET  READ_WRITE
GO
ALTER DATABASE [SystemData] SET RECOVERY FULL
GO
ALTER DATABASE [SystemData] SET  MULTI_USER
GO
ALTER DATABASE [SystemData] SET PAGE_VERIFY TORN_PAGE_DETECTION 
GO
ALTER DATABASE [SystemData] SET DB_CHAINING OFF
go
use BillData
GO
ALTER DATABASE [BillData] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [BillData] SET ANSI_NULLS OFF
GO
ALTER DATABASE [BillData] SET ANSI_PADDING OFF
GO
ALTER DATABASE [BillData] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [BillData] SET ARITHABORT OFF
GO
ALTER DATABASE [BillData] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [BillData] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [BillData] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [BillData] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [BillData] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [BillData] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [BillData] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [BillData] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [BillData] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [BillData] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [BillData] SET  DISABLE_BROKER
GO
ALTER DATABASE [BillData] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [BillData] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [BillData] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [BillData] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [BillData] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [BillData] SET  READ_WRITE
GO
ALTER DATABASE [BillData] SET RECOVERY FULL
GO
ALTER DATABASE [BillData] SET  MULTI_USER
GO
ALTER DATABASE [BillData] SET PAGE_VERIFY TORN_PAGE_DETECTION 
GO
ALTER DATABASE [BillData] SET DB_CHAINING OFF
go

阅读更多
个人分类: Ms SQL Server
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭