A transaction log is a storage area reserved by SQL Server to keep track of transactions made to a database. The transaction log is actually another system table, syslogs, but you should not directly query or modify it.
To expand a transaction log is to allocate additional device space to the log. If a log becomes larger than the space you have allocated for it, you can expand it.
You expand a transaction log using SQL Enterprise Manager or the ALTER DATABASE statement. This chapter describes the use of SQL Enterprise Manager. For information about using ALTER DATABASE and other statements, see the Microsoft SQL Server Transact-SQL Reference.
If you need to expand the transaction log, you must expand it on a device separate from the one on which the database resides. If the transaction log has already been placed on a separate database device from the database, you can expand the amount of space allocated to the log on that device, or you can expand it on another device. The LOGSEGMENT, which stores the logs, is automatically mapped to the new fragment of space on the database device. All database devices available within SQL Server can be used to increase log space.
If the log is not on a separate database device, you can increase the amount of space allocated to it by adding a new database device and then moving the transaction log to that database device (as described later in this topic).
The Manage Databases window appears.
The Edit Database window appears.
The Expand Database dialog box appears.
Refer to the graph at the bottom of the dialog box for a display of the devices on the server and the available space on each.
If this is a device the log already has space on, enter the amount of additional space to allocate (not the total space). The default is the maximum space available on the selected device.
The Edit Database window returns.
Note After you expand a transaction log, back up the master database.
To move a transaction log is to place it on a different device. If a transaction log was created on the same device as its database, then it must compete with data for space on the database device, and you can improve performance by moving it to another device.
Use sp_logdevice to move a transaction log to another device. Because sp_logdevice affects only future allocations of space for the transaction log, the first pages of the log remain on the same device as the data, leaving them temporarily vulnerable. The transaction log remains on the original database device until the currently allocated extent (8 2KB pages) has been filled and the transaction log has been dumped. Only the database owner can move the log. You cannot move the master database's transaction log.
The following steps show how to use sp_logdevice to move a transaction log.
sp_logdevice dbname, database_device
where
The following steps illustrate moving the entire transaction log to a new device that will contain only the transaction log.
Note that sp_logdevice affects only future allocations of space for the log. The remaining steps in this procedure must be accomplished before the log moves.
Note After you move a transaction log, back up the master database.
For more information on sp_logdevice, DBCC CHECKTABLE, DUMP TRANSACTION, and sp_helplog, see the Microsoft SQL Server Transact-SQL Reference.
When you expand a database, a new row is added to the sysusages table for each new portion of space allocated to the database. When a transaction log is expanded or moved, the sysdatabases and sysusages tables are updated to reflect the new location of the log.