Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create database and modify existing transaction log
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01099779
Message ID:
01099839
Views:
10
>we create after installation of our application, if USE HM fails, with the following t-sql statement a database:
>
>create database HM


There's another way to check if database exists
IF db_id('DataBaseName') IS NOT NULL
     PRINT 'DataBaseName' + ' exists!'

>We don't want give the File option FILENAME='c:\...', because we don't want to set absolute paths on SQL-Server machine (rights, ...).
>
>We need commands for
>
>- setting maxsize of transaction log from a unlimited size to a limited size
>
>?ALTER DATABASE HM MODIFY FILE (NAME = N'HM_log ', MAXSIZE = 10)
>
>- reducing (or deleting) size of transaction log, because maxsize can't
> be reduced to a mb size lower than the actual size.


You can get default directories from the registry as follow
Declare @defaultdata nvarchar(2000)
declare @defaultlog nvarchar(2000)
exec master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultData', @defaultdata output
print @defaultdata

exec master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultLog', @defaultlog output
print @defaultlog
>What is a recommended size for transaction log ?

There isn't one because it depends on many factors: DB recovey mode, # of transactions, backup strategy, e.t.c
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform