Quantcast
Channel: James' SQL Footprint
Browsing all 25 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

"Auto update statistics" option on tempdb

"Auto update statistics" option is enabled by default on tempdb, if it is disabled, you may get trouble in some case.Today when I tested script, I found the index created on the temp table didn't work...

View Article



Image may be NSFW.
Clik here to view.

Get Perfmon data with Powershell

Sometimes you just want to have a look at the system performance, or you feel tired with log on the server, open the perfmon and configure the performance counter, perhaps you want to run a simple...

View Article

Image may be NSFW.
Clik here to view.

Compression Backup with BUFFERCOUNT parameter

If you want to make you backup faster, you can try BUFFERCOUNT parameter with compression backup.From Book Online description:BUFFERCOUNT = { buffercount | @buffercount_variable } Specifies the total...

View Article

Image may be NSFW.
Clik here to view.

Use delegated session configuration in Powershell 3.0

Powershell 3.0 has many new feature, and they are useful in some circumstance.let's say User A log in server A, and he wants to access the resource on Server B, however User A doesn't have permission...

View Article

Image may be NSFW.
Clik here to view.

Set DAC port with a specific number

Usually named instance can uses dynamic port, if firewall setup on the server, you can use SQL Server Configuration Manager to assign a specific port to SQL Server instance. However, there is no UI to...

View Article


Image may be NSFW.
Clik here to view.

Limit running Powershell script under specific path with AppLocker

Say if you have a management server or a script repository server, sometimes users save/test/run their script from different path, it is different to maintain the script version, and it is hard to...

View Article

use Table Variables in transaction

when using table variable, please note table variable doesn't support transaction rollback. here is the words from BOLBecause table variables have limited scope and are not part of the persistent...

View Article

Huge collection of Free Microsoft eBooks

I must share it, there are many useful...

View Article


SQL Server 2012 AlwaysOn Availability Groups setup scripts - Part 1

Here are some scripts which can be used for setting up 2 nodes AlwaysOn Availability Groups, you can make your own automation script based on them.Environment :NameIP...

View Article


SQL Server 2012 AlwaysOn Availability Groups setup scripts - Part 2

3. Install SQL Instance   a) Configure the firewall setting on both 2 nodes.echo Default Instancenetsh advfirewall firewall add rule name="SQLServer" dir=in action=allow protocol=TCP localport=1433...

View Article

SQL Server 2012 AlwaysOn Availability Groups setup scripts - Part 3

4. Setup 2 nodes alwayson availability group     a) Enable alwayson on both 2 nodesenable-sqlalwayson -Path "SQLSERVER:\SQL\SQL2012-01\DEFAULT"enable-sqlalwayson -Path...

View Article

trace flag for backup and restore operation

1. 3004show the internal backup/restore operation for every step.ex.dbcc traceon(3004,3605,-1)GO3605 means output the message to errorlog. you can use 3604 to direct the output to client, but it...

View Article

Image may be NSFW.
Clik here to view.

Find out orphan database file on disk

Sometimes you detach databases,  or you delete a database which is in restoring status,  the data and log file will not be removed from local disk. if you forget the files,  It might cause issues1. The...

View Article


Image may be NSFW.
Clik here to view.

Gap issue in SQL Server 2012 IDENTITY column

Found a gap issue when using IDENTITY column in SQL Server 2012, every time I restarted sql server service, the current identity number will jump to 1000. here is the repro scriptCREATE TABLE MYTEST...

View Article

Image may be NSFW.
Clik here to view.

Alwayson availability groups failover monitoring - Part 1

There are a lot of ways to monitor AG, sql server errorlog, window event log, cluster log......, here I list another way to check and monitor AG state with the log files below:1. AlwaysOn Health...

View Article


Image may be NSFW.
Clik here to view.

SQL Server 2012 Express installation failed issue

I got an strange error when installing SQL Server 2012 ExpressEnvironment:Window Server 2008 R2 Enterprise + SP1Microsoft Visual Studio 2012 installed.Net 4.5 framework InstalledWhen I double clicked...

View Article

Image may be NSFW.
Clik here to view.

Get SQL Command Compile time

1. SET STATISTICS TIME ONIt not only tell you the compile time of sql command, but also show you the execution times. when you enable it, all the sql command in the current session will be impacted, so...

View Article


List all mapping users of SQL login account

Find a useful system store procedure to list all mapping user of SQL login account.sp_msloginmappings @Loginname , @Flags@loginname: the login account name, If loginname is not specified, results are...

View Article

Image may be NSFW.
Clik here to view.

Enable Instant File Initialization to accelerate database restore

Today my colleague come to me and ask me why her database restore query was hang. She was going to restore a database with 200GB data file and 11GB log file.She had run the restore command for about 15...

View Article

Image may be NSFW.
Clik here to view.

is count(1) faster than count(*)?

Recently I saw a post regarding the count(1) and count(*)http://www.sqlservercentral.com/articles/T-SQL/102474/the post said "You know that doing COUNT(*) on a table with a lot of columns and a lot of...

View Article
Browsing all 25 articles
Browse latest View live




Latest Images