Quantcast
Channel: SQL Server Database Engine forum
Viewing all 12963 articles
Browse latest View live

Extracting SQL server event log

$
0
0

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


Do the DMV views provide the same info as "SQL Profiler" does?

$
0
0

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?

Error while running query in sqlcmd?

$
0
0

Hi,

We are trying to run following query in SQL cmd but it is failing error. 

SQLCMD query

sqlcmd -b -S machine.pu.lab.local,1433 -i "C:\Temp\Script Execution Installer\VMS.DB.TPMS.15.1.4.sql" -v Mode="$Mode" Version="150.1.4.28" LogicImageDir="IMAGEDIR1" DatabaseName="VARIAN"

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

Msg 105, Level 15, State 1, Server PUVMSQL14AT, Line 1
Unclosed quotation mark after the character string '[$DatabaseName];
Msg 102, Level 15, State 1, Server PUVMSQL14AT, Line 1
Incorrect syntax near '[$DatabaseName];

Appreciate your help. Thank you.

SQL cluster server SQL memory dump generated .

$
0
0

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

What is "commercial data"?

$
0
0

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



sql 2017 web edition download?

$
0
0

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

Updating NLS (Nortridge) Program - help needed to back up database and restore to test database.

$
0
0

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?

Microsoft.ACE.OLEDB.16.0 provider is not registered on the local machine. (System.data)

$
0
0

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?


Error while using SSMA tool

$
0
0

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


SQL Server 2016 log file not shrinking

$
0
0

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.

SQL Server 16 Linked Server intermittent connection errors

$
0
0

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.

Database Status: Suspect vs Recovery Pending.

$
0
0

what's the different between database status Suspect vs Recovery Pending. ???

what's are the different causes for both Suspect vs Recovery Pending. ???

shrink File shows wrong value - SQL 2019

$
0
0

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:


Seconday server databases not executes Use "Databasename"

$
0
0

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

Merge on temporal table fails with Attempting to set a non-NULL-able column's value to NULL

$
0
0

Workflow:

  1. Create temporal table with default history table in a data warehouse
  2. Create an index on the history table
  3. Perform merge statements against the temporal table on an hourly basis
  4. Notice sometimes the error will produce: Attempting to set a non-NULL-able column's value to NULL
  5. Drop the index from the history table
  6. Perform the merge with the same data set, and it will be successful
  7. Recreate the index on the history table
  8. Randomly the error will generate again, repeat steps 5 thru 7

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);


Unable to view Server Properites or SQL Server Log

$
0
0

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?

new SQL instance name name is not showing after changing the named instance name.

$
0
0

HI All,

i have changed sql named instance name by using below query.

sp_dropserver'Server Name\old_Instance_name'
    go
    sp_addserver'ServerName\New Instance Name','local'

go

however when i querying select@@servername it showing new name only.

but when i trying to connect with new name its not connecting but still able to connect with old name.

if i am using new name with port number i can able to connect instance. in configuration manager

also i can see old name only. is there any thing we need to change the server.

please suggest.

Thanks

Raghavendra


Thanks & Regards Raghavendra Petla

Stalled Resource Monitor: Resource Monitor (0x54c) Worker 0x000002A9841A2160 appears to be non-yielding on Node 2

$
0
0

Hi All,

this morning 

02/28/2020 06:46:15 CET, I got a bugcheck on Prod cluster , the dump file is really short,

I was searching KB about this topic 

thanks in advance for nay help

Diego

Resource Monitor (0x54c) Worker 0x000002A9841A2160 appears to be non-yielding on Node 2. Memory freed: 2428 KB. Last wait: MISCELLANEOUS. Last clerk: type USERSTORE_TOKENPERM<c/> name ACRUserStore-1379650-26-1. Approx CPU Used: kernel 33625 ms<c/> user 0 ms<c/> Interval: 484846.

----------------------------

Current time is 06:46:15 02/28/20.                                                                              
=====================================================================                            
       BugCheck Dump                                                                                            
=====================================================================                                            
                                                                                                                
This file is generated by Microsoft SQL Server                                                                  
version 13.0.5622.0                                                                                             
upon detection of fatal unexpected error. Please return this file,                                               
the query or program that produced the bugcheck, the database and                                                
the error log, and any other pertinent information with a Service Request.                                       
                                                                                                                
                                                                                                                
Computer type is Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz.                                                      
Bios Version is DELL   - 0                                                                                      
40 X64 level 8664, 2 Mhz processor (s).                                                                         
Windows NT 6.2 Build 9200 CSD .                                                                                 
                                     
Memory                               
MemoryLoad = 98%                     
Total Physical = 261922 MB           
Available Physical = 3520 MB         
Total Page File = 278322 MB          
Available Page File = 15634 MB       
Total Virtual = 134217727 MB         
Available Virtual = 133749613 MB     
**Dump thread - spid = 0, EC = 0x0000000000000000                                                               
***Stack Dump being sent to L:\SQL_DATA\MSSQL13.MSSQLSERVER\MSSQL\LOG\SQLDump0051.txt                            
* *******************************************************************************                                
*                                                                                                               
* BEGIN STACK DUMP:                                                                                             
*   02/28/20 06:46:16 spid 2704                                                                                 
*                                                                                                               
* Stalled Resource Monitor                                                                                      
*                                                                                                               
* *******************************************************************************                                
* -------------------------------------------------------------------------------                                
* Short Stack Dump                   
NULL


Diego scaravaggi (Freelancer)

Table Partitioning Switching

$
0
0

Hi All,

Can we switch the Nth partition to a non partitioned table , so that we can truncate this or archive this data later.

Ex: If I have Daily partitions on a SQL table,

 On Day1, One partition will be created with Split Range.

On Day 2, Split Range will create another day partition

On Day 3, before creating the Day3 partition, I have to Switch the Day1 partition to a non partition table and just maintain 2 partitions any time in my target (that is Current Day and Previous Day)

Here, How can we identity Getdate()-2 partition to SWITCH to a non partitioned table?

ALTERTABLE Source SWITCHPARTITION1TO Target, Here how can we set Parititon = Getdate()-2.

Thanks in advance.

Update stats will generate hugh transaction log

$
0
0
May I know if I execute sp_updatestats on a very large database, will it generate a transaction log ?
Viewing all 12963 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>