如何在SQL Server 2005中创建日志文件 [英] How to create log file in sql server 2005

查看:119
本文介绍了如何在SQL Server 2005中创建日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我需要跟踪创建,编辑,删除或修改任何类型条目的所有用户.如何在sql server 2005中维护那些记录.我听说可以维护该日志文件.请向我解释如何创建或维护日志的概念.

In my application I need to keep track of all the users who had created, edited deleted or modified any type of entries. How to maintain those records in sql server 2005. I heard of that log file can be maintained. Please explain me the concept of how log is created or maintained.

推荐答案

SQL拥有自己的名为".LDF"的日志文件(日志数据文件)
您不能创建自己的PDF,如果要跟踪所有数据库应用程序,则可以在软件中进行自定义.
创建一个AUDIT表,在每个插入/更新/删除活动上,在AUDIT表中放置一个条目
在sql中存在LOG文件的信息
请参见此处 [
SQL has it''s own log file called ".LDF"(log data file)
you can not create your own PDF, if you want to keep track of all database application then, its a customization in your software.
create one AUDIT table, on each insert/update/delete activity put one entry in AUDIT table
for information of LOG files exist in sql
See here[^]


您好,

如果要执行此操作,只需为此条目创建DDL触发器:

http://www.sqlteam.com/article/using-ddl-triggers-in-sql-server-2005-to-capture-schema-changes [ http://www.mssqltips.com/sqlservertip /2085/sql-server-ddl-triggers-to-track-all-database-changes/ [
Hi,

If you want to do this, just create DDL Trigger for this entries:

http://www.sqlteam.com/article/using-ddl-triggers-in-sql-server-2005-to-capture-schema-changes[^]

here is a good article which can help you:

http://www.mssqltips.com/sqlservertip/2085/sql-server-ddl-triggers-to-track-all-database-changes/[^]

Regards
Robert


1.在对象资源管理器中,连接到SQL Server数据库引擎的实例,然后展开该实例.
2.展开数据库,右键单击要从中添加文件的数据库,然后单击属性.

3.在数据库属性"对话框中,选择文件"页面.

4.要添加数据或事务日志文件,请单击添加.

5.在数据库文件网格中,输入文件的逻辑名称.文件名在数据库中必须唯一.

6.选择文件类型,数据或日志.

7.对于数据文件,从列表中选择应在其中包含文件的文件组,或选择< new filegroup>.创建一个新的文件组.事务日志不能放在文件组中.

8.指定文件的初始大小.根据您在数据库中期望的最大数据量,使数据文件尽可能大.有关更多信息,请参见使用文件和文件组管理数据库增长.

9.要指定文件的增长方式,请在自动增长"列中单击(…).从以下选项中选择:
a.要允许当前选定的文件随着需要更多数据空间而增长,请选中启用自动增长"复选框,然后从以下选项中进行选择:
b.要指定文件以固定的增量增长,请选择以兆字节为单位"并指定一个值.
c.要指定文件应按当前文件大小的百分比增长,请选择按百分比"并指定一个值.

10.要指定最大文件大小限制,请从以下选项中选择:
要指定文件应能够增长到的最大大小,请选择``限制文件增长(MB)''并指定一个值.
b.要允许文件根据需要增长,请选择不受限制的文件增长".
c.为防止文件增长,请清除启用自动增长"复选框.文件的大小将不会超出初始大小(MB)"列中指定的值.

11.指定文件位置的路径.添加文件之前,指定的路径必须存在.

12.单击确定.

尝试执行以下步骤.
1.In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.

2.Expand Databases, right-click the database from which to add the files, and then click Properties.

3.In the Database Properties dialog box, select the Files page.

4.To add a data or transaction log file, click Add.

5.In the Database files grid, enter a logical name for the file. The file name must be unique within the database.

6.Select the file type, data or log.

7.For a data file, select the filegroup in which the file should be included from the list, or select <new filegroup> to create a new filegroup. Transaction logs cannot be put in filegroups.

8.Specify the initial size of the file. Make the data file as large as possible, based on the maximum amount of data you expect in the database. For more information, see Using Files and Filegroups to Manage Database Growth.

9.To specify how the file should grow, click (…) in the Autogrowth column. Select from the following options:
a.To allow for the currently selected file to grow as more data space is required, select the Enable Autogrowth check box and then select from the following options:
b.To specify that the file should grow by fixed increments, select In Megabytes and specify a value.
c.To specify that the file should grow by a percentage of the current file size, select In Percent and specify a value.

10.To specify the maximum file size limit, select from the following options:
a.To specify the maximum size the file should be able to grow to, select Restricted File Growth (MB) and specify a value.
b.To allow for the file to grow as much as needed, select Unrestricted File Growth.
c.To prevent the file from growing, clear the Enable Autogrowth check box. The size of the file will not grow beyond the value specified in the Initial Size (MB) column.

11.Specify the path for the file location. The specified path must exist before adding the file.

12. Click OK.

Try this steps..


这篇关于如何在SQL Server 2005中创建日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