2008 archivos de registro de SQL Server tienen, tamaños mínimos de lo que da y cómo les hacen más pequeño?

dba.stackexchange https://dba.stackexchange.com/questions/364

Pregunta

Bueno, para empezar, la he cagado cuando creé las bases de datos, utilizando un script de creación más o menos así: (saltos de línea artificiales y nombres / Paths para fines de embalaje)

CREATE DATABASE [EXAMPLE] ON  PRIMARY 
( NAME = N'EXAMPLE_Data', FILENAME = N'J:\SQLServer2008\MSSQL.INSTANCE\EXAMPLE.mdf', 
    SIZE = 446046KB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%)
 LOG ON 
( NAME = N'EXAMPLE_Log', FILENAME = N'J:\SQLServer2008\MSSQL.INSTANCE\EXAMPLE.ldf', 
    SIZE = 664505KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

porque con guión hacia fuera de una base de datos de desarrollo existente, y sólo quería poner algo en marcha. Cometí un error cuando no he cambiado mis tamaños a algo razonable (como 4096KB) y por lo que ahora no puedo reducir el tamaño del archivo de registro por debajo de aproximadamente 600 MB.

Yo sé que hice mal, pero ¿cómo lo arreglo con facilidad?

¿Fue útil?

Solución

  1. Detach the database.

    sp_detach_db @dbname = 'EXAMPLE'

  2. Physically delete the log file from disk (this is crucial, but can be risky - see mrdenny's comment below).

  3. Attach the database using the sp_attach_single_file_db stored procedure.

    sp_attach_single_file_db @dbname = 'EXAMPLE', @physname = N'J:\SQLServer2008\MSSQL.INSTANCE\EXAMPLE.mdf'

Otros consejos

Hope you have enough privileges to access SSMS. If you do, follow these steps

  1. Open SSMS
  2. Connect to you SQL Server Instacne
  3. Open Object Explorer, Right click the database (which you want to shrink the log file min size) and select “Properties”
  4. From “Properties” window – select “files”
  5. You’ll see Database files grid at bottom right
  6. Click add to add new log file, give
    • logical name
    • File Type = Log
    • Initial size = 1 MB ( or your preference)
    • Cick Autogrowth and set preferences accordingly
    • FileName
  7. Now click on existing log row and select “remove”
  8. That’s it! now you have new log file with desired min size.

alt text

Licenciado bajo: CC-BY-SA con atribución
No afiliado a dba.stackexchange
scroll top