MSSQL Connect Database User to Login
The script below connects an existing user in the database to an existing server login.
USE [DATABASE]
ALTER USER DbUser WITH LOGIN = [LoginUser]
GO
The script below connects an existing user in the database to an existing server login.
USE [DATABASE]
ALTER USER DbUser WITH LOGIN = [LoginUser]
GO
You can create a loopback or iSCSI file using dd. The following example creates a file with an initial size o 0 bytes and a allocated size of 8Gb.
dd if=/dev/zero of=LUN3 bs=1000 count=0 seek=$[1000*1000*8]
Mount the file using the following command.
mount -o loop /path/to/file /path/to/mountpoint
Query for blocked sessions.
SELECT session_id, status, blocking_session_id FROM sys.dm_exec_requests WHERE blocking_session_id > 0
Close a blocking session.
KILL {blocking_session_id}
Display index physical stats.
SELECT * FROM sys.DM_DB_INDEX_PHYSICAL_STATS ( DB_ID('database_name'), Object_ID('schema.tablename'), NULL, -- Index ID NULL, -- Partition Number 'DETAILED' -- Mode: [NULL|DEFAULT|LIMITED|SAMPLED|DETAILED] )
fragmentation <10% | geen actie nodig |
fragmentation 10-30% | reorganize index (ALTER INDEX index_name ON schema.table_name REORGANIZE) |
fragmentation >30% | rebuild indexes (ALTER INDEX… REBUILD of CREATE INDEX met DROP_EXISTING optie) |
Instruction written in the Dutch language…
M.b.v. onderstaande T-SQL statements maak je een indexed view. Bij een indexed view worden de gegevens als aparte objecten opgeslagen in de database. Dit kan in bepaalde omstandigheden performance winst opleveren. Er zijn echter ook een aantal restricties. Bij een update van een record waar een dergelijke view van afhankelijk is wordt ook de view bijgewerkt. Dit kan dus ook performance verlies opleveren. SCHEMABINDING zorgt ervoor dat onderliggende tabellen niet kunnen worden aangepast zonder eerst de VIEW te verwijderen.
SET QUOTED_IDENTIFIER ON GO CREATE VIEW [dbo].[Indexed_Viewname] WITH SCHEMABINDING AS SELECT x2.column1 as [column1a], column1, x3.column2 FROM dbo.table1 x1 JOIN dbo.table2 x2 ON x1.column3 = x2.column5 JOIN dbo.table3 x3 ON x2.column4 = x3.column1 WHERE column2 = 'X'
Met onderstaande T-SQL statement maak je een clustered index.
CREATE UNIQUE CLUSTERED INDEX Cl_Idx_Viewname ON dbo.Indexed_Viewname(column1)
Instruction written in the Dutch language…
CREATE PARTITION FUNCTION pfTablename (datatype) AS RANGE LEFT FOR VALUES (Getdate() - 365)
CREATE PARTITION SCHEME pfTablename AS PARTITION pfTablename TO (Filegroup1, Filegroup2, Filegroup3)
Example to create a unique constraint on a column.
ALTER TABLE tablename ADD CONSTRAINT CK_Columnname UNIQUE (Columnname)
Domain (per domain)
Schema (per forrest)
Configuration (per forrest)
Domain DNS Zones (W2K3)
Forrest DNS Zones (W2K3)
Custum Application Directory Partition(s) (W2K3) (Enlist op DC)
INNER JOIN: Only records with joing fields in both tables.
LEFT OUTER JOIN: All records from table 1 and only matching fields from table 2 that match on join field.
RIGHT OUTER JOIN: All records from table 2 and only matchin records from table 2 that match on join field
Below an example…
SELECT DISTINCT [Database].[dbo].[Table1].[Field1] AS [Table1-Field1] ,[Database].[dbo].[Table1].[Field2] AS [Table1-Field2] ,[Database].[dbo].[Table2].[Field3] AS [Table2-Field3] FROM [Database].[dbo].[Table1] INNER JOIN [Database].[dbo].[Table2] ON [Database].[dbo].[Table2].[Field0] = [Database].[dbo].[Table1].[Field0] WHERE [Database].[dbo].[Table1].[Field1] [Database].[dbo].[Table2].[Field3] ORDER BY [Database].[dbo].[Table1].[Field1],[Database].[dbo].[Table1].[Field1];
Commands or tools to move or view Active Directory Flexible Single Master Operations roles.
Schema Master (1 per forrest)
regsvr32 schmmgmt.dll mmc -> Schema
Domain Naming Master (1 per forrest)
AD Domains and Trusts
RID Master (uitgave SID’s) (1 per domain)
AD Users and Computers
Infrastructure Master (AD infrastructuur) (1 per domain)
AD Users and Computers
PDC Emulator (Time Server, log-on NT4 clients, Password chenges) (1 per domain)
AD Users and Computers