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-3583

Ezi's questions

Martin Hope
Ezi
Asked: 2015-02-27 08:04:58 +0800 CST

为什么sql server要等待确认?

  • 4

我有一个应用程序经常从 sql 视图中请求大量行 [大约 20K],与此同时其他应用程序无法更新数据来自的表,更新查询被来自的选择阻止其他应用程序。

等待代码是“ASYNC_NETWORK_IO”,我发现它被描述为我正在发生的事情,我引用:

这通常是 SQL Server 等待客户端完成使用数据的地方。可能是客户端请求了非常大量的数据,或者只是由于编程不当而消耗数据的速度非常慢。

客户端通常一次处理一行,而不是在客户端缓存数据并立即向 SQL Server 确认。

我的问题是,为什么 sql server 在允许对表进行更新之前等待客户端完成该选择作业的处理?这是我可以更改的设置或配置吗?

sql-server sql-server-2012
  • 3 个回答
  • 615 Views
Martin Hope
Ezi
Asked: 2013-05-27 12:18:45 +0800 CST

如何修复 Microsoft.SqlServer.Types 程序集

  • 1

当我运行 checkdb('mydb') 时,这是打印的唯一错误消息。

Msg 8992, Level 16, State 1, Line 1
Check Catalog Msg 3857, State 1: The attribute (clr_name=NULL) is required but is missing for row (assembly_id=1) in sys.assemblies.

它指的是 'Microsoft.SqlServer.Types' 我确实看到在这个数据库中 clr_name 是空白的。但是在主数据库下有一个值。

我试图删除或更改程序集以添加此值,但它受到限制。

顺便说一句,这个数据库最近从 sql-server 2005 更新到 2008R2。

sql-server sql-server-2008-r2
  • 1 个回答
  • 609 Views
Martin Hope
Ezi
Asked: 2013-01-18 10:27:04 +0800 CST

如何处理巨大的桌子

  • 2

我们遇到了一些非常非常大的表的问题,它们会减慢系统速度。所以我的问题是,对于表中的行数来说,这个大小是否正常,以及可以做些什么来使它更小更轻,它不应该减慢一切。

在此处输入图像描述在此处输入图像描述

