Make IT Complete

Technical Ramblings From an IT Professional

Entries for the ‘SQL Server’ Category

Moving a MS-SQL Database

The following example moves a database that is named mydb. This database contains one data file, Mydb.mdf, and one log file, Mydblog.ldf. If the database that you are moving has more data files or log files, specify the files in a comma-delimited list in the sp_attach_db stored procedure. The sp_detach_db procedure does not change regardless [...]

Database Maintenance Plans and Backup Exec

Assuming you have the SQL Agent installed on your media server then yes Backup Exec will / can backup your live SQL databases.
From a DR point of view you don’t need the Maintenance Plan jobs, however if you have the storage capacity available I personally would recommend keeping them, simply due to the ease in [...]

Shrinking SABA Log files

We have SABA for our learning management system and from time to time the log files get out of control.
This script will shrink them
USE Saba_prod_tp2;
GO
– Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE Saba_prod_tp2
SET RECOVERY SIMPLE;
GO
– Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (tp2_Log, 10);
GO
– Reset the database recovery [...]

Shrinking a database log file

Sometime, it looks impossible to shrink the Trucated Log file. Following code always shrinks the Trucated Log File to minimum size possible.
This script should allow you to shrink a DB log file.
USE DatabaseName
GO
            DBCC SHRINKFILE(<TransactionLogName>, 1)
    BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
            DBCC SHRINKFILE(<TransactionLogName>, 1)

Can not open Activity Monitor on MSSQL2005

I have been unable to open the Activity Monitor on MSSQL 2005.  I get a message that I do not have privialges or the connection has timed out.  The later is the case as I am an admin on the server.

Shrinking tempdb

From time to time we find that the tempdb database grows to a very large size.  This database should maintain itsself but of course things that should don’t.
Here is the method that I use to shrinl the tempdb when it has grown out of control.
dbcc shrinkdatabase (tempdb, 10)
I often find that I need to run [...]