Вы находитесь на странице: 1из 6

Reducing the size of 'DeviceLockDB_log.

LDF'
transaction log file
DESCRIPTION

DeviceLock database transaction log 'DeviceLockDB_log.LDF' grows too big in


a short period of time.

COMMENTS

The transaction log file stores the details of all the modifications that you
perform on your SQL Server database and the details of the transactions that
performed each modification. Because the transactional integrity is considered
a fundamental and intrinsic characteristic of SQL Server, logging the details of
the transactions cannot be turned off in SQL Server.

The SQL Server default (except local editions) leaves the databases in full
recovery mode, which means that if the regular backups of the transaction log
are not performed, the transaction log file grows to fill the disk, and you may not
be able to perform any data modification operations on the SQL Server
database.

RECOMMENDATIONS

1. You can change the recovery model from full to simple if you do not want to
use the transaction log files during a disaster recovery operation.
To stop the transaction log file (.ldf) from growing:
MS SQL Studio Manager -> Right click on the database ->Properties-> Options-
> Set model to simple--> OK.

Query:
sp_dboption [dbname], 'trunc. log on chkpt.', 'true'

2. Shrinking the transaction log file (.ldf):

BACKUP LOG db_name WITH TRUNCATE_ONLY

go

DBCC SHRINKFILE (db_log_name)

go

*Here db_log_name is the logical name of the transaction log being truncated

3. Shrinking the log file via detach/attach:


Detach the database--> delete/rename the log file--> attach the database - this
will create a minimum size log file.
*Note that the log file must be deleted/renamed otherwise it will be re-used even
though it is not specified in the attach.

Query1:
sp_detach_db [db_name]

Delete/rename the disk log file

Query2:
sp_attach_single_file_db [db_name], [filename]

Where [filename] is the name of the physical data file (.mdf).

NOTE

For more information about shrinking the transaction log files, see the following
Microsoft Knowledge Base articles:
- http://msdn.microsoft.com/en-us/library/aa174538%28SQL.80%29.aspx;
- http://support.microsoft.com/kb/873235/en-us.
Reducir el tamaño del archivo de registro de
transacciones 'DeviceLockDB_log.LDF'
DESCRIPCIÓN
El registro de transacciones de la base de datos
DeviceLock 'DeviceLockDB_log.LDF' crece
demasiado en un corto período de tiempo.
COMENTARIOS
El archivo de registro de transacciones
almacena los detalles de todas las
modificaciones que realiza en su base de datos
de SQL Server y los detalles de las
transacciones que realizaron cada
modificación. Debido a que la integridad
transaccional se considera una característica
fundamental e intrínseca de SQL Server, el
registro de los detalles de las transacciones no
se puede desactivar en SQL Server.

El valor predeterminado de SQL Server


(excepto las ediciones locales) deja las bases de
datos en modo de recuperación completa, lo
que significa que si no se realizan las copias de
seguridad regulares del registro de
transacciones, el archivo de registro de
transacciones crece para llenar el disco y es
posible que no pueda realizar cualquier
operación de modificación de datos en la base
de datos de SQL Server.
RECOMENDACIONES

1. Puede cambiar el modelo de recuperación de


completo a simple si no desea utilizar los
archivos de registro de transacciones durante
una operación de recuperación ante desastres.
Para detener el crecimiento del archivo de
registro de transacciones (.ldf):
MS SQL Studio Manager -> Haga clic derecho en
la base de datos -> Propiedades-> Opciones->
Establecer modelo en simple -> Aceptar.

Consulta:
sp_dboption [dbname], 'trunc. inicie sesión en
chkpt. ',' true '

2. Reducción del archivo de registro de


transacciones (.ldf):

REGISTRO DE COPIA DE SEGURIDAD db_name


WITH TRUNCATE_ONLY
ir

DBCC SHRINKFILE (db_log_name)

ir

* Aquí db_log_name es el nombre lógico del


registro de transacciones que se trunca

3. Reducir el archivo de registro a través de


separar / adjuntar:
Separe la base de datos -> elimine / cambie el
nombre del archivo de registro -> adjunte la
base de datos - esto creará un archivo de
registro de tamaño mínimo.
* Tenga en cuenta que el archivo de registro se
debe eliminar / renombrar; de lo contrario, se
volverá a utilizar aunque no se especifique en
el archivo adjunto.

Consulta1:
sp_detach_db [nombre_bd]

Eliminar / renombrar el archivo de registro del


disco
Consulta2:
sp_attach_single_file_db [nombre_bd], [nombre
de archivo]

Donde [nombre de archivo] es el nombre del


archivo de datos físicos (.mdf).
NOTA
Para obtener más información sobre cómo
reducir los archivos de registro de
transacciones, consulte los siguientes artículos
de Microsoft Knowledge Base:
- http://msdn.microsoft.com/en-
us/library/aa174538%28SQL.80%29.aspx;
-
http://support.microsoft.com/kb/873235/en-
us.

Вам также может понравиться