AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-122919

Kirsten's questions

Martin Hope
Kirsten
Asked: 2021-12-11 10:57:58 +0800 CST

对象不能从 DBNull 转换为其他类型。(mscorlib) 单击目录按钮查看备份设备时

  • 0

我想将 SQL Express 2017 数据库的完整备份还原到 SQL Server Standard 2019 两者都在 Oracle Linux 8.5 上

选择备份设备

当我单击内容按钮时,出现以下错误

Object cannot be cast from DBNull to other types. (mscorlib)
------------------------------
Program Location:
  at System.DBNull.System.IConvertible.ToBoolean(IFormatProvider provider)
  at System.Convert.ToBoolean(Object value, IFormatProvider provider)
  at Microsoft.SqlServer.Management.SqlManagerUI.BakDevMediaContents.InitBackupSets(Restore sqlRestore)
  at Microsoft.SqlServer.Management.SqlManagerUI.BakDevMediaContents.InitProp()
  at Microsoft.SqlServer.Management.SqlManagerUI.BakDevMediaContents.InitializeOffline(CDataContainer dataContainer)
  at Microsoft.SqlServer.Management.SqlManagerUI.BackupDeviceContents..ctor(CDataContainer dataContainer, IHelpProvider f1help)
  at Microsoft.SqlServer.Management.SqlManagerUI.SqlRestoreSelectBackupSource.buttonContents_Click(Object sender, EventArgs e)
  at System.Windows.Forms.Control.OnClick(EventArgs e)
  at System.Windows.Forms.Button.OnClick(EventArgs e)
  at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
  at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.ButtonBase.WndProc(Message& m)
  at System.Windows.Forms.Button.WndProc(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
  at System.Windows.Forms.Application.RunDialog(Form form)
  at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
  at Microsoft.SqlServer.Management.RelationalEngineTasks.RestoreDatabaseGeneralView.buttonSelectDevice_Click(Object sender, EventArgs e)
  at System.Windows.Forms.Control.OnClick(EventArgs e)
  at System.Windows.Forms.Button.OnClick(EventArgs e)
  at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
  at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.ButtonBase.WndProc(Message& m)
  at System.Windows.Forms.Button.WndProc(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.SqlServer.Management.ActionHandlers.DialogBasedActionHandler.RunTaskFormThread(Object contextObject)
sql-server
  • 1 个回答
  • 505 Views
Martin Hope
Kirsten
Asked: 2021-08-04 22:24:07 +0800 CST

数据库中已经有一个名为 PK_MyPrimaryKey 的对象(临时表上的主索引)

  • 1

简化代码

var sql = @" create table #Temp( 
                int Id NOT NULL
                CONSTRAINT [PK_TempId] PRIMARY KEY (Id)
             )
             insert into #temp(id) select (Id) from SomeOtherTable
             select Id from #Temp
             "

        using (var db = new MyDbContext())
            {
                var results = db.Database.SqlQuery<int>(sql).ToList();
                return results;
            }

导致间歇性错误

There is already an object named PK_TempId in the database

我已经添加了

drop table #temp

并且正在等待查找是否可以解决问题。

在我添加索引之前,代码运行多年没有任何问题,也没有明显需要删除临时表。

我在这里找到了一个建议,即不应在临时表中使用命名索引。但我不确定有什么替代方案。

sql-server temporary-tables
  • 1 个回答
  • 956 Views
Martin Hope
Kirsten
Asked: 2020-04-18 16:56:13 +0800 CST

spid 挂起 ASYNC_NETWORK_IO 疑难解答

  • 2

最近我们将数据库移到了新服务器

旧服务器正在运行

Microsoft SQL Server 2017 (RTM-CU16) (KB4508218) - 14.0.3223.3 (X64) Jul 12 2019 17:43:08
Copyright (C) 2017 Microsoft Corporation
Express Edition (64-bit) on Linux (Ubuntu 16.04.6 LTS)

新服务器正在运行

Microsoft SQL Server 2019 (RTM-CU2) (KB4536075) - 15.0.4013.40 (X64) Feb 3 2020 16:40:57
Copyright (C) 2019 Microsoft Corporation
Express Edition (64-bit) on Linux (CentOS Linux 8 (Core))

我们有一个使用数据库的 C# Windows 服务。它间歇性地停止或运行非常缓慢。

Windows 服务使用 .Net Framework 4.7.2,它调用一个用 .net 标准 2.0 编写的库,该库也进行 sql 调用。

我发现了这个关于为什么 SPID 的状态被暂停的问题,并看到我们的暂停 Spid 有 wait_type ASYNC_NETWORK_IO

根据文档,这

当任务被网络阻塞时发生在网络写入上。验证客户端是否正在处理来自服务器的数据。

重新启动 Windows 服务确实可以暂时解决问题。但是,这并不能帮助我解决问题的原因。

我主要使用的是 EntityFramework 6.4

[更新]

我已经开始跑步

dbcc inputbuffer(sessionId) 

查看最后运行的 SQL

sql-server entity-framework
  • 1 个回答
  • 489 Views
Martin Hope
Kirsten
Asked: 2020-02-25 12:10:08 +0800 CST

Express 是否存储任何统计信息以指示何时由于 Express 而导致性能下降?

  • 0

我正在寻找从 Express 升级到 Standard 的商业原因。根据我的问题在这里

SQL Server 是否会在内部存储有关何时因版本/许可功能(例如可用内核数)而被搁置的任何信息?

我可以运行哪些查询来找出答案?

sql-server
  • 1 个回答
  • 30 Views
Martin Hope
Kirsten
Asked: 2019-10-11 13:25:33 +0800 CST

SQL Server 2017 Express 中的数据库一致性历史记录失败

  • 0

当我使用 MSSM 运行数据库一致性历史报告时,我收到一条错误消息:

无法检索报告这一部分的数据。出现以下错误消息 19050,级别 16,状态 5 跟踪文件名 '/var/opt/mmsql/log/log_86866.trc\log.trc' 无效

我重新运行了 DBBCC CHECKDB,但没有帮助。

当我跑

SELECT tracefilename = path FROM sys.traces 
WHERE is_default = 1;

我得到的跟踪文件名返回为

/var/opt/mssql/log/log_87148.trc

如果我重新运行数据库一致性历史记录,则tracefilename现在是

'/var/opt/mmsql/log/log_87148.trc\log.trc' is invalid
sql-server sql-server-2017
  • 1 个回答
  • 112 Views
Martin Hope
Kirsten
Asked: 2019-10-07 12:16:48 +0800 CST

“PRIMARY”文件组已满。如何在 SQL Server Express 2017 中增加 temdb 大小?

  • 2

当我重新索引特定表时

DBCC DBREINDEX(@TableName, '',90) 

我收到一个错误

级别 17,状态 2,过程 aareindex,第 21 行 [批处理开始行 0] 无法为数据库“mydatabase”中的对象“dbo.SORT 临时运行存储:422738479742976”分配空间,因为“PRIMARY”文件组已满。通过删除不需要的文件、删除文件组中的对象、向文件组添加其他文件或为文件组中的现有文件设置自动增长来创建磁盘空间。

所以我想尝试增加 TempDb 的大小

我可以通过查看数据库属性来使用 SSMS 查看大小,但我不知道如何设置它。

[更新]

select type_desc, name, size, max_size, growth from tempdb.sys.database_files

返回

这些结果

文件大小已经是 10236 Mb,Express 限制是 10 Gig 但是磁盘使用报告显示 26% 的磁盘空间未分配,40% 是数据,32% 是索引。

sql-server sql-server-2017
  • 2 个回答
  • 7901 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve