You are currently browsing the Blog weblog archives for January, 2009.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Dec | Feb » | |||||
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
- IIS (1)
- Open Source (1)
- Performance (3)
- Personal (2)
- Powershell (1)
- SQL (1)
- SQL Server (20)
- T-SQL (14)
- Uncategorized (6)
- Utilities (4)
- Windows OS (13)
- 23. August 2010: Alert for long-running SQL datbase backups
- 7. April 2010: Learning SMO & Powershell
- 25. February 2010: SQL Generators for moving database files
- 28. January 2010: Index to Filegroup mapping
- 20. January 2010: PowerShell Script to Clean Up Old Files Based on Age
- 7. January 2010: Quick & Dirty way to identify orphan files
- 29. July 2009: Trigger Mass Enable / Disable
- 29. June 2009: Moving Master and Resource databases
- 11. June 2009: Quick and Dirty CSV import to SQL Server
- 2. February 2009: Getting data file space usage
Archive for January 2009
Useful Multipliers
28. January 2009 by Bennett.
Multiply SQL database pages by 0.0078125 to get space in Megabytes
Multiply SQL database pages by 0.00000762939453125 to get space in Gigabytes
Here are a couple of examples of where this is useful:
This query uses a DMV to return TempDB utilization by object category such as user, internal, and version store:
SELECT
SUM(user_object_reserved_page_count)*0.0078125 as usr_obj_mb,
SUM(internal_object_reserved_page_count)*0.0078125 as internal_obj_mb,
SUM(version_store_reserved_page_count)*0.0078125 as version_store_mb,
SUM (unallocated_extent_page_count)*0.0078125 as freespace_mb,
SUM (mixed_extent_page_count)*0.0078125 as mixedextent_mb
FROM sys.dm_db_file_space_usage
The next query returns space utilization , in Megabytes, by filegroup:
select name, filename, cast(size * 0.0078125 as int)as size_mb
from sysfiles
ORDER BY FILENAME
compute sum(cast(size * 0.0078125 as int))
Posted in T-SQL, SQL Server | Print | No Comments »
One-off backups in SQL Server 2005
7. January 2009 by Bennett.
I am frequently asked to refresh development databases with production data. The usual way to do this is to back up the production database and then restore over the development database. SQL Server 2005 has a new backup option, “WITH COPY_ONLY”. This option allows you to perform a full backup without truncating the log and breaking the log chain. The COPY_ONLY option is not supported in the SQL Server Management Studio (SSMS) GUI, so you have to perform the backup via a script.
It’s important to note that a backup that is created with the COPY_ONLY option cannot be restored with the SSMS GUI. Instead you have to restore via a script.
SQL Server 2008 supports the COPY_ONLY option in the SSMS GUI.
Posted in SQL Server | Print | 1 Comment »