时间:2021-07-01 10:21:17 帮助过:11人阅读
--查看分区及分区范围的情况select * from sys.partitions where object_id = object_id('SecureUsbLog');select * from sys.partition_range_values;--查看分区架构情况select * from sys.partition_schemes;--查看某一特定分区列值属于哪个分区select M2.$
--查看分区及分区范围的情况 select * from sys.partitions where object_id = object_id('SecureUsbLog'); select * from sys.partition_range_values; --查看分区架构情况 select * from sys.partition_schemes; --查看某一特定分区列值属于哪个分区 select M2.$partition.Part_mediasec_func('20150325') as partition_num; --查看某一特定分区的记录 select * from SecureUsbLog where M2.$partition.Part_mediasec_func(logTime) = 3 --查看各分区所包含的记录数 select $partition.Part_mediasec_func(logTime) as partition_num, count(*) as record_num from SecureUsbLog group by $partition.Part_mediasec_func(logTime) order by $partition.Part_mediasec_func(logTime);
这部分是为了以后扩展,比如以后分区不够的时候,可以手动的添加分区。
--添加文件组 alter database M2 add filegroup [FG10]; go --文件组 alter database M2 add file(name=FG10_data,filename='c:\esafenet\FG10_data.ndf',size=1MB) to filegroup[FG10]; --添加分区,以后扩展 USE M2 GO ALTER PARTITION SCHEME Part_mediasec_scheme NEXT USED FG10 ALTER PARTITION FUNCTION Part_mediasec_func() SPLIT RANGE ('20221231 23:59:59') GO
总之日志这块分区是一个很好的选择,但也不是唯一的选择,还有一个就是syslog。什么是syslog?
下集我再分享。