2016年5月9日 星期一

tangible T4 Editor

https://visualstudiogallery.msdn.microsoft.com/784cf592-b797-4d4d-ad33-331fcf63faad

提供開發T4時的IntelliSense、Syntax-Highlighting

2016年5月3日 星期二

DAC:專用管理員連接

https://msdn.microsoft.com/zh-tw/library/ms190468(v=sql.120).aspx
sp_configure 'remote admin connections', 1;
GO
RECONFIGURE;
GO
說明
0
表示只允許使用 DAC 的本機連接。
1
表示允許使用 DAC 的遠端連接。

https://msdn.microsoft.com/zh-tw/library/ms189595(v=sql.120).aspx
只有 SQL Server 系統管理員 (sysadmin) 角色的成員可以使用 DAC 進行連接
預設port是1434,每個 SQL Server 執行個體只能有一個 DAC連接


ref:
SQL Server Express 與 「專用管理員連接(dedicated administrator connection,DAC)」
http://sharedderrick.blogspot.tw/2008/12/sql-server-express-dedicated.html

The Dedicated Admin Connection: Why You Want It, When You Need It, and How To Tell Who’s Using It
https://www.brentozar.com/archive/2011/08/dedicated-admin-connection-why-want-when-need-how-tell-whos-using/

Another great reason to enable remote admin connections
https://mattsql.wordpress.com/2014/11/06/another-great-reason-to-enable-remote-admin-connections/

2016年4月30日 星期六

SQL Server登入localhost方式

SQL Server Management Studio(SSMS)的伺服器名稱(Server name)可以使用以下六種方式:
.   ==>dot,就是一個點啦!
localhost
(local)
127.0.0.1 (lookback IP address)  ==>需要Enable Remote Connection
local IP address (該台電腦的IP位址)  ==>需要Enable Remote Connection
ComputerName (電腦名稱)

備註:
Express、Evaluation、Developer版本SQL Server預設是停用TCP/IP的,需啟用遠端連線(Enable Remote Connection)才可以透過127.0.0.1和local IP address這種方式登入
啟用遠端連線方式參考『啟用 SQL Server 2008 遠端連線(Enable Remote Connection)

資料來源:
FAQ: How do I find the correct "server" or "data source" value for an SQL Server instance in a connection string?

2016年4月29日 星期五

ldf大小可以設定成mdf的25%

ldf大小可以設定成mdf的25%
另外可以預估資料庫mdf和ldf大約會多大,初始大小就設定(比如30 GB)
避免資料庫增長進行磁碟I/O,讓CPU使用率提高和效能降低

REF:
(1)松崗 -SQL Server 2005管理升級與移轉達人手冊-楊志強,第2-8頁
(2)SQL Backup and Recovery Joes 2 Pros (R): Techniques for Backing Up and Restoring Databases in SQL Server 第36頁
(3)Shrinking SQL Log files in an Availability Group Cluster or Database Mirror

(TSQL)找出最耗CPU執行時間的SQL查詢語法



查看SQL Server的ANSI_PADDING設定






 

如果不是太舊版的SQL Server,ANSI_PADDING預設應該都是ON的

傳回目前SQL Server連接所使用的通訊協定


net_transport =>TCP

net_transport =>Shared memory


SELECT net_transport
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;

備註:
Express、Evaluation、Developer版本SQL Server預設是停用TCP/IP的,無法使用IP位址登入

資料來源:
使用具名管道建立有效的連接字串
https://technet.microsoft.com/zh-tw/library/ms189307(v=sql.105).aspx

REF:
Choosing a Network Protocol
https://technet.microsoft.com/en-us/library/ms187892(v=sql.105).aspx