I would like to extract SQL server (event) log information into text file or DB tables so that we can read it with a script everyday.
Could you please advise how that can be done?
Thanks in advance!
Pingx
pingx
I would like to extract SQL server (event) log information into text file or DB tables so that we can read it with a script everyday.
Could you please advise how that can be done?
Thanks in advance!
Pingx
pingx
I am very familiar with running SQL Profiler with a set of "minimally invasive" template options and the info is extremely useful.
I am not as familar with the content of the results from running the DMV queries.
Can the DMV views provide the same info as "SQL Profiler" does?
Hi,
We are trying to run following query in SQL cmd but it is failing error.
SQLCMD query
Code
:setvar Mode [$Mode]
:setvar Version [$Version]
:setvar LogicImageDir [$LogicImageDir]
:setvar DatabaseName [$Database]
:setvar DefaultFilePrefix "test"
:setvar DefaultDataPath "C:\MSSQL\Data\"
:setvar DefaultLogPath "C:\MSSQL\Log\"
GO
:on error exit
GO
/*
Detect SQLCMD mode and disable script execution if SQLCMD mode is not supported.
To re-enable the script after enabling SQLCMD mode, execute the following:
SET NOEXEC OFF;
*/
:setvar __IsSqlCmdEnabled "True"
GO
IF N'$(__IsSqlCmdEnabled)' NOT LIKE N'True'
BEGIN
PRINT N'SQLCMD mode must be enabled to successfully execute this script.';
SET NOEXEC ON;
END
GO
USE [$(DatabaseName)]; -- execution
gives an error at this point
-----not the complete code
Error
Appreciate your help. Thank you.
Hi Team
We are facing the issue on SQL cluster 2016 servers . SQL services self stop and start after 2 or 3 days and finding only I/O related error in default logs location as well generate the memory dump after 4 or 3 days "N:\MSSQL13.SQL3B\MSSQL\LOG\SQLDump0018.mdmp" . and no failover happens after services UP
And this issue is occurring our all production servers .
SQL server 2016 SP 1
Windows server 2012
Regards
Dinesh
Hi,
I am getting below error while installing SQL server, when selected domain account for SQL server engine startup account and press next.
(11) 2020-02-16 14:58:48 Slp: Sco: Attempting to check if container 'WinNT://DOMAIN' of user account exists
(11) 2020-02-16 14:58:48 Slp: Prompting user if they want to retry this action due to the following failure:
(11) 2020-02-16 14:58:48 Slp: ----------------------------------------
(11) 2020-02-16 14:58:48 Slp: The following is an exception stack listing the exceptions in outermost to innermost order
(11) 2020-02-16 14:58:48 Slp: Inner exceptions are being indented
(11) 2020-02-16 14:58:48 Slp:
(11) 2020-02-16 14:58:48 Slp: Exception type: Microsoft.SqlServer.Configuration.Sco.ScoException
(11) 2020-02-16 14:58:48 Slp: Message:
(11) 2020-02-16 14:58:48 Slp: Access is denied.
(11) 2020-02-16 14:58:48 Slp:
(11) 2020-02-16 14:58:48 Slp: HResult : 0x84bb0001
(11) 2020-02-16 14:58:48 Slp: FacilityCode : 1211 (4bb)
(11) 2020-02-16 14:58:48 Slp: ErrorCode : 1 (0001)
(11) 2020-02-16 14:58:48 Slp: Data:
(11) 2020-02-16 14:58:48 Slp: WatsonData = Domain
(11) 2020-02-16 14:58:48 Slp: DisableRetry = true
(11) 2020-02-16 14:58:48 Slp: Inner exception type: System.UnauthorizedAccessException
(11) 2020-02-16 14:58:48 Slp: Message:
(11) 2020-02-16 14:58:48 Slp: Access is denied.
(11) 2020-02-16 14:58:48 Slp:
(11) 2020-02-16 14:58:48 Slp: HResult : 0x80070005
(11) 2020-02-16 14:58:48 Slp: Stack:
(11) 2020-02-16 14:58:48 Slp: at System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsContainer.GetObject(String className, String relativeName)
(11) 2020-02-16 14:58:48 Slp: at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)
(11) 2020-02-16 14:58:48 Slp: at Microsoft.SqlServer.Configuration.Sco.User.LookupADEntry()
I am installing SQL server 2016 STD version on Windows 2016 OS which joined to Domain controller.
Note: I can install by selecting Local System as startup account. later can change through configuration manager. I can't do this workaround for Cluster installation.
Any body faced this issue?
I'm not sure the best place to ask this so I figured I'd ask here. I work in a large shop with 100s of SQL Servers mostly running Enterprise Edition. I'd like to convert many of the non-production (development, acceptance testing, etc) to Developer Edition. I've come across this statement in the licensing guide though and cant get a clear answer from anyone as to what it means...
"SQL Server Developer Edition may not be used in a production environmentor with commercial data"
"Production environment" is pretty self-explanatory but what exactly is "commercial data"? For example if in a production environment I encounter an application bug or performance issue that I can only reproduce with data from the production environment, am I not allowed to copy the production data to a server running Developer Edition for debugging purposes?
Is there a difference between "production" data and "commercial" data? Is commercial data perhaps data that I purchased - say marketing data - that I want to perform analysis on? That's not the sort of thing I want to do with DE. I simply want to troubleshoot on a non-production server using production data.
Chuck
Hi Everyone,
I am trying to update my Nortridge (NLS) Program and their customer support is unable to help me with creating a test database on my SQL server. I was able to create a new, blank database but am not able to backup my NLS database and restore it to the blank database.
It looks like it is backing up but when I go to select the file to restore it it does not show a .bak file.
Can anyone help me with this?
Hi,
I am trying to download SQL Server 2017 web edition. But not finding the link in microsoft website.
Its showing as : See your hosting partner for pricing. (Hosting only)
May i know what is mean by this? Can anyone give inputs how to download web edition?
Thanks,
Jo
pols
Trying to import data from Excel is giving this message.
Office365 64-bit
Here's what I tried:
1) I installed the 64-bit Access database engine 2016
2) I tried the 2010 & 2007 versions as well
3) I reinstalled Office365
I'm out of ideas. What else could be going on here?
Getting error while using SSMA tool
Synchronize with database
Error :
An unexpected error occurred. Please send the log file to product support. For more information, see "Getting SSMA Assistance" in the product documentation.
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Product Details
SSMA for Sybase : V8.1.0
MS SQL Server 2016
Sybase ASE 15.7
I have an SQL Server 2016 database set to full recovery mode which is ~400Mb however the log is almost 30Gb. Whether I perform a full backup in SSMS or using tsql or manually try to shrink it, it wont lower in size. It shows 99% available free space when
attempting to shrink.
There are no open transactions reported by DBCC OPENTRAN, however the application that accesses the database has a Window service which when stopped allows the log file to be flushed.
What can I report through SQL Server that may indicate what the developer has done causes this?
Thanks.
I have set up a linked server connection to import excel 2016 file 64 bit sheets.
This has been running with no problems for 1 1/2 years. I can run the script repeatedly for approx 5 minutes then I get error messages as below:
Msg 7399, Level 16, State 1, Line 46
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "lkExcelImport" reported an error. The provider reported an unexpected catastrophic failure.
Msg 7303, Level 16, State 1, Line 46
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "lkExcelImport".
I have one linked server to another sql server DB and this works continually.
I have to restart the server 1 or more times to reestablish the connection. Once the connection is working I test and can rerun the script for about 5 minutes before it stops again.
There have been no changes to the scripts or the excel spreadsheets.
Hi,
total DB size 82GB,
recently removed 40GB of data from Database , so i try to shrink DB files to claim space. ( so the wizard should show approximately Available Free space 40000 MB)
when i check in wizard it shows wrong data, but in dbcc SHOWFILESTATS shows right value.
am using SSMS 18.4 & SQL 2019,
Wizard Result:
DBCC Result:
what's the different between database status Suspect vs Recovery Pending. ???
what's are the different causes for both Suspect vs Recovery Pending. ???
Hi,
I am new to this DBA role. Please suggest solution to resolve this issue.
Issue:
In my secondary server all user databases are in synchronizing state and the log file drive is full. I tried to do a shrink on the ldf files. but I could not do anything against the databases.
Regards
Priya
I am executing DBCC shrinkfile on a user database and it is getting blocked by a system process.
I am doing thins shrink as an onetime process as 90% data was removed from the database.
I am trying below command,
Available space in DB is 540 GB and used space is 60 GB.
dbcc shrinkfile (datafile,0, truncateonly)
or
dbcc shrinkfile (datafile,542720, truncateonly)
or
dbcc shrinkfile (datafile,542720)
Executing below command shows that the shrink operation reaches 100% in 1 or 2 minutes, after that it gets blocked by a system process. Shrinkfile waits on LCK_M_SCH_M
SELECT start_time, percent_complete, DATEADD (ss,DATEDIFF (ss,start_time,getdate()) / percent_complete * 100,start_time) AS Expected_end_time,
st.text as SQL, command as Current_Command,session_id FROM
sys.dm_exec_requests er
CROSS APPLY
sys.dm_exec_sql_text(er.sql_handle) st
WHERE percent_complete > 0
sp_whoisactive shows that system process as NULL and dbcc inputbuffer also shows as null.
Workflow:
On April 29th I created a new temporal table named [dbo].[FactPersonnelScheduleDetails_Current] with a default history table named [History].[FactPersonnelScheduleDetails_Current].
This table is in a data warehouse that performs several merge statements on an hourly basis.
Twice now since implementing this table 4 days ago, the merge transaction has failed with the following error: "Attempting to set a non-NULL-able column's value to NULL"
The History table has one user-defined index. As soon as I drop that index, I can the successfully complete the merge.
Any suggestions why the MERGE is failing when I have a user defined index created on the history table, but works when I remove the user defined index?
CREATE TABLE [dbo].[FactPersonnelScheduleDetails_Current] ( [ScheduleCellKey] INT NOT NULL, [ScheduleCellID] INT NOT NULL, [DBID] SMALLINT NOT NULL, [ScheduleDetailsID] INT NOT NULL, [RecordNumber] SMALLINT NULL, [WorkDate] DATE NULL, [WorkDateKey] INT NULL, [WeekStartDate] DATE NULL, [DayOfTheWeek] VARCHAR(50) NULL, [WorkDayNumber] TINYINT NULL, [MasterScheduleCellKey] INT NULL, [WorkingScheduleMatchesMasterScheduleFlag] VARCHAR(3) NULL, [DateWorkingScheduleNoLongerMatchesMaster] DATETIME2(7) NULL, [IsHoliday] VARCHAR(3) NULL, [JobPostDetailID] INT NULL, [JobPostDetailKey] INT NULL, [JobNumber] VARCHAR(10) NOT NULL, [JobKey] INT NOT NULL, [JobTierKey] INT NOT NULL, [EmployeeNumber] INT NULL, [EmployeeKey] INT NULL, [CategoriesDetailID] INT NULL, [BillCategory] VARCHAR(50) NULL, [HoursTypeID] SMALLINT NULL, [HoursTypeDescription] VARCHAR(50) NULL, [PaycheckDescriptionId] SMALLINT NULL, [PaycheckDescription] VARCHAR(50) NULL, [RecordTypeID] TINYINT NULL, [Hours] DECIMAL(19,4) NULL, [InTime] TIME(3) NULL, [InTimeString] VARCHAR(8) NULL, [InDateTime] DATETIME NULL, [OutTime] TIME(3) NULL, [OutTimeString] VARCHAR(8) NULL, [OutDateTime] DATETIME NULL, [LunchHours] DECIMAL(19,4) NULL, [NextDay] VARCHAR(3) NOT NULL, [PayRate] MONEY NULL, [SpecialPayRate] VARCHAR(3) NOT NULL, [ForceOTToThisJob] VARCHAR(3) NOT NULL, [OvertimeHours] DECIMAL(19,4) NULL, [DoubletimeHours] DECIMAL(19,4) NULL, [InvoiceNumber] INT NULL, [InvoiceDescription] VARCHAR(100) NULL, [TierDescription] VARCHAR(100) NULL, [BillRate] MONEY NULL, [SpecialBillRate] VARCHAR(3) NOT NULL, [BillingPayRate] MONEY NULL, [NonBillableTypeID] SMALLINT NULL, [NonBillableTypeDescription] VARCHAR(50) NULL, [LastChangedBy] VARCHAR(20) NULL, [LastChangedDate] DATETIME NULL, [DaysBetweenWorkDateAndModifiedDate] INT NULL, [UpdatedToTKHours] VARCHAR(3) NULL, [SpecialInvoiceDescription] VARCHAR(3) NULL, [SpecialTierDescription] VARCHAR(3) NULL, [InvoiceDetailID] INT NULL, [TTMStatusID] INT NULL, [IsConfirmed] VARCHAR(3) NULL, [DateConfirmed] DATETIME NULL, [IsPublished] VARCHAR(3) NULL, [AcceptedTypeForPSTT] TINYINT NULL, [TeamTimeAcceptedTypeDescription] VARCHAR(50) NULL, [UserName] VARCHAR(20) NULL, [DateChanged] datetime NULL, [Notes] VARCHAR(255) NULL, [SystemNotes] VARCHAR(8000) NULL, [ETLDateChanged] DATETIME2(7) NOT NULL DEFAULT (sysdatetime()), [RecordInsertTimestamp] DATETIME2(7) NOT NULL DEFAULT (sysdatetime()), [RecordUpdateTimestamp] DATETIME2(7) NOT NULL DEFAULT (sysdatetime()), SysStartTime datetime2(0) GENERATED ALWAYS AS ROW START CONSTRAINT DF_SysStart DEFAULT SYSUTCDATETIME(), SysEndTime datetime2(0) GENERATED ALWAYS AS ROW END CONSTRAINT DF_SysEnd DEFAULT CONVERT(datetime2 (0), '9999-12-31 23:59:59'), PERIOD FOR SYSTEM_TIME (SysStartTime, SysEndTime), CONSTRAINT PK_FactPersonnelScheduleDetails_Current PRIMARY KEY NONCLUSTERED (ScheduleCellKey)) WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = History.FactPersonnelScheduleDetails_Current)); CREATE CLUSTERED INDEX [IX01_FactPersonnelScheduleDetails_Current] ON [dbo].[FactPersonnelScheduleDetails_Current] (WorkDateKey,DBID); CREATE NONCLUSTERED INDEX [IX02_FactPersonnelScheduleDetails_Current] ON [dbo].[FactPersonnelScheduleDetails_Current] (JobKey) INCLUDE (ScheduleCellKey,DBID,WeekStartDate,JobTierKey,EmployeeKey,Hours,WorkingScheduleMatchesMasterScheduleFlag); CREATE NONCLUSTERED INDEX [IX03_FactPersonnelScheduleDetails_Current] ON [dbo].[FactPersonnelScheduleDetails_Current] (RecordUpdateTimestamp,MasterScheduleCellKey) INCLUDE (ScheduleCellKey,WeekStartDate,DayOfTheWeek,JobPostDetailKey,JobKey,EmployeeKey,CategoriesDetailID,Hours,InTime,OutTime,NextDay,PayRate,SpecialPayRate,ForceOTToThisJob,BillRate,SpecialBillRate,NonBillableTypeID,ETLDateChanged,RecordNumber,WorkingScheduleMatchesMasterScheduleFlag); CREATE NONCLUSTERED INDEX [IX04_FactPersonnelScheduleDetails_Current] ON [dbo].[FactPersonnelScheduleDetails_Current] (WorkingScheduleMatchesMasterScheduleFlag) INCLUDE (ScheduleCellKey,DBID,WeekStartDate,JobKey,JobTierKey,EmployeeKey,DateWorkingScheduleNoLongerMatchesMaster); CREATE NONCLUSTERED INDEX [IX01_FactPersonnelScheduleDetails_Current] ON [History].[FactPersonnelScheduleDetails_Current] (WorkDateKey,DBID) INCLUDE (ScheduleCellKey,WeekStartDate,JobKey,JobTierKey,EmployeeKey,Hours,SysStartTime,SysEndTime);
Hi,
We are trying to run following query in SQL cmd but it is failing error.
SQLCMD query
Code
:setvar Mode [$Mode]
:setvar Version [$Version]
:setvar LogicImageDir [$LogicImageDir]
:setvar DatabaseName [$Database]
:setvar DefaultFilePrefix "test"
:setvar DefaultDataPath "C:\MSSQL\Data\"
:setvar DefaultLogPath "C:\MSSQL\Log\"
GO
:on error exit
GO
/*
Detect SQLCMD mode and disable script execution if SQLCMD mode is not supported.
To re-enable the script after enabling SQLCMD mode, execute the following:
SET NOEXEC OFF;
*/
:setvar __IsSqlCmdEnabled "True"
GO
IF N'$(__IsSqlCmdEnabled)' NOT LIKE N'True'
BEGIN
PRINT N'SQLCMD mode must be enabled to successfully execute this script.';
SET NOEXEC ON;
END
GO
USE [$(DatabaseName)]; -- execution
gives an error at this point
-----not the complete code
Error
Appreciate your help. Thank you.
2 instances of Microsoft SQL Server 2014 (SP3-GDR) (KB4505218) - 12.0.6108.1 (X64) May 29 2019 20:05:27 Copyright (c) Microsoft Corporation Express Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
Running on Windows Server 2012 Standard on VM.
SQL Server installed on OS drive (C); master, model, temp DB all on E drive and user databases on F drive.
Something happened the other night preventing both instances from running. I believe during an automatic update.
Application log error indicated 'Cannot recover the master database...'.
The entire C drive was restored from backup and everything is working again except for a couple of items.
Open SSMS (log in as sa) right click on the server node, click on properties presents the following
The links in the details, of course, are useless.
Viewing properties for databases works fine. The problem is only for the server properties.
Also, on the SQL Server Logs node, there are no logs available.
If I run sp_readerrorlog, the results display the log entries, so logging is working.
Both issues occur for both instances of SS.
It is not an SSMS issue as when I connect remotely, both issues persist.
I've searched, but haven't found any info on either issue. I'm thinking to try a repair of the SS install, but thought I would post here first.
Anyone have any suggestions on solving these issues?