您正在查看 "Sql" 分类下的文章
2007-05-23 05:14 P.M.
2007-05-23 04:11 P.M.
To reproduce the above problem, use the following commands:
sp_addlogin 'dSQLuser'
GO
sp_defaultdb 'dSQLuser', 'pubs'
USE pubs
GO
sp_adduser 'dSQLUser', 'dSQLUser'
GO
CREATE PROC dSQLProc
AS
BEGIN
SELECT * FROM titles WHERE title_id = 'BU1032' --This works
DECLARE @str CHAR(100)
SET @str = 'SELECT * FROM titles WHERE |
2007-05-23 04:10 P.M.
by Vyas Kondreddi
Databases are the heart and soul of many enterprise applications, and it is very essential to pay special attention to database programming. I've seen in many occasions where database programming is overlooked, thinking that it's something easy that be done by anyone. This is wrong. |
2007-05-23 04:05 P.M.
Introduction
In this article, I want to tell you about SQL Server 7.0/2000 Transaction Isolation Levels, what kinds of Transaction Isolation Levels exist, and how you can set the appropriate Transaction Isolation Level, about Lock types and Locking optimizer hints, about deadlocks, and about how you can view locks by using the sp_lock stored procedure.
Transaction Isolation Levels
There are four isolation levels:
READ UNCOMMITTED
|
2007-05-23 02:09 P.M.
Deadlocking occurs when two user processes have locks on separate objects and each process is trying to acquire a lock on the object that the other process has. When this happens, SQL Server ends the deadlock by automatically choosing one and aborting the process, allowing the other process to continue. The aborted transaction is rolled back and an error message is sent to the user of the aborted process. Generally, the transaction that requires th |
2007-05-23 11:33 A.M.
锁的概述
一. 为什么要引入锁
多个用户同时对数据库的并发操作时会带来以下数据不一致的问题:
丢失更新
A,B两个用户读同一数据并进行修改,其中一个用户的修改结果破坏了另一个修改的结果,比如订票系统
脏读
A用户修改了数据,随后B用户又读出该数据,但A用户因为某些原因取消了对数据的修改,数据恢复原值,此时B得到的数据就与数据库内的数据产生了不一致
不可重复读
A用户读取数据,随后B用户读出该数据并修改,此时A用户再读取数据时发 |
2007-05-23 11:09 A.M.
【IT168 服务器学院】锁是网络数据库中的一个非常重要的概念,它主要用于多用户环境下保证数据库完整性和一致性。各种大型数据库所采用的锁的基本理论是一致的,但在具体实现上各有差别。目前,大多数数据库管理系统都或多或少具有自我调节、自我管理的功能,因此很多用户实际上不清楚锁的理论和所用数据库中锁的具体实现。
Microsoft SQL Server(以下简称SQL Server)作为一种中小型数据库管理系统,已经得到了广泛的应用,该系统更强调由系统来管理锁。在用户有SQL请求时,系统分析请求, |
2007-05-23 10:43 A.M.
=====================================================
-- 如何使用跟踪标记 1204
--
-- 邹建 2005.08(引用请保留此信息)
-- =====================================================
-- =====================================================
/*-- 说明
跟踪标记 1204 用于返回参与死锁的锁的类型以及当前受影响的命令。死锁信息将自动发送到错误日志。
开启跟踪标记使用 DBCC TRACEON ,第3个参数指定为-1,表示不单单针 |
2007-05-22 09:18 P.M.
The first step in finding the cause of a subtle deadlock is to find a method to reproduce it. This may involve stress or load testing the system, or just watching it under use. It also helps to find the minimal conditions required for the deadlock, isolating the application behavior so that you can narrow your tracing to just the deadlock behavior.
|
2007-05-22 09:17 P.M.
|
Gathering Deadlock Information
There are three basic strategies for gathering deadlock information. You can use the Perfmon Deadlocks/sec counter, inspect the output of the trace fla | |
2007-05-22 09:17 P.M.
| Table 5. A single-resource deadlock transaction history.
| |
2007-05-22 09:16 P.M.
| Table 2. The most common types of resource locks.
| |
2007-05-22 09:15 P.M.
SQL Server Deadlocking Factors
You can view deadlocks as containing four factors:
- Lock modes and incompatibility
- Transaction ti
|
2007-05-22 09:12 P.M.
Your application can detect a deadlock and resubmit its transaction, but a better approach is to resolve a deadlock by changing the conditions that lead to it in the first place. In this article, you'll learn how SQL Server deadlocks arise, what types of deadlocks there are, and how you can resolve them.
|
2007-05-22 09:11 P.M.
Microsoft has two categories for the hints: granularity and isolation-level. Granularity hints include PAGLOCK, NOLOCK, ROWLOCK, and TABLOCK. On the other hand, isolation-level hints include HOLDLOCK, NOLOCK, READCOMMITTED, REPEATABLEREAD, and SERIALIZABLE. A maximum of one from each group may be used.
These hints allow the consultant to control the locking used by SQL Server, and they are included in the Transact-SQL statement. They are placed in the FROM portio |
|
| |