CREATE TABLE [dbo].[TransactionEntry](
    [TransactionEntryID] [uniqueidentifier] NOT NULL,
    [TransactionID] [uniqueidentifier] NULL,
    [ItemStoreID] [uniqueidentifier] NULL,
    [Sort] [int] NULL,
    [TransactionEntryType] [int] NOT NULL,
    [Taxable] [bit] NULL,
    [Qty] [decimal](19, 3) NULL,
    [UOMPrice] [money] NULL,
    [UOMType] [money] NULL,
    [UOMQty] [decimal](19, 3) NULL,
    [Total] [money] NULL,
    [RegUnitPrice] [money] NULL,
    [DiscountPerc] [decimal](19, 3) NULL,
    [DiscountAmount] [money] NULL,
    [SaleCode] [nvarchar](50) NULL,
    [PriceExplanation] [nvarchar](50) NULL,
    [ParentTransactionEntry] [uniqueidentifier] NULL,
    [AVGCost] [money] NULL,
    [Cost] [money] NULL,
    [ReturnReason] [int] NULL,
    [Note] [nvarchar](50) NULL,
    [DepartmentID] [uniqueidentifier] NULL,
    [DiscountOnTotal] [decimal](19, 3) NULL,
    [Status] [smallint] NULL,
    [DateCreated] [datetime] NULL,
    [UserCreated] [uniqueidentifier] NULL,
    [DateModified] [datetime] NULL,
    [UserModified] [uniqueidentifier] NULL,
    [TotalAfterDiscount] [decimal](18, 3) NULL,
    [TaxID] [uniqueidentifier] NULL,
    [TaxRate] [decimal](18, 4) NULL,
 CONSTRAINT [PK_TransactionEntry] PRIMARY KEY CLUSTERED 
(
    [TransactionEntryID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]

GO
sql-server-2008 database-design
  • 1 个回答
  • 2174 Views
Martin Hope
Ezi
Asked: 2012-11-08 12:04:00 +0800 CST

紧急模式修复失败,无事可做?

  • 2

生产服务器出现 I/O 磁盘错误,我尝试使用 dbcc 修复它,但它出现意外错误并在几分钟后崩溃。所以我把文件拿下来,把它复制到一台新机器上。

我没有最近可用的快速备份,(它是一个需要很长时间才能下载的在线备份)。

File activation failure. The physical file name "c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mydb_log.LDF" may be incorrect.
The log cannot be rebuilt because the database was not cleanly shut down.
DBCC results for 'mydb'.

Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:3724880; actual 0:0). It occurred during a read of page (1:3724880) in database ID 5 at offset 0x0000071aca0000 in file '\mydb.mdf'.  Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

The emergency-mode repair failed.You must restore from backup.
sql-server-2005 dbcc
  • 1 个回答
  • 1591 Views
Martin Hope
Ezi
Asked: 2012-04-03 14:05:42 +0800 CST

将数据从一个表批量移动到另一个表

  • 2

我有一个表 1800 万条记录我需要将其添加到另一个表(具有相同的结构)我尝试了导入导出向导,问题是日志变得非常非常大,最终它关闭了整个服务器,我不得不终止中间的进程。

我想如果我分批做会更快,但我不知道该怎么做。

(我不需要旧表,可以删除已复制的记录)

编辑:批量插入阻止所有操作,有没有办法阻止他在这里阻止所有人? 在此处输入图像描述

sql-server-2005 insert
  • 2 个回答
  • 3788 Views
Martin Hope
Ezi
Asked: 2012-03-22 07:09:37 +0800 CST

将大量从一张桌子复制到另一张桌子

  • 3

我有两个具有相同结构的表,我需要将所有表从表 A 复制到表 B,问题是表 A 中的某些记录已经存在于表 B 中,因此导致导入失败。

所以我做了一个查询来做导入(也使用导入工具中的构建)

SELECT * from TransactionEntryN
WHERE TransactionEntryN.TransactionEntryID 
NOT IN (select TransactionEntryID FROM TransactionEntry)

问题是这个操作需要 13 分钟。要复制 50K 条记录,而我那里有 1600 万条记录,我需要一周时间才能完成...

有没有更快的方法来做到这一点?

顺便说一句,主键 TransactionEntryID 是一个可能会减慢速度的唯一标识符?(我无法更改它,我只是想知道这是否是问题所在。

sql-server-2005 performance
  • 2 个回答
  • 3255 Views
Martin Hope
Ezi
Asked: 2012-03-20 14:05:28 +0800 CST

如何修复这个损坏的页面?

  • 2

我的数据库处于简单恢复模式。一页损坏,我只有使用简单备份创建的备份。

当我运行这个:

DBCC PAGE ('myDB', 1, 952663, 3)

我得到:

DBCC PAGE error: Invalid page type - dump style 3 not possible.

SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:952663; actual 2668:-1594740640). It occurred during a read of page (1:952663) in database ID 5 at offset 

Msg 8909, Level 16, State 1, Line 1
Table error: Object ID 0, index ID -1, partition ID 0, alloc unit ID 332114207834112 (type Unknown), page ID (1:952663) contains an incorrect page ID in its page header. The PageId in the page header = (2668:-1594740640).
CHECKDB found 0 allocation errors and 1 consistency errors not associated with any single object.
Msg 8928, Level 16, State 1, Line 1
Object ID 1131971209, index ID 1, partition ID 72057595034861568, alloc unit ID 72057595204796416 (type In-row data): Page (1:952663) could not be processed.  See other errors for details.
Msg 8976, Level 16, State 1, Line 1
Table error: Object ID 1131971209, index ID 1, partition ID 72057595034861568, alloc unit ID 72057595204796416 (type In-row data). Page (1:952663) was not seen in the scan although its parent (1:1616550) and previous (1:2296409) refer to it. Check any previous errors.
Msg 8978, Level 16, State 1, Line 1
Table error: Object ID 1131971209, index ID 1, partition ID 72057595034861568, alloc unit ID 72057595204796416 (type In-row data). Page (1:1743775) is missing a reference from previous page (1:952663). Possible chain linkage problem.
Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1131971209, index ID 25, partition ID 72057595034796032, alloc unit ID 72057595204730880 (type In-row data). Keys out of order on page (1:3474431), slots 237 and 238.
CHECKDB found 0 allocation errors and 4 consistency errors in table 'TransactionEntry' (object ID 1131971209).
CHECKDB found 0 allocation errors and 5 consistency errors in database 'DsPointOfSale'.
repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKDB (DsPointOfSale).

我还能修复这个数据库吗?

sql-server-2005 dbcc
  • 1 个回答
  • 8955 Views
Martin Hope
Ezi
Asked: 2012-03-02 10:55:12 +0800 CST

尝试获取大量数据时出错

  • 1

当我运行几天报告时,它就很好了。但如果我尝试检索超过一年的数据,则会收到此错误消息。

我尝试按照错误中的说明运行 DBCC CHECKDB,但运行 10 分钟后出现无法继续的错误。

SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:952663; actual 2668:-1594740640).
It occurred during a read of page (1:952663) in database ID 5 at offset 0x000001d12ae000 in file 'F:\Data\PointOfSale.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
sql-server-2005
  • 1 个回答
  • 193 Views
Martin Hope
Ezi
Asked: 2012-01-05 09:00:54 +0800 CST

删除表后收缩数据库?

  • 8

我在 SQL Server 数据库中有一个包含 70+ 百万条记录的表,我删除了该表(一次性的)以释放磁盘空间,但看起来大小没有太大变化。我确实看到我可以将数据库缩小到最低限度。

这是这样做的方法吗?

上次我使用 SQL Server Management Studio 进行收缩时,需要几个小时才能完成。有更快的方法吗?

在此处输入图像描述

sql-server shrink
  • 4 个回答
  • 26214 Views
Martin Hope
Ezi
Asked: 2011-10-05 17:51:55 +0800 CST

同一张表的两个关系

  • 8

我有一个交易表,每笔交易涉及 5-6 个联系人。每个联系人都有相同的字段,如姓名、地址、单元格、电子邮件等。

所以我猜最好的办法是使用同一个联系表并将其与事务表关联 5 次。所以我不需要制作同一种表 5 次。

当我与实体框架连接时,问题就开始了,这只需要一个关系。

我的问题是我应该为每种联系人类型制作 6 个联系人副本,还是我会更好地使用 6 个连接表(一个只有 2 个 id 的表,所以我可以进行连接)?

我认为这是一个非常普遍的问题,但我找不到明确的信息最好的方法是什么。

编辑:表格样本

sql-server relational-theory
  • 2 个回答
  • 7633 Views
Martin Hope
Ezi
Asked: 2011-10-05 09:14:39 +0800 CST

触发器不应阻止插入

  • 6

我有一个插入触发器,但如果触发器失败,插入也会失败。

即使触发器失败,有没有办法让插入继续进行?

编辑:输入新记录时,我使用触发器发送电子邮件。无论电子邮件是否发送,我都希望保存记录..

我将如何从 sp 中做到这一点?

sql-server trigger
  • 3 个回答
  • 7891 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