Example MSSQL and MySQL tables to hold logging data:
/*MSSQL*/ CREATE TABLE [dbo].[CRUSHFTP_LOG]( [LOG_ROW_NUM] [float] NOT NULL, [LOG_MILLIS] [float] NOT NULL, [LOG_TAG] [varchar](50) NULL, [LOG_DATA] [varchar](2000) NULL, CONSTRAINT [PK_CRUSHFTP_LOG] PRIMARY KEY CLUSTERED ( [LOG_ROW_NUM] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] /*MYSQL*/ CREATE TABLE `CRUSHFTP_LOG` ( LOG_ROW_NUM DOUBLE NOT NULL PRIMARY KEY, LOG_MILLIS DOUBLE NOT NULL, LOG_TAG VARCHAR(50) DEFAULT NULL, LOG_DATA VARCHAR(2000) DEFAULT NULL);
If you have multiple servers dumping logs to the same table, make a new column for autonumbering and have that be primary key. Do not use the default primary key or there will be problems logging and the servers will run out of memory.
And a more optimized and tweaked version for MS SQL:
-- DATABASE CREATION USE [master] GO CREATE DATABASE [CrushFTPDB] CONTAINMENT = NONE ON PRIMARY ( NAME = N'CrushFTPDB', FILENAME = N'D:\SQLServer\data\CrushFTPDB.mdf' , SIZE = 5120KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'CrushFTPDB_log', FILENAME = N'C:\SQLServer\logs\CrushFTPDB_log.ldf' , SIZE = 4608KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) GO ALTER DATABASE [CrushFTPDB] SET COMPATIBILITY_LEVEL = 110 GO IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')) begin EXEC [CrushFTPDB].[dbo].[sp_fulltext_database] @action = 'enable' end GO ALTER DATABASE [CrushFTPDB] SET ANSI_NULL_DEFAULT OFF GO ALTER DATABASE [CrushFTPDB] SET ANSI_NULLS OFF GO ALTER DATABASE [CrushFTPDB] SET ANSI_PADDING OFF GO ALTER DATABASE [CrushFTPDB] SET ANSI_WARNINGS OFF GO ALTER DATABASE [CrushFTPDB] SET ARITHABORT OFF GO ALTER DATABASE [CrushFTPDB] SET AUTO_CLOSE OFF GO ALTER DATABASE [CrushFTPDB] SET AUTO_CREATE_STATISTICS ON GO ALTER DATABASE [CrushFTPDB] SET AUTO_SHRINK OFF GO ALTER DATABASE [CrushFTPDB] SET AUTO_UPDATE_STATISTICS ON GO ALTER DATABASE [CrushFTPDB] SET CURSOR_CLOSE_ON_COMMIT OFF GO ALTER DATABASE [CrushFTPDB] SET CURSOR_DEFAULT GLOBAL GO ALTER DATABASE [CrushFTPDB] SET CONCAT_NULL_YIELDS_NULL OFF GO ALTER DATABASE [CrushFTPDB] SET NUMERIC_ROUNDABORT OFF GO ALTER DATABASE [CrushFTPDB] SET QUOTED_IDENTIFIER OFF GO ALTER DATABASE [CrushFTPDB] SET RECURSIVE_TRIGGERS OFF GO ALTER DATABASE [CrushFTPDB] SET DISABLE_BROKER GO ALTER DATABASE [CrushFTPDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF GO ALTER DATABASE [CrushFTPDB] SET DATE_CORRELATION_OPTIMIZATION OFF GO ALTER DATABASE [CrushFTPDB] SET TRUSTWORTHY OFF GO ALTER DATABASE [CrushFTPDB] SET ALLOW_SNAPSHOT_ISOLATION OFF GO ALTER DATABASE [CrushFTPDB] SET PARAMETERIZATION SIMPLE GO ALTER DATABASE [CrushFTPDB] SET READ_COMMITTED_SNAPSHOT OFF GO ALTER DATABASE [CrushFTPDB] SET HONOR_BROKER_PRIORITY OFF GO ALTER DATABASE [CrushFTPDB] SET RECOVERY FULL GO ALTER DATABASE [CrushFTPDB] SET MULTI_USER GO ALTER DATABASE [CrushFTPDB] SET PAGE_VERIFY CHECKSUM GO ALTER DATABASE [CrushFTPDB] SET DB_CHAINING OFF GO ALTER DATABASE [CrushFTPDB] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) GO ALTER DATABASE [CrushFTPDB] SET TARGET_RECOVERY_TIME = 0 SECONDS GO ALTER DATABASE [CrushFTPDB] SET READ_WRITE GO -- TABLE CREATION USE [CrushFTPDB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[CRUSHFTP_LOG]( [LOG_ROW_NUM] [bigint] NOT NULL, [LOG_MILLIS] [bigint] NULL, [LOG_TAG] [varchar](50) NULL, [LOG_DATA] [nvarchar](max) NULL, CONSTRAINT [PK_CRUSHFTP_LOG] PRIMARY KEY CLUSTERED ( [LOG_ROW_NUM] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO SET ANSI_PADDING OFF GO
Add new attachment
Only authorized users are allowed to upload new attachments.
«
This particular version was published on 05-Dec-2023 05:32 by Ben Spink.
G’day (anonymous guest)
Log in
JSPWiki