|
|
-
|
|
Even though I'd prefer to Backup a database and then move, often a third party supplier
will need it as a MDF or LDF, which they then will have a script to reattach.
The main steps are:
Detach DB
Move to designated path
ReAttach DB
2 input parameters: Name of DB on SAN, targeted path
The......
|
|
-
|
|
There was a requirement to allow non -technical users, to manage archiving
their databases on a SQL Server 2005 platform. They wanted to have the capacity to move the databases from a SAN drive
to SATA drive, but they continued to have a problem regarding space on the destination drive. In oth......
|
|
-
|
|
I'm working on a whole bunch of moving SQL Server 2005 around. I'm backing up and restoring from
ServerA to ServerB.
A script I've found useful (courtesy of sqlservercentral.com). This will synchronise the Database Users with the
SQL Server Logins, which tend to become orphaned.
------------......
|
|
-
|
|
I'm investigating how to set up a monthly report and return all users on a given SQL Server to a spreadsheet.
I will then forward this spreadsheet to all the application owners, who need to "sign off" the users.
It's like a monthly housekeeping exercise.
The script below (SQL Server 2005), ident......
|
|
-
|
|
Sometimes I just need to backup all the dbs in a situation of moving the databases to another server.
The script below is both 2000 and 2005 compatible.
You might want to consider adding the COPY keyword if you are using the script in 2005.
This will deal with the problem of adhoc backups brea......
|
|
-
|
|
Below is a typical set of commands to do a full text rebuild. Quite often, in an emergency you might need to do a MS Search Services restart. If the server is being hit by other resources, consider doing a incremental build
USE
GO
EXEC sp_fulltext_catalog '', 'rebuild'
GO
EXEC sp_fulltext_ca......
|
|
-
|
|
Use this to track indexes retrievable but not used.
select object_id, index_id, user_seeks, user_scans, user_lookups
from sys.dm_db_index_usage_stats
order by object_id, index_id
---All indexes which haven’t been used yet can be retrieved with the following statement:
select object_na......
|
|
-
|
|
An excellent script to deal with XML documents that are greater than 8000 characters
Use it like:
DECLARE @hDoc int
EXEC usp_OpenXML_From_File 'c:\myXMLfile.xml', @hDoc OUTPUT
SELECT *
FROM OPENXML(@hDOC, '/rss/channel/item',2)
WITH
(
title varchar(200),
link varchar(400),
descripti......
|
|
-
|
|
Returns records form the error log based on search terms
DECLARE @SERVER NVARCHAR(50)
SET @SERVER = 'SERVER1\INSTANCE'
DECLARE @sqlStatement1 VARCHAR(200)
SET @sqlStatement1 = @SERVER + '.master.dbo.xp_readerrorlog'
CREATE TABLE #Errors (vchMessage varchar(2000), ID int)
--CREATE INDEX idx_m......
|
|
-
|
|
SQL Server database and file size is returned in this script, compared to total
and free disk space. It also displays the number of Kb that each
database file will grow by on the next extend.
/******************************************************************
*
* SQL Server Disk Space Check
......
|
|