|
|
2012年2月3日
摘要: 原文:http://blogs.msdn.com/b/apgcdsd/archive/2011/12/30/10251946.aspx截取一段,备查日志文件如何影响我数据库的启动?无论你的SQL Server启动,或者你将某数据库重备份中恢复,或者其他的一些情况,总之在你的数据库能够被正常使用之前,你的数据库都会进入 Recovery的状态。http://msdn.microsoft.com/en-us/library/ms190442.aspx 如果这一个步失败,那么你的数据库就会进入Suspect状态而无法正常使用。在一些特殊情况下,这个Recovery所花费的时间会很长。在数据库进入On 阅读全文
2012年2月1日
摘要: 原文:http://blogs.msdn.com/b/askjay/archive/2010/02/05/how-can-i-create-a-dump-of-sql-server.aspxYou can create a memory dump of the SQL Server process space in several ways. There are many external tools that can help you accomplish this such as userdump.exe, debugdiag.exe, and ADPlus.exe. In this po 阅读全文
2011年12月1日
摘要: 考虑这样的场景,现在每天要同步更新的数据,为了记录哪些数据发生过变更,需要对表添加一个rowversion列来标识被更新过。恰好这个表比较大,而且有发布订阅。由于该字段对于订阅表来讲,无实际意义,而且添加一个有默认值的不可为空的8字节字段,会产生数据空间分配,或许带来大量的页拆分,对IO压力会加大,所以考虑将此表的发布项暂时改为不支持架构复制,等添加完该字段后,再将其改为支持架构复制。下面来做这个测试:1.下面是一个正常的事务发布,将DB_1中的T_1发布到DB_2的T_1表中。2.修改发布项DBrepTEST关于架构复制的选项,设置为不支持DECLARE @publication AS sy 阅读全文
2011年11月28日
摘要: 【介绍】SQL Server 通过WORKER, SCHEDULER, TASK等来对任务进行调度和处理。了解这些概念,对于了解SQL Server 内部是如何工作,是非常有帮助的。通常来讲,SCHEDULER个数是跟CPU个数相匹配的 。除了几个系统的SCHEDULER以外,每一个SCHEDULER都映射到一个CPU,如下面的查询结果所示,我们有四个CPU,也就有相应四个SCHEDULER。而WORKER (又称为WORKER THREAD), 则是工作线程。在一台服务器上,我们可以有多个工作线程。因为每一个工作线程要耗费资源,所以,SQL Server有一个最大工作线程数。一个TASK进来 阅读全文
2011年11月25日
摘要: 首先看下面这段代码,可以看出:blocked-process是被阻塞的进程,执行的sql是select * from temp1blocking-process是正在产生阻塞的进程,执行的sql是select * from temp1 with(nolock)如果你偶尔抓到了这样的report,肯定会奇怪吧,为什么呢?理论下面的sql不会对上面的sql产生阻塞。<blocked-process-report> <blocked-process> <process id="process3d92550" taskpriority="0& 阅读全文
2011年11月22日
摘要: 原文:http://sqlserverpedia.com/wiki/SAN_Performance_Tuning_with_SQLIODownloading and Configuring SQLIO[Download SQLIO from Microsoft]Notice that I said SQLIO, not SQLIOSIM. Experienced database administrators will often direct you to SQLIOSIM because it's easier to use and mimics SQL Server's 阅读全文
2011年11月15日
摘要: Well, this is often a tricky situation, where you are running into Virtual Address Fragmentation and getting OOM (out-of-memory)errors in your SQL Server. More often than not there is confusion between physical memory pressure vs. virtual memory pressure. Adding more RAM is definitely not a solution 阅读全文
2011年11月3日
摘要: http://blogs.msdn.com/b/distributedservices/archive/2008/11/12/troubleshooting-msdtc-issues-with-the-dtcping-tool.aspxEvery day the Distributed Services support team in Microsoft helps customers in troubleshooting some of the most common Distributed Transaction errors which are a direct result of MS 阅读全文
摘要: 订阅库中有很多的死锁现象,MSreplication_subscriptions表中有8条记录,死锁大概是1小时40个,如下所示:deadlock-listdeadlock victim=processdbf1c8 process-list process id=processdbf1c8 taskpriority=0 logused=2116 waitresource=PAGE: 6:1:3304140 waittime=577 ownerId=1250752686 transactionname=user_transaction lasttranstarted=2011-11-03T09: 阅读全文
2011年10月27日
摘要: 原文http://www.cnblogs.com/awpatp/archive/2010/01/26/1656651.htmlTask Manager跟Performance Monitor的区别(Working set和Private bytes)windows server 2003 :在Performance monitor中可以通过private bytes和Virtual bytes来衡量程序的内存使用. 在task manager中, 也有Memory Usage和VM Size两项. 但是仔细比较后会发现Memory Usage并不是对应private bytes, VM Siz 阅读全文
摘要: 最近遇到一个问题,示例表结构如下:set statistics io onuse tempdb go--drop table TBcreate table TB (id int identity primary key, parentId int,name varchar(50))goinsert into TB(parentId,name) select 0,CAST(NEWID() as varchar(50))go 499990insert into TB(parentId,name) select 499990,CAST(NEWID() as varchar(50))insert in 阅读全文
2011年10月9日
摘要: SQL Server 2008 Service Pack 3http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27594Microsoft SQL Server 2008 SP3 Express Editionhttp://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27597Microsoft SQL Server 2008 Service Pack 3 Feature Packhttp://www.microso 阅读全文
2011年9月27日
摘要: 存在即更新,反之插入的需求是很常见的,很多人没有注意并发的问题,高并发下为了避免唯一键冲突和死锁情况,下面提供三种写法,最后一个是sql server 2008及以后版本适用。示例表为:usetempdbgocreatetabletb_1(idintidentityprimarykey,avarchar(50),dtdatetimedefaultgetdate())go写法一:begintranifexists(select*fromtb_1with(updlock,serializable)whereid=100)beginupdatetb_1seta='a100'where 阅读全文
2011年9月26日
摘要: 最近遇到一个update时产生死锁的情况,两条一模一样的sql同时执行时,居然会产生Deadlock。windows 2003 server x64 + sql server 2008 sp2 Enterprise X64 示例(实际环境与该表相似):当两个进程同时执行下面的语句时,在高并发下会产生死锁:updatettwith(rowlock)setc='eb',d='cc'wherea='84B23855-2155-4EE0-911D-38D1265F1655'示例表结构:usetempdbgocreatetablett(idintident 阅读全文
2011年8月31日
摘要: 每天win7的Windows Search服务一开启,outlook就半天无响应,干脆关了这个服务作两个批处理,一个是开启,一个是关闭1.在windows开机脚本里,添加开启的批处理,这样一开机就关闭此服务2.设置windows计划任务,12:00启用,13:00开关,中午这段时间Windows Search建索引。 rem停止win7的WindowsSearch服务netstopwsearchscconfig"wsearch"start=disabled rem开启win7的WindowsSearch服务scconfig"wsearch"start=a 阅读全文
2011年7月28日
摘要: 参考:http://www.mssqltips.com/tip.asp?tip=2444 取硬盘大小及可用空间declare@svrNamevarchar(255)declare@sqlvarchar(400)--bydefaultitwilltakethecurrentservername,wecanthesettheservernameaswellset@svrName=casecharindex('\',@@servername)when0then@@servernameelseleft(@@servername,charindex('\',@@serve 阅读全文
2011年6月16日
摘要: EXEC sp_resetstatus 'DBname';ALTER DATABASE DBname SET EMERGENCYDBCC checkdb('DBname')ALTER DATABASE DBname SET SINGLE_USER WITH ROLLBACK IMMEDIATEDBCC CheckDB ('DBname', REPAIR_ALLOW_DATA_LOSS)ALTER DATABASE DBname SET MULTI_USER参考:http://www.codeproject.com/KB/reporting-ser 阅读全文
2011年6月14日
摘要: 4G 内存 32bit win2k3+sql2k8 sp1运行一段时间后,在添加字段或修改字段长度时:Failed to initialize the Common Language Runtime (CLR) v2.0.50727 with HRESULT 0x80004005. You need to restart SQL Server to use CLR integration features.重启SQL Server后,error有:AppDomain 2 (mssqlsystemresource.dbo[runtime].1) created.AppDomain 3 (mss. 阅读全文
2011年6月10日
摘要: How to add an article to an existing Transactional Subscription initialized through backup添加新表:1.将要发布的新表添加至已存在发布项,之后再将其删除,这样操作,可以避免考虑not for replication问题2.在发布库生成该表的create脚本,到订阅库去执行来生成该表3.停止 logreader job.4.使用ssis等方法将该表数据从发布库导入订阅库,注意,确保该表在导数据期间和在添加到发布项之前,不能再有改变,否则需要再用tablediff来追数据5.将该表使用界面或脚本添加至已存在的 阅读全文
2011年6月9日
摘要: 初始化订阅: 1.使用界面在发布服务器上建立发布项,勾选“立即创建快照并使快照保持可用状态,以初始化订阅”。 即: @immediate_sync = N'true'2.使用界面修改发布项的"允许从备份文件初始化"为true. 即:@allow_initialize_from_backup = N'true'3.为前发布数据库全一个全备,一个事务log备份'd:\DBBak\repl.trn'4.在订阅服务器用发布库全备还原出一个订阅库,状态norecovery,之后再还原发布的log备份,状态recovery5.使用脚本命令 阅读全文
2011年6月1日
摘要: 最近在用SSIS导数据时遇到RESOURCE_SEMAPHORE等待,之后挂起。源服务器4G内存,SQL Server 2005 sp3 企业版,8核目标服务器10台,配置同上现在要在10台服务器上执行SSIS来抽取源服务器数据,数据量小时未发现异常,抽的数据量大时,出现RESOURCE_SEMAPHORE等待,然后SSIS进程挂起,导数据停滞,经查msdn,如下:http://msdn.microsoft.com/zh-cn/library/ms179984.aspxRESOURCE_SEMAPHORE当由于存在其他并发查询而无法立即批准查询内存请求时出现。等待时间较长或等待次数较多可能指示 阅读全文
2011年2月17日
摘要: 我的版本是0.8.7d,这个问题已经好久没有找到办法解决,最近将cacti从0.8.7d升级为0.8.7e,但还是报插入重复键错误最后仔细找了下原因,终于解决了: SPINE: Poller[0] ERROR: SQL Failed! Error:'1062', Message:'Duplicate entry '68-cpu-2011-02-16 18:00:03' for key 1'如图: 由于之前安装的是cacti 0.8.7d for windows版本,不知道是版本本身的bug还是配置的问题,一直出现已添加的host主机不能删除的情况,后来索性就手工到mysql内删除,但由于对ca 阅读全文
2010年12月22日
摘要: http://connect.microsoft.com/SQLServer/feedback/details/334180/data-collector-remove-data-collector-to-remove-associated-objectsAfter the data collector is configured, the data collector can be disabled but not removed. This means that all objects created by the data collector will remain on the in 阅读全文
2010年11月26日
摘要: FIX: "There is insufficient system memory in resource pool 'internal' to run this query" error message when you run a full-text query that uses compound words in Microsoft SQL Server 2008 or in Micros... 阅读全文
2010年11月25日
摘要: 11度春春系列电影:《老男孩》[hjp2=600,460,true]http://player.youku.com/player.php/sid/XMjE4MDU1MDE2/v.swf [/hjp2]是否让你想起了太多的往事?是否有很多的感慨呢? 那是我日夜思念深深爱着的人呐到底我该如何表达她会接受我吗?也许永远都不会跟她说出那句话注定我要浪迹天涯怎么能有牵挂梦想总是遥不可及是不是应该放弃花开花落... 阅读全文
2010年11月24日
摘要: IntroductionEver wondered which program has a particular file or directory open? Now you can find out. Process Explorer shows you information about which handles and DLLs processes have opened or load... 阅读全文
2010年7月1日
摘要: 原址:http://blog.csdn.net/Garnett_KG/archive/2010/05/22/5615865.aspx 阅读全文
2010年6月1日
摘要: SQL Server 2008 R2 Pricing原文:http://www.microsoft.com/sqlserver/2008/en/us/pricing.aspxMicrosoft SQL Server licensing provides the option to purchase SQL Server 2008 R2 under a Server/CAL licensing mo... 阅读全文
2010年5月28日
摘要: 很久没写blog,不是懒,实在是最近我这的访问速度不好,用firefox经常上传不了图片 .......今天无意发现了SQL Server 2008 Datetime Cast 成 Date 类型可以使用索引,分享一下:测试环境:[代码]由上面的T-sql可以看出,如果我们查 2010年5月27的数据,应该只有一条。为了更明显说明以下四种写法的区别,打开IO/执行计划开关,并且选中执行结果包含实际... 阅读全文
2010年4月29日
摘要: 以下仅为参照,如果有多个实例,可能会有些许不同:本环境是SQLServer2005StandardVersion64-bit 和 SQLServer2008 StandardVersion64-bit 双实例同时安装在一个WindowsServer2008StandardVersion64-bit OS上:代码Code highlighting produced by Actipro CodeHi... 阅读全文
2010年4月16日
摘要: Database Mirroring Log Compression in SQL Server 2008 Improves Throughput Author: Sanjay Mishra Reviewers: Peter Byrne, Don Vilen, Kaloian Manassiev, Burzin Patel, Eric Jacobsen Overview Da... 阅读全文
摘要: 原文:http://www.karaszi.com/SQLServer/info_dont_shrink.asp Overview If you want the really reallyshort story, then check out this analogy - hopefully you come back here and read the full story. Introd... 阅读全文
2010年4月14日
摘要: Following statement can reset seed[代码]but can't reset increment.how change the identity increment of column?I can't find the simple method,now I use Following sql script to change it.[代码]please tell m... 阅读全文
2010年3月30日
摘要: 查找未使用的非聚集索引和未使用的表.DMV:sys.dm_db_index_usage_statsThe counters are initialized to empty whenever the SQL Server (MSSQLSERVER) service is started. In addition, whenever a database is detached or is shut... 阅读全文
2010年3月29日
摘要: 原文:http://blogs.msdn.com/suhde/archive/2009/05/20/lock-pages-in-memory-now-available-for-standard-edition-of-sql-server.aspxDue to over-whelming customer demand for the "Lock pages in memory" support... 阅读全文
2010年3月25日
摘要: Index related DMVs and DMFs - sys.dm_db_index_usage_stats By : Dinesh Priyankara Oct 09, 2007 Examining statistics of indexes is usefulforoptimizingthe performance of queries. Statistics help us d... 阅读全文
2010年3月24日
摘要: How to recreate the msdb database in SQL Server 2005? I've just spenta bunchtime researching an answer tothis question on the new disaster recovery forumbecause I couldn't find any definitive ... 阅读全文
2010年3月13日
摘要: By Mike Garcen (ShadyMG) | Published Wednesday, 22 July 2009 In honor of Windows7 hitting the big RTM (release to manufacturing) milestone, I figured it best to start fresh with this Guide and archive... 阅读全文
2010年3月12日
摘要: Determining the appropriate memory configuration for a SQL Server platform is a task that all database administrators are required to perform. It is essential to ensuring that an appropriate level o... 阅读全文
2010年3月3日
摘要: An update for Standard SKU Support for Locked Pages…. Note this article has been updated to include an update for SQL Server 2005 I posted in April that we would be releasing cumulative update... 阅读全文
|