Export (0) Print
Expand All
Expand Minimize

sp_add_log_file_recover_suspect_db

SQL Server 2000

Adds a log file to a filegroup when recovery cannot complete on a database due to an "insufficient log space" (9002) error. After the file is added, this stored procedure turns off the suspect setting and completes the recovery of the database. The parameters are the same as those for ALTER DATABASE ADD LOG FILE.

Important  This stored procedure should be used only as described in the Troubleshooting Recovery section.

Syntax

sp_add_log_file_recover_suspect_db [ @dbName = ] 'database' ,
    [ @name = ] 'logical_file_name' ,
    [ @filename = ] 'os_file_name' ,
    [ @size = ] 'size' ,
    [ @maxsize = ] 'max_size' ,
    [ @filegrowth = ] 'growth_increment'

Arguments

[@dbName =] 'database'

Is the name of the database. database is sysname, with no default.

[@name =] 'logical_file_name'

Is the name used in Microsoft® SQL Server™ when referencing the file. The name must be unique in the server. logical_file_name is nvarchar(260), with no default.

[@filename =] 'os_file_name'

Is the path and file name used by the operating system for the file. The file must reside in the server in which SQL Server is installed. os_file_name is nvarchar(260), with no default.

[@size =] 'size'

Is the initial size of the file. The MB and KB suffixes can be used to specify megabytes or kilobytes. The default is MB. Specify a whole number; do not include a decimal. The minimum value for size is 512 KB, and the default if size is not specified is 1 MB. size is nvarchar(20), with a default of  NULL.

[@maxsize =] 'max_size'

Is the maximum size to which the file can grow. The MB and KB suffixes can be used to specify megabytes or kilobytes. The default is MB. Specify a whole number; do not include a decimal. If max_size is not specified, the file will grow until the disk is full. The Microsoft Windows NT® application log warns an administrator when a disk is about to become full. max_size is nvarchar(20), with a default of NULL.

[@filegrowth =] 'growth_increment'

Is the amount of space added to the file each time new space is needed. A value of 0 indicates no growth. The value can be specified in MB, KB, or percent (%). Specify a whole number; do not include a decimal. When % is specified, the growth increment is the specified percentage of the size of the file at the time the increment occurs. If a number is specified without an MB, KB, or % suffix, the default is MB. The default value if growth_increment is not specified is 10%, and the minimum value is 64 KB. The size specified is rounded to the nearest 64 KB. growth_increment is nvarchar(20), with a default of NULL.

Return Code Values

0 (success) or 1 (failure)

Result Sets

None

Permissions

Execute permissions default to members of the sysadmin fixed server role. These permissions are not transferable.

Examples

In this example database db1 was marked suspect during recovery due to insufficient log space (error 9002).

sp_add_log_file_recover_suspect_db db1, logfile2,
   'c:\Program Files\Microsoft SQL Server\MSSQL\Data\db1_logfile2.ldf',
   '1MB'

See Also

ALTER DATABASE

sp_add_data_file_recover_suspect_db

System Stored Procedures

Show:
© 2014 Microsoft