SQLServer 镜像证书更换经验总结(证书过期替换)

摘要: 之前有写过一篇:SQL Server 镜像证书过期处理 这是之前为替换证书做的测试准备,介绍了如何替换过期的镜像证书。而这篇文章则是对昨天的工作中进行了大量服务器的证书替换的时候碰到了一些问题,这里进行分析和总结。下面是在生产中操作的使用脚本:--脚本1select name, expiry_date from sys.certificates where issuer_name not like 'MS_%'godeclare @sql varchar(max)set @sql = ''select top 1 @sql = @sql + 'use m 阅读全文
posted @ 2012-02-23 11:44 trams 阅读(1100) 评论(0) 推荐(0) 编辑

SET XACT_ABORT的功能演示

摘要: SET XACT_ABORT的SQL语句执行情况演示:CREATE TABLE student( stuid int NOT NULL PRIMARY KEY, stuname varchar(50))CREATE TABLE score ( stuid int NOT NULL REFERENCES student(stuid), score int)GOINSERT INTO student VALUES (1,'a') INSERT INTO student VALUES (2,'b') INSERT INTO studen... 阅读全文
posted @ 2012-02-01 15:29 trams 阅读(291) 评论(0) 推荐(0) 编辑

SQL Server 镜像证书过期处理

摘要: 今天镜像中的主服务器进行维护重启,重启后发现镜像Disconnect,使用xp_readerrorlog 0, 1检查错误日志发现下列信息:Database mirroring connection error 5 'Connection handshake failed. The certificate used by this endpoint was not found: Certificate expired. Use DBCC CHECKDB in master database to verify the metadata integrity of the endpoint 阅读全文
posted @ 2012-01-13 14:59 trams 阅读(1092) 评论(0) 推荐(0) 编辑

SSD优化策略

摘要: 1、损耗平衡算法 为了避免同一Cell被高频率的擦写,SSD会将某段LBA地址的写写到Free space中,这些Free Space可以直接进行写入,并将之前的LBA占用的Page标记为“Garbage”,可回收再利用。等一个Block的大部分(一定比例)的Page标记为“Garbage”时,并且存在大批满足条件的Block,SSD会批量回收这些Block,即执行Copy on Write,将有数据的Page写到新的Block中并Erase待回收的Block。这样是为了将写操作平衡到所有可能的Block中,降低单位时间内Block的擦写次数。 重定向写解决了Wear Off过快的问题,并.. 阅读全文
posted @ 2012-01-11 09:10 trams 阅读(1598) 评论(0) 推荐(0) 编辑

python抛出所有异常信息

摘要: 有时候为了调试方便需要格式化所有的异常信息,方式如下except Exception as e: for artt in dir(e): rmsg = rmsg + artt + ':' + str(getattr(e, artt)) + '\r\n' 阅读全文
posted @ 2012-01-10 18:21 trams 阅读(1755) 评论(0) 推荐(0) 编辑

update statistics伪造统计信息

摘要: 当我们想要分析某些语句在一定数据量后的执行计划情况是可能会进行数据的模拟,伪造大量的数据。但其实这个工作挺费劲了,经朋友介绍在网上看到下面这种伪造统计信息的方式,对于如果只是分析执行计划的情况很方便。use tempdbgocreate table t1(i int, j int)gocreate table t2(h int, k int)goset statistics profile ongoselect distinct(i) from t1goselect * from t1, t2 where i = k order by j + kgoupdate statistics t1 w 阅读全文
posted @ 2012-01-10 11:06 trams 阅读(271) 评论(0) 推荐(0) 编辑

sp_rename修改对象名称

摘要: create table test(username varchar(10), userinfo varchar(200), primary key (username) ) go --修改字段名 exec sp_rename 'test.userinfo', 'userdesc', 'column'; go sp_help test go --修改表名 exec sp_rename 'test', 'test1', 'object'; go sp_help test1 go --sp_rename 阅读全文
posted @ 2012-01-10 11:04 trams 阅读(494) 评论(0) 推荐(0) 编辑

Raid学习笔记

摘要: Raid0结构: (图1) (图2) (图3) 图1和图2为Raid0的原理图,重点看图2。这里展示的4块硬盘的Raid0结构。对于系统看到的是virtual disk,这是按条带组成的一块连续的存储盘。而对于Raid卡则将virtual Disk根据stripe size将其分散在4块硬盘中,结构如图1和图3。stripe size也叫segment,一个stri... 阅读全文
posted @ 2012-01-09 18:32 trams 阅读(470) 评论(0) 推荐(0) 编辑

SQL Server数据库专用管理员DAC连接方式

摘要: 转:http://www.cnblogs.com/kerrycode/archive/2010/09/18/1830071.htmlSQL Server提供了专用管理员链接(DAC)。DAC允许管理员访问运行的服务器以执行诊断函数或Transact—SQL语句,或对服务器上的问题进行故障排除,即使服务器以锁定或在非正常状态下运行。DAC默认情况下只有服务器上可以使用DAC,但是你可以通过SQL Server 2005外围应用配置器设置允许远程计算机上的客户端应用程序使用DAC,如下图所示你也可以通过下面的SP_CONFIGURE命令更改数据库服务器配置--0-指明仅允许本地连接使用DAC--1 阅读全文
posted @ 2012-01-06 18:26 trams 阅读(529) 评论(0) 推荐(0) 编辑

MySQL-python连接socket问题

摘要: Python中使用MySQLdb连接数据库时出现以下错误:Traceback (most recent call last): File "/home/monitor_user/serverMonitor.py", line 206, in <module> ServerList = sqlQuery(getMngConn(), "select b.db_name, a.ip_inside, a.port from machine a inner join dbinfo b on b.machine_id = a.machine_id") F 阅读全文
posted @ 2012-01-04 11:24 trams 阅读(4487) 评论(0) 推荐(0) 编辑