Quantcast
Channel: SQL Server Database Engine Forum
Viewing all 15872 articles
Browse latest View live

Reg: What are the disadvantages of stored procedures

$
0
0

Hi Experts,

can i know what are the disadvantages by using the stored procedures ?

Thanks in Advance.


SQL Server Alert System: 'Severity 016' occurred on \\SQLSERVER1

$
0
0

Good Day Everyone,

I keep getting this error on my SQL Server on average by the hour. This is a SQL2014 server with the latest sp (virtual).

DESCRIPTION:   TCP connection closed but a child process of SQL Server may be holding a duplicate of the connection's socket. Consider enabling the TcpAbortiveClose SQL Server registry setting and restarting SQL Server. If the problem persists, contact Technical Support.

I verified no antivirus is causing the issue. I verified CPU, memory everything in tact. Server is behaving normal for clients except our middle tier agent and web servers disconnect every once in a while but it does not align with every instance this error occurs. Any assistance or words of wisdom would be appreciated.

Have a pleasant day.

Best,

Frank


A SQL Server MVP or MSFT Eng should be replying soon as well. Hope this helps. Frank Garcia *** Please select "Vote As Helpful" if the information provided was helpful to you. If an answer to your issue solved the problem then please mark it as"Propose As Answer" located at the bottom. Thank you. ***

SQL Cluster: initerrlog: Could not open error log file - 'MSSQL13.MSSQLSERVER\MSSQL\Log\ERRORLOG' OS system Error 3 on

$
0
0

Hi

I have a SQL Cluster with two nodes using SQL 2016 Std.

On the inactive node I get lots of errors saying "initerrlog: Could not open error log file 'D:\SQL\MSSQL13.MSSQLSERVER\MSSQL\Log\ERRORLOG'. Operating system error = 3(The system cannot find the path specified.)."

I get about 10 per minute. Since the node I'm getting this on is inactive and therefore none of the SQL Services are running I'm bit confused as to why I get the error at all.

I should say that the SQL Cluster uses Shared Disks (not CSVs).

Any help would be appreciated

Rich

SQL temp DB suddenly growing and reserving all the available space in the disk

$
0
0

Dear Experts,

I'm facing the issues in temp DB. which is growing suddenly and reserving all the available space in disk.

This I'm facing once in a week. In this case Shrink also  not working and there is no blocked transactions as well in temp DB.

To release the occupied space I must restart the SQL services. 

I have tried to run a SQL profiler but i couldn't  found the exact reason.

There are three major applications connected to the database AX, CRM and SP.

please advice if anyone experienced and resolved the same issue. 

Thanks & Regards,


MSBUILD and automated releases

$
0
0

All,

I'm posting this question here even though it is more of a AzureDevOps question but nevertheless it is related to SQLServer and I could not find an exclusive forum for AzureDevOps.

We have to implement CI/CD for our SQLServer 2012 database releases. We used to use TFS but now we have migrated to VSTS platform and now we are working on the Database CI/CD design. We decided that we will be using the State-Based approach using the SQLPackage to deploy the differential scripts from the project and in this Phase I of our project, we are not considering Unit Testing.

We have identified two tools primarily to use in our pipeline ie, SQLPackage and MSBuild. We will use SQLPackage to build the Test Bed for the database against which we will be targeting the planned changes and we will be using MSBuild to create off of the database solution/Project that the developers would check in. We will eventually deploy the changes using SQLPackage as it can apply the differences against the target environment (Test Build, Stage and Prod).

In the Publish phase of the SQLPackage, we will put in lot of restrictions such as

[1] Ignore Logins

[2] Ignore Users

[3] Ignore Database creation

I just wanted to hear from others their experiences and lessons learnt.. Let me know if I'm missing anything.

Thanks,

rgn


QueryStore grows and grows

$
0
0

Hi guys,

I have a database with QS enabled with the follow settings;
-2016SP1CU7 standard edition
-operation mode RW
-data flush interval 15 min
-statistics collection interval 1 day
-max size 200 MB
-querystore capture mode auto
-size based cleanup mode auto
-stale query threshold 30 days

The size of the database is around 790 GB.

Thé query store used is 11GB !!!!
I wonder why this is happening. Can somebody tell me what is possibly wrong? Can I purge query data without any problems or set it to read-only? Is this probably a bug? Has anybody seen this before? And if so what is/was the solution?

kind regards
Marco

SQL 2017 sp_xml_preparedocument

$
0
0

From the following link

https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-xml-preparedocument-transact-sql?view=sql-server-2017

"A parsed document is stored in the internal cache of  SQL Server. The MSXML parser uses one-eighth the total memory available for  SQL Server. To avoid running out of memory, runsp_xml_removedocument to free up the memory. "

1. does it mean using "Total server memory" of SQL server ? or memory that not govern by "max server memory"?

2. Can check how many memory used by MSXML parser currently ?

3. I got "XML document could not be created because of server memory is low" . So what's need to check ?

cannot see any sql server jobs - sql server 2008

$
0
0
Hi,

There are several SQL server jobs which are running as per their schedule daily\weekly and all... when i double click on 'Job Activity Monitor' or when i right click on 'Job Activity Monitor' and select 'View Job Activity' i cannot see any jobs... but when i right click on 'Jobs' folder and select 'View History' it shows the history of all the jobs....

Sql server 2008 SP4 (10.0.6241.0) is my sql version...

any help is appreciated..

thanks in advance....

VVinayPrasad


Multiple TempDB files disappear on restart

$
0
0

1. Added 2 extra tempDB files across 2 logical drives.

2. Restarted SQL Service or the server

3. The 2 extra files disappear from tempDB.  However, they still on the hard drive.

??? Why did they disappear and is there a way to tell SQL to keep them around?

