EXEC sp_spaceused 'TBL_MART_ENCOUNTER'
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"
--The following example demonstrates this with the pubs database and attempts to shrink the pubs_log file to 2 MB:
DBCC SHRINKFILE(pubs_log, 2)
--NOTE: If the target size is not reached, proceed to the next step.
--Run this code if you want to truncate the transaction log and not
--keep a backup of the transaction log. Truncate_only invalidates your
--transaction log backup sequence. Take a full backup of your database
--after you perform backup log with truncate_only:
BACKUP LOG pubs WITH TRUNCATE_ONLY
--or-
--Run this code if you want to keep a backup of your transaction log and
--keep your transaction log backup sequence intact. See SQL Server Books
--Online topic "BACKUP" for more information:
BACKUP LOG pubs TO pubslogbackup
--Run this code:
DBCC SHRINKFILE(pubs_log,2)
--Depending on your recovery model, you might be able to simply run this command to manually truncate the log:
BACKUP LOG
BACKUP LOG TestDB TO DISK='C:\TestDB1.bak'
--Shrink the transaction log file. To do this, run a Transact-SQL statement
--that is similar to the following Transact-SQL statement.
DBCC SHRINKFILE (
--Since the "shrink database" command within SQL 2000 Enterprise
--Manager doesn't always seem to do what you'd expect, here is the command to run in Query --Analyzer.
backup log db_name_here with truncate_onlydbcc shrinkfile(db_log_filename_here,truncateonly)
http://andieko.web.id/sql-server-2000/shrink-transaction-log-on-sql-server-2000-part-1/
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.