对《SQL Server中tempdb的management》的一些更正和补充
对《SQL Server中tempdb的management》的一些更正和补充 前几天看了这篇文章:SQL Server中tempdb的management 发现里面有些内容不是很准确 文章中说到: TempDB和其他用户数据库一样以Model数据库为模板创建,并且可以创建和查询表格。 与其他用户数据库不
对《SQL Server中tempdb的management》的一些更正和补充
前几天看了这篇文章:SQL Server中tempdb的management
发现里面有些内容不是很准确
文章中说到:
TempDB和其他用户数据库一样以Model数据库为模板创建,并且可以创建和查询表格。
与其他用户数据库不同的是,TempDB在每次SQL Server启动的时候都会被重新创建。
我打开SQLSERVER2005,对比了一下model数据库和tempdb数据库,发现还是有一些不同
初始大小和自动增长、跨数据库所有权链接已启用这里不讨论
跨数据库所有权链接:
页面验证里面,,model数据库页面验证用的是checksum,但是tempdb没有页面验证
tempdb不使用页面验证究竟好还是不好???
讨论这个问题之前,这里要先了解一下checksum的功能
以下摘抄自:
页面 CHECKSUM:
在数据库页面从被写入磁盘到被SQL Server读取的这段时间内,有可能由于外界原因发生损坏。
比如I/O设备的损坏,驱动的损坏或者由于电源不稳没有写完整。Checksum机制使SQL Server可以检测到这些损坏。
需要注意的是,Checksum机制只能使我们确定是不是I/O子系统引起页面损坏,但是不能自动修复它们。
作为管理员,我们可以利用这些信息来辨识出并更换损坏的I/O设备,
也可以利用重建索引或者修复损坏文件等方法修复已发生的页面损坏。
计算checksum的算法是复杂的,因为会涉及到多个页面的读写,增加CPU的负荷,可能会影响系统的吞吐量
系统吞吐量、CPU负荷这个本人觉得可以忽略不计,因为用户数据库默认都是开启了checksum页面验证的
所以本人觉得还是有必要开启checksum页面验证
页面checksum的条件:在数据库页面从被写入磁盘到被SQL Server读取的这段时间内,数据页一定要写入到磁盘,
如果数据页面没有写入到磁盘,那么开启checksum也就没有什么用处
在tempdb里,无论是数据页还是索引页还是版本存储区里的页面都有可能写入磁盘
版本存储区的资料:
版本存储区也和数据页面索引页面一样由8k大小的页组成。这些页存在缓冲池中,可以在TempDB面临内存压力时被写入磁盘
如果是这样,那么SQLSERVER应该要开启tempdb数据库的checksum页面验证才对啊
很可惜,本人暂时还没有在网上找到相关解释
不过通过下面实验,本人猜测了一些SQLSERVER团队的意图
这些实验在文章SQL Server中tempdb的management里已经给出了,本人只是做一些补充
实验
以下实验的实验环境:Windows7,SQLSERVER2005个人开发者版
全局临时表
通过创建##t_tempdblog全局临时表,插入数据,修改数据,删除数据,建立聚集索引,删除聚集索引,建立非聚集索引,删除非聚集索引
查看事务日志文件里有没有相关的操作记录
测试脚本
插入记录
1 use tempdb ##t_tempdblog ##t_tempdblog (c1 int, c2 char(1000)) () ##t_tempdblog ), 1000)) operation,context, , , fn_dblog(null, null)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Can kvr800d2n6 be used with ddr3? No. 1. Because kvr800d2n6 is a DDR2 memory module, and DDR3 is another type of memory module, the two are not compatible. 2. Although the slot shapes of DDR2 and DDR3 are the same, there are differences in voltage, timing, transmission rate, etc., so different types of memory modules cannot be interoperable. kvr800d2n6 is a memory stick of several generations. When rewriting the content, the language needs to be changed to Chinese without changing the original meaning. kvr800 When rewriting the content of the memory, the language needs to be changed to Chinese without changing the original meaning (DDR2). Memory The main frequency is 800mhz. kvr800d2n62g is Kingston KVR800

