Showing posts with label SQL Server. Show all posts
Showing posts with label SQL Server. Show all posts

Tuesday, December 22, 2020

DBCC Page and DBCC IND

The tools DBCC Page and DBCC IND are undocumented.


People smarter than me about these tools have written a ton about this. For example:

https://www.sqlskills.com/blogs/paul/inside-the-storage-engine-using-dbcc-page-and-dbcc-ind-to-find-out-if-page-splits-ever-roll-back/


General syntax:

DBCC IND (‘DBName’ or DBID, ‘TableName’ or ObjectId, NOn Clustred Index ID)

and

DBCC PAGE ( {‘dbname’ | dbid}, filenum, pagenum [, printopt={0|1|2|3} ])


So, using the Enron database, we would have something like this:

DBCC IND ('Enron', 'message', 1);

GO

DBCC TRACEON (3604);

GO

DBCC PAGE (Enron, 1, 320, 3);

GO

DBCC TRACEOFF (3604);

GO

Tuesday, October 22, 2013

How To Add Yourself To SQL

The other day, I locked myself out of my SQL Server by joining the VM to a domain. When I joined the domain, only the local users had access, because I hadn’t added the domain admins to the machine as sysadmin role members yet, since the machine wasn’t yet part of the domain.

It's a circle!

Anyway, I found myself unable to login to my SQL 2012 instance using Windows Authentication. While adding myself back, I discovered that sp_addsrvrolemember has been deprecated.
net stop <<servicename>>
net start MSSQLSERVER /m
sqlcmd –E –S.
Then, in SQL Server 2008 R2 and earlier, I would do this:

create login [DOMAIN\LOGIN] from windows;
go
exec sp_addsrvrolemember [ @loginame= ] 'domain\login' , [ @rolename = ] 'role';
go
But now, in SQL 2012, to be future proof, I have to upgrade my script to look like this:
create login [DOMAIN\LOGIN] from windows;
go
alter server role 'role' add member='domain\login';
go
One MS reference:
sp_addsrvrolemember (Transact-SQL)

Tuesday, April 16, 2013

MS SSIS Wiki

You know, it's sites like this that make me wish I had a page crawler, that would self-organize a website into an eBook automatically. That would be a rather efficient way, I think, to carry around part of the Internet's brain trust in an eReader...



http://social.technet.microsoft.com/wiki/contents/articles/776.sql-server-integration-services-ssis.aspx#SSIS_Wiki_Pages