Backup SQL Server database accross more than one file

–====================================================
–=        BACKUP database accross four files
–====================================================
declare @filedate nvarchar(100)
declare @disk1 nvarchar(100)
declare @disk2 nvarchar(100)
declare @disk3 nvarchar(100)
declare @disk4 nvarchar(100)
declare @dbname nvarchar(100)
declare @backupname nvarchar(100)
declare @backupfolder nvarchar(100)
set @dbname = ‘DBA’
set @backupfolder = ‘F:\SQLBackup\’ + @dbname + ‘\’
select @filedate = replace(replace(replace(replace(convert(nvarchar,getdate(),121),’-’,’_’),’ ‘,’_’),’:’,”),’.’,’_’)
select @backupname = @dbname + ‘_backup’ + @filedate
print @filedate
print @backupname
–select @filedate
select @disk1 = @backupfolder + @dbname + ‘_backup_File1_’ + [...]

How to create a corrupt database using BULK INSERT/ UPDATE and BCP - SQL Server as a HEX editor.

http://sqlblogcasts.com/blogs/tonyrogerson/archive/2007/03/10/how-to-create-a-corrupt-database-using-bulk-insert-update-and-bcp-sql-server-as-a-hex-editor.aspx

SQL Free Tools

http://www.spiceworks.com/free-sql-server-monitoring-tool/

How to find all the FILESTREAM directory names - for both levels of directory

You have to run this query through the DAC as it’s accessing undocumented, hidden system tables.
How to: Use the Dedicated Administrator Connection with SQL Server Management Studio
Microsoft SQL Server provides a dedicated administrator connection (DAC). The DAC allows an administrator to access a running instance of SQL Server Database Engine to troubleshoot problems on [...]

Using a Dedicated Administrator Connection

SQL Server provides a special diagnostic connection for administrators when standard connections to the server are not possible. This diagnostic connection allows an administrator to access SQL Server to execute diagnostic queries and troubleshoot problems even when SQL Server is not responding to standard connection requests.
By default, the connection is only allowed from a client [...]

Starting SQL Server

From Command prompt:
Start an instance of SQL Server or the SQL Server Agent service from a command prompt by typing:
net start mssqlserver or sqlservr, or net start SQLServerAgent or by running SQLSERVR.EXE. If you are referring to a named instance of SQL Server, you must specify mssql$instancename or SQLAgent$instancename.

SQL Server TRANSACTION ISOLATION LEVEL

TRANSACTION ISOLATION LEVEL
READ UNCOMMITTED
- can read rows that have been modified by other transactions but not yet committed
- do not issue shared locks to prevent other transactions from modifying data read by the current transaction.
READ COMMITTED
- cannot read data that has been modified but not committed by other transactions. This prevents dirty reads.
- phantom data [...]

Performance Counters

SQL Server 2005 Database Engine Performance Counters

SQLServer:Access Methods
SQLServer:Buffer Manager
SQLServer:Buffer Node
SQLServer:Buffer Partition

AU cleanup batches/sec                          
AWE lookup maps/sec                       
Database pages                                         
Free list empty/sec                               

AU cleanups/sec                                      
AWE stolen maps/sec                        
Foreign pages                                             
Free list requests/sec                          

By-reference [...]

sp_send_dbmail - database mail

EXEC msdb.dbo.sp_send_dbmail
@recipients = ‘me@myemail.com’,
@query = ’sp_configure ”max server memory”
GO
sp_configure ”min server memory”
GO
select left(counter_name,50),cntr_value from sys.dm_os_performance_counters
where counter_name in (”Target Server Memory (KB)”,”Total Server Memory (KB)”)
and object_name = ”SQLServer:Memory Manager”’,
@subject = ‘DEMO - MEMORY UPGRADE’,
@attach_query_result_as_file = 1 ;

FIND LAST CLEAN DBCC CHECKDB RAN DATE

–====================================================
–==    FIND LAST CLEAN DBCC CHECKDB RAN DATE        ==
–====================================================
CREATE TABLE #temp (
Id INT IDENTITY(1,1),
ParentObject VARCHAR(255),
[Object] VARCHAR(255),
Field VARCHAR(255),
[Value] VARCHAR(255)
)
INSERT INTO #temp
EXECUTE SP_MSFOREACHDB’DBCC DBINFO ( ”?”) WITH TABLERESULTS’;
;WITH CHECKDB1 AS
(
SELECT [Value],ROW_NUMBER() OVER (ORDER BY ID) AS rn1 FROM #temp WHERE Field IN (’dbi_dbname’))
,CHECKDB2 AS ( SELECT [Value], ROW_NUMBER() OVER (ORDER BY ID) AS rn2 FROM #temp [...]