Stored procedures are sql statements that are precompiled and stored on the database server. When you need to execute a stored procedure, you only need to call the name of the stored procedure without rewriting the SQL statement. Stored procedures can improve code readability and efficiency, especially when complex or repetitive SQL statements need to be executed. 1. Create the stored procedure CREATEPROCEDUREget_customer_by_id(INcustomer_idINT)BEGINSELECT*FROMcustomersWHEREcustomer_id=customer_id;END2. Call the stored procedure $stmt=$pdo->prepare(

Visibility: A thread can only see its own modifications to shared variables, while modifications to shared variables by other threads require some kind of synchronization mechanism to be seen. Atomicity: An operation is either completely executed or not executed at all, with no intermediate state. Orderliness: Thread operations on shared variables must be performed in a certain order, even in different threads. 2. happens-before principle The happens-before principle is one of the core rules of JMM, which defines the access sequence of shared variables between threads. According to the happens-before principle, if an operation Ahappens-before another operation B, then A's modification of the shared variable will definitely occur in B

A variable declaration determines the variable name, type, and scope. Java supports primitive (int, double, boolean) and reference (String, List) types. 2. Control flow Use if/else, switch/case and loops (while, do-while, for) to control program flow. Conditional statements check conditions, and branch statements execute different blocks of code based on conditions. 3. Array Array stores a collection of elements of the same type. Arrays are declared with type [] and elements can be accessed by index. 4. Classes and Objects Classes are blueprints used to create objects with state and behavior. An object is an instance of a specific class and has access to the member methods and variables of that class. 5. Inherited subclasses inherit fields and

Which AK is the best in counter-war: AK47 is a very famous rifle that is widely used by armies and terrorist organizations around the world. It is known for its excellent performance and reliability and is regarded as one of the best assault rifles in the world. The design of AK47 is simple and practical, suitable for use in various harsh environments. It uses 7.62mm caliber ammunition, which has high range and penetration. The AK47 is cheap to manufacture and easy to maintain and operate, making it popular. Although it has some limitations in its design, it is still a very reliable and effective weapon. Whether for military operations or personal defense, the AK47 is a powerful choice. The most classic firearm in the counter war is undoubtedly the AK47. In the mall, the permanent selling price of AK47 is

Use read_csv() to read CSV files: df=pd.read_csv("data.csv") Handle missing values: Remove missing values: df=df.dropna() Fill missing values: df["column_name"].fillna( value) Convert data type: df["column_name"]=df["column_name"].astype(dtype) Sorting and grouping: Sorting: df.sort_values(by="column_name") Grouping: groupby_object=df.groupby(by= "column_name

Java's exception handling system follows a hierarchical structure, from the most general Throwable class to more specific subclasses such as Exception and Error. Understanding this hierarchy is critical because it determines how exceptions are handled and their scope. 2. Master the exception propagation mechanism. When an exception propagates in the program, it will move up the call stack. If the exception is not handled in the code, it will be propagated to the method that called it, and so on. Understanding exception propagation mechanisms is critical to ensuring exceptions are handled appropriately. 3. Use the try-catch-finally block The try-catch-finally block is the preferred mechanism for handling exceptions in Java. The try block contains the code that needs to be executed, while

1. Thread synchronization concept: Thread synchronization means that when multiple threads access shared resources, they use a certain mechanism to coordinate their access sequence and behavior to prevent data confusion and program crashes. 2. Synchronization mechanism: Java provides a variety of synchronization mechanisms, including locks, synchronization methods, synchronization blocks, atomic variables, etc. The purpose of these mechanisms is to ensure that shared resources can only be accessed by one thread at a time. 3. Lock: Lock is a common synchronization mechanism that allows one thread to have exclusive access to shared resources. When a thread acquires a lock, other threads must wait until the thread releases the lock before continuing execution. 4. Synchronized methods and synchronized blocks: Synchronized methods and synchronized blocks are implemented by adding the synchronized keyword before the method or code block.