I noticed also that sys.sysaltfiles still has the file names so they can't be added back in under the same names.

I have MSSQL 2012 and windows 2012

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

SQL Server 2017 licence

$
0
0

Hi Team,

we planning to keep primary secondary <g class="gr_ gr_57 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="57" id="57">db</g> copy in primary data <g class="gr_ gr_113 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="113" id="113">center</g>..and planning to keep one more DR copy in <g class="gr_ gr_205 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="205" id="205">secondary</g> data <g class="gr_ gr_210 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="210" id="210">center</g>. Please suggest ..DR copy also consider as core <g class="gr_ gr_424 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling ins-del multiReplace" data-gr-id="424" id="424">basedlicense</g> ??

Thanks

Kural

how to change collation of all columns from all tables from a perticular database

$
0
0

Hi,

I have BBC database, but in my database there are multiple tables in which column level collation is different-different.

Now i want to set that all columns has same collation setting from all tables of BBC database.

Using Alter table syntax ( Alter table table_name Alter column column_name datatype collate collation_name null)

i have found that if there is primary key or index is present then I have to delete that first , then & then only

I am able to change my collation.

Please help me how to do it for all columns for all tables else I have to do it one by one manually.

Collation SQL_Latin1_General_CP1_CI_AS vs Latin1_General_BIN2

$
0
0

Change database / column collation from SQL_Latin1_General_CP1_CI_AS vs Latin1_General_BIN2

1. what's the sorting difference?

2. what's the character size difference ?

3. what's the steps the change the collation ? for database it should be easy, for column collation , how to change at once?

4. Are there character conversion need ?will there be character corruption during the collation change/?

SQL 2014 - ALTER INDEX online default ?

$
0
0

Hello when issuing an ALTER INDEX (REBUILT OR REORG) without specifying online or offline option...is the default ONLINE ?

Thanks in advance.

Sql Server 2016 Sp2 Update issue

$
0
0

After installing SQL Server 2016 SP2 in oneof the server, sql services are failed to restart: got below error

Starting execution of PRE_MSDB.SQL
2018-10-23 13:09:15.37 spid7s      ----------------------------------
2018-10-23 13:09:15.67 spid7s      Error: 3930, Severity: 16, State: 1.
2018-10-23 13:09:15.67 spid7s      The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.
2018-10-23 13:09:15.67 spid7s      Error: 912, Severity: 21, State: 2.
2018-10-23 13:09:15.67 spid7s      Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 3930, state 1, severity 16. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
2018-10-23 13:09:15.67 spid7s      Error: 3417, Severity: 21, State: 3.
2018-10-23 13:09:15.67 spid7s      Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
2018-10-23 13:09:15.67 spid7s      SQL Server shutdown has been initiated
2018-10-23 13:09:15.67 spid7s      SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.
2018-10-23 13:09:16.70 spid7s      Error: 25725, Severity: 16, State: 1.
2018-10-23 13:09:16.70 spid7s      An error occurred while trying to flush all running Extended Event sessions.  Some events may be lost.


Availability Group Database Backups

$
0
0

Hello Forum

We are using 2014 SQL Server Availability Groups.  One of our previous DBA's has devised a Backup Script which essentially performs Full and Differential Backups on the Primary replica, and TL backup on the Read Only replica.

Is there a way to share the backup history between the replicas, so that if we need to do a PIT restore with the GUI, all backup history is available?


Please click "Mark As Answer" if my post helped. Tony C.

Reg: How to resolve the Sleep_Task Wait Type....

$
0
0

Hi Experts,

in one of the Production server having SSIS packages in SSIS db , i have occured the following wait type as shown in picture.

can i know which causes this issue and how  can i over come this wait type in sql  server.

Thanks in Advance.

Spreading Partitions across multiple files

$
0
0

Hi

I'm working on a system which has around 370m records in a non partitioned table. Queries against this table suck.

After doing some analysis it's fairly obvious that nearly all queries on this table, are for data that is < 10 days old, we have roughly 31 months of data in the table. There are a small number of reports that can be run against this, typically looking at 6-12 months of data.

Currently all of the Data that is < 10 days old is queried by a transaction ID and reports queries always have date range params.

I'm looking to split the table into a small table with the hot data in and archive the data after 10 days as this should significantly improve the performance of all normal user based transactions.

I'm looking to create a partitioned table, with each partition containing one months data. The current thought is we'd have separate files for each years worth of data, each containing 12 partitions. This would allow older data to be stored on slower/cheaper storage.

I have created file groups to represent each year, we'll have data for.

I have added a file to the db for each file group and created a partition function along the lines of:

CREATE PARTITION FUNCTION AuditLog_PFN_P1 (datetime2)  
    AS RANGE RIGHT FOR VALUES (
'20160101',
'20160201',
'20160301',
'20160401',.....)

What i would like to achieve is putting all of 2016's data into one file, 2017's into another file etc. 

Where i'm struggling is working out how to assign all of 2016s partitions to a particular file.

Please let me know a) if this can be done and b) if there are any major issues with this approach.

Thanks and regards

Matt


TempDB File creation

$
0
0
Some one created the Temp Data file for TempDB in SQL Server 2012 , just want to know who and when its created ?

SQL SERVER 2016 SP2 CU3 high CPU

$
0
0

We have SQL SERVER 2016 Standard Edition SP2 CU3 installed on it recently we noticed that cpu is treding very high so after reading online there was CCC audit introduced in c2 which was fixed in cu3 and that is now disabled however, do you guys advise that we should enable the Traceflag 3427 on SQL SERVER 2016 SP2 CU3 which possible can help to control the high cpu usuage.  Please advise on this many thanks 
Viewing all 15872 articles
Browse latest View live


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