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

Service account settings for web app access

$
0
0

I work for a project where we have pii information in our database. To secure the web app access to the database, I wanted to know is it best practice to allow the service account access execute permissions to all objects or is it more secure to limit the execute access to the needed objects? With limiting the access, what are the drawbacks? Is the only draw back that it could hinder the development team?

Who's responsibility would it be to oversee the stored procs access if execute to all object is not the right approach? Should it be the DBA or the software development team?


Why is the number of rows per row-group in a columnstore so low?

$
0
0

I have a partitioned clustered columnstore index in SQL 2016. Each partition is 1 month. I'm viewing a list of partitions, row groups and total rows. In partitions 1 to 141 it's nice and tidy with most row groups full with 1,048,576. Parition 142 has lots of row groups with much less than the full number of rows. I tried a rebuild using this statement:

alter index incc_FactDailyANZTransactions ON FactDailyANZTransactions
	REBUILD PARTITION = 142 WITH( DATA_COMPRESSION = COLUMNSTORE, MAXDOP = 1 );

This doesn't appear to make any difference.

Anyone got any ideas? Is it possible that the partition number in the ALTER INDEX statement is zero based but the query on sys.column_store_row_groups is 1 based?



Nick Ryan MIS Programmer Analyst, ANZ Bank


Trace Flag 8293 not working

$
0
0

After we enabled Change Tracking, we keep getting the alert below:

"Change Tracking autocleanup is blocked on side table of "tablename". If the failure persists, check whether the table "tablename is blocked by any process."

So we followed this KB article to set Trace Flag 8293, but still we get the alert (11 within one minute), anything we could be missing?

https://support.microsoft.com/en-us/help/4456883/fix-change-tracking-cleanup-message-22123-is-unexpectedly-recorded-in

PS: we are using SQL 2016 SP2


Splitting TempDB into multiple data files.

$
0
0
To avoid contention we have to split tempdb into multiple data files. But as for case suppose, there is 20 GB total space is on the drive containing 1 tempdb data file of 15 GB. And I have to create 3 more tempdb data files, and as recommendation all files should be of same size.Then how to handle this situation and configure all data files with same size?

Pranshul Gupta

Hangs on one simple update SQL

$
0
0

(@P1 varchar(12),@P2 varchar(260),@P3 int,@P4 varchar(260),@P5 varchar(12),@P6 datetime2(3),@P7 varchar(260),@P8 int)

UPDATE d_activity_type
SET    activity_type_bk = @P1, 
       activity_desc = @P2, 
       display_order = @P3, 
       activity_short_desc = @P4, 
       activity_status = @P5, 
       row_updated_dte = @P6, 
       row_updated_by = @P7 
WHERE  activity_type_sk = @P8

table only has 40 rows

from activity monitor, wait for pageiolatch_sh, IO_COMPLETION.

Please advise

sql server using very less memory

$
0
0
Hi,

we are using sql 20014. system specifications :4CORE &128GB RAM . We configured max memory 110460 mb  & min memory as 1024 kb.
Users complaining that SQL peformance is very slow.
when we checked the task manager sql.exe utilising 62 % memory.
when i tried to check the memory using below query its showing that 72 gb memory is using.
select
(physical_memory_in_use_kb/1024)Memory_usedby_Sqlserver_MB,
(locked_page_allocations_kb/1024 )Locked_pages_used_Sqlserver_MB,
(total_virtual_address_space_kb/1024 )Total_VAS_in_MB,
process_physical_memory_low,
process_virtual_memory_low
from sys. dm_os_process_memory

o/p:
Memory_usedby_Sqlserver_MB =72720 mb.

somehow it is confirmed that SQL Server is not using configured memory. 
How to make sure the sql server using high memory? please help. I need to ressolve this as soon as possible.

Thanks,
Jo


pols

Index Optimize SQL Scheduled Job failing every week

$
0
0

Hi,

Does anybody knows how to dig into deeper to troubleshoot below issue? We have a scheduled weekly Index Job maintenance is there and past 5 weeks this job keep on failing due to below reason. Kindly suggest your valuable information to fix this issue.

Recovery model: SIMPLE
Msg 1222, Level 16, State 51, Server Azure\SQL1, Line 1
Lock request time out period exceeded.
Msg 50000, Level 16, State 1, Server Server Azure\SQL1, Procedure IndexOptimize, Line 631
The system tables are locked in the database [JSP].

Regards,

DBA


DBA

How to check the Execution plan of running query by different user

$
0
0

Hi

Can we check Execution plan of running query by different user on sql server database? If it is possible, can you plz post a query to check execution plan of a query running on particular Spid.


Thanks
Vinodh

Invalid drive specification

$
0
0

Dear All,

      I get the following error message when trying to copy over files over to another location using XCOPY:

       Message Executed as user: [user email] . Invalid drive specification  0 File(s) copied.  Process Exit Code 4.  The step failed.

Here is the code

XCOPY D:\SQL_Data\MSSQL\DocumentsBackup\* \\Documents\Backups /D /I /S /C /Y

  1. I have checked that the required folders exist on both locations
  2. Checked that both locations can be accessed

 

   Is there anything else I'm missing as I'm still getting the same error message please?

 

    Thank you in advance!

SQL 2016: Syscommittab - Cleanup Single Transaction Results in significant log run up.

$
0
0
Good Morning All,

Question: Alternate ways to cleanup syscommittab.

Situation:
An abused Change Tracking implementation established pre version upgrade and patching to (13.0.5233.0) and upon removing high transaction side-table resulted in several billion record delete, single transaction upon sys.syscommittab.

Specifically after discontinuing change tracking on the most egregious offending dataset (tens of millions of transactions daily) we found log runup to the order of a terabyte per billion records in sys.syscommittab.  I believe this is a product glitch in how the table is cleaned up and was looking for suggestions beyond what is outlined in cleaning up the side table (e.g. discontinuing change tracking on the offender essentially drops the side table hence no need to clean it up.  Should not side table are the "sys.change_tracking_ObjectID" tables.).

We were contemplating purging in an organized fashion (not in a single transaction as the system was doing but rather in reasonable chunks) directly the sys.syscommittab table.  Specifically we would target records beyond the retention period.  This is after we have performed side-table cleanup such as outlined in https://blogs.msdn.microsoft.com/sql_server_team/change-tracking-cleanup-part-1/.

To add to my question above, has anyone attempted this and if not any thought on what we might expect would be helpful.

Version: SQL Server 2016 Standard SP2 CU4 (13.0.5233.0)
Logging: Full and Mirrored.

Log runup problem has been mentioned numerous times in this and other forums.  It wasn't until we had a very large log run up event that we started to dig to diagnose the problem.

Compounding Symptoms: Checkpoint blocked by "Task Scheduler" which was actually performing the syscommittab cleanup and "CtCleanupTblMetadata".  The process that drove up a pair of log files to their maximum, approximately 4.1 terabytes, then rolled back.   We couldn't add on additional log files to the database to mitigate the 2TB limit per file due to checkpoint being blocked by the syscommittab process.

Thank you in advance for any assistance.

SQL Instance Collation - Language Neutral Required

$
0
0

SQL'ers

I am not new to SQL but have run into a question about Language Neutral collation.

We are building an instance for SQL Server 2008 R2 and the main purpose is for an application that is stating that the DB ( and it would be best at the instance level as well) should be built with a  case-insensitive, accent-insensitive, and language neutral collation.  We normally use SQL_Latin1_General_CP1_CI_AS so that would not totally work. The proprietry application indicates 'SQL_Latin1_General_CP437_CI_AI' as an example. Obviously that is case- insensitive and accent-insensitive. What is puzzling me is "language neutraul" - never had to deal with that one. So, is it safe to say that the common collation that many use 'SQL_Latin1_General_CP1_CI_AS' is NOT language neurtral? 

Thanks MG

dm_os_waiting_tasks and dm_exec_requests have different wait_type

$
0
0

I use the following sql script to get the current waiting sql processes.

SELECT dm_ws.wait_duration_ms,
dm_ws.wait_type,
dm_es.status,
dm_ws.resource_description,
OBJECT_NAME(dm_t.objectid, dm_t.dbid) Object,
dm_ws.session_ID,
dm_es.cpu_time,
dm_es.memory_usage,
dm_es.logical_reads,
dm_es.total_elapsed_time,
dm_es.program_name,
DB_NAME(dm_r.database_id) DatabaseName,
dm_ws.blocking_session_id,
dm_r.wait_resource,
dm_es.login_name,
dm_r.command,
dm_r.last_wait_type,
dm_r.wait_type AS request_wait_type
FROM sys.dm_os_waiting_tasks dm_ws
INNER JOIN sys.dm_exec_requests dm_r ON dm_ws.session_id = dm_r.session_id
INNER JOIN sys.dm_exec_sessions dm_es ON dm_es.session_id = dm_r.session_id
CROSS APPLY sys.dm_exec_sql_text (dm_r.sql_handle) dm_t
CROSS APPLY sys.dm_exec_query_plan (dm_r.plan_handle) dm_qp
WHERE dm_es.is_user_process = 1

But I found the wait_type values can be different in sys.dm_os_waiting_tasks and sys.dm_exec_requests for the same session_id, e.g.

Can anyone tell me why?

How to monitor store procs failures?

$
0
0
What are the best practices to monitor store proc failures at the web app level?

SQL Server 2019 on Ubuntu 18.04 - Error - "Unable to open physical file" on d:\ drive

$
0
0

After installing mssql-server on ubuntu 18.04 from this repo -- packages.microsoft.com/config/ubuntu/18.04/, I startup the instance with command "systemctl start mssql-server.service".  The instance starts and after one minute or so, the server crashes.  I've included the messages found in /var/opt/mssql/log/errorlog:

2019-05-24 19:08:35.64 Server      Microsoft SQL Server 2019 (CTP3.0) - 15.0.1600.8 (X64) 
May 17 2019 00:56:19 
Copyright (C) 2019 Microsoft Corporation
Express Edition (64-bit) on Linux (Ubuntu 18.04.2 LTS) <X64>
2019-05-24 19:08:35.65 Server      UTC adjustment: -4:00
2019-05-24 19:08:35.65 Server      (c) Microsoft Corporation.
2019-05-24 19:08:35.65 Server      All rights reserved.
2019-05-24 19:08:35.65 Server      Server process ID is 28.
2019-05-24 19:08:35.65 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2019-05-24 19:08:35.66 Server      Registry startup parameters: 
-d /var/opt/mssql/data/master.mdf
-l /var/opt/mssql/data/mastlog.ldf
-e /var/opt/mssql/log/errorlog
2019-05-24 19:08:35.66 Server      SQL Server detected 1 sockets with 1 cores per socket and 1 logical processors per socket, 1 total logical processors; using 1 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2019-05-24 19:08:35.67 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2019-05-24 19:08:35.67 Server      Detected 1595 MB of RAM. This is an informational message; no user action is required.
2019-05-24 19:08:35.67 Server      Using conventional memory in the memory manager.
2019-05-24 19:08:35.70 Server      Buffer pool extension is not supported on Linux platform.
2019-05-24 19:08:35.70 Server      Buffer Pool: Allocating 131072 bytes for 113648 hashPages.
2019-05-24 19:08:35.86 Server      Buffer pool extension is already disabled. No action is necessary.
2019-05-24 19:08:36.11 Server      Successfully initialized the TLS configuration. Allowed TLS protocol versions are ['1.0 1.1 1.2']. Allowed TLS ciphers are ['ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!DHE-RSA-AES256-GCM-SHA384:!DHE-RSA-AES128-GCM-SHA256:!DHE-RSA-AES256-SHA:!DHE-RSA-AES128-SHA'].
2019-05-24 19:08:36.13 Server      Query Store settings initialized with enabled = 1, 
2019-05-24 19:08:36.15 Server      The maximum number of dedicated administrator connections for this instance is '1'
2019-05-24 19:08:36.15 Server      Node configuration: node 0: CPU mask: 0x0000000000000001:0 Active CPU mask: 0x0000000000000001:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2019-05-24 19:08:36.16 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
2019-05-24 19:08:36.18 Server      In-Memory OLTP initialized on lowend machine.
2019-05-24 19:08:36.35 Server      CLR version v4.0.30319 loaded.
2019-05-24 19:08:36.39 Server      [INFO] Created Extended Events session 'hkenginexesession'

2019-05-24 19:08:36.39 Server      Database Instant File Initialization: enabled. For security and performance considerations see the topic 'Database Instant File Initialization' in SQL Server Books Online. This is an informational message only. No user action is required.
2019-05-24 19:08:36.40 Server      Total Log Writer threads: 1. This is an informational message; no user action is required.
2019-05-24 19:08:36.41 Server      clflushopt is selected for pmem flush operation.
2019-05-24 19:08:36.41 Server      Software Usage Metrics is disabled.
2019-05-24 19:08:36.43 spid8s      [1]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-05-24 19:08:36.43 spid8s      Starting up database 'master'.
2019-05-24 19:08:36.92 spid8s      24 transactions rolled forward in database 'master' (1:0). This is an informational message only. No user action is required.
2019-05-24 19:08:36.93 spid8s      0 transactions rolled back in database 'master' (1:0). This is an informational message only. No user action is required.
2019-05-24 19:08:37.26 spid8s      SQL Server Audit is starting the audits. This is an informational message. No user action is required.
2019-05-24 19:08:37.27 spid8s      SQL Server Audit has started the audits. This is an informational message. No user action is required.
2019-05-24 19:08:37.54 spid8s      SQL Trace ID 1 was started by login "sa".
2019-05-24 19:08:37.61 spid8s      Server name is 'oliviapc'. This is an informational message only. No user action is required.
2019-05-24 19:08:37.63 spid8s      [4]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-05-24 19:08:37.64 spid10s     [32767]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-05-24 19:08:37.64 spid24s     Always On: The availability replica manager is starting. This is an informational message only. No user action is required.
2019-05-24 19:08:37.64 spid24s     Always On: The availability replica manager is waiting for the instance of SQL Server to allow client connections. This is an informational message only. No user action is required.
2019-05-24 19:08:37.65 spid10s     Starting up database 'mssqlsystemresource'.
2019-05-24 19:08:37.65 spid8s      Starting up database 'msdb'.
2019-05-24 19:08:37.67 spid10s     The resource database build version is 15.00.1600. This is an informational message only. No user action is required.
2019-05-24 19:08:37.72 spid8s      Failed to get the volume information, -1073741772
2019-05-24 19:08:37.73 spid8s      Error: 17204, Severity: 16, State: 1.
2019-05-24 19:08:37.73 spid8s      FCB::Open failed: Could not open file d:\dbs\sh\sprc\1205_155146\cmd\41\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf for file number 1.  OS error: 2(The system cannot find the file specified.).
2019-05-24 19:08:37.75 spid8s      Error: 5120, Severity: 16, State: 101.
2019-05-24 19:08:37.75 spid8s      Unable to open the physical file "d:\dbs\sh\sprc\1205_155146\cmd\41\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf". Operating system error 2: "2(The system cannot find the file specified.)".
2019-05-24 19:08:37.77 spid10s     [3]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1.
2019-05-24 19:08:37.78 spid10s     Starting up database 'model'.
2019-05-24 19:08:37.84 spid8s      Failed to get the volume information, -1073741772
2019-05-24 19:08:37.85 spid8s      Error: 17207, Severity: 16, State: 1.
2019-05-24 19:08:37.85 spid8s      FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'd:\dbs\sh\sprc\1205_155146\cmd\41\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf'. Diagnose and correct the operating system error, and retry the operation.
2019-05-24 19:08:37.87 spid8s      File activation failure. The physical file name "d:\dbs\sh\sprc\1205_155146\cmd\41\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf" may be incorrect.
2019-05-24 19:08:37.87 spid10s     Failed to get the volume information, -1073741772
2019-05-24 19:08:37.88 spid10s     Error: 17204, Severity: 16, State: 1.
2019-05-24 19:08:37.88 spid10s     FCB::Open failed: Could not open file d:\dbs\sh\sprc\1205_155146\cmd\41\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\model.mdf for file number 1.  OS error: 2(The system cannot find the file specified.).
2019-05-24 19:08:37.89 spid10s     Error: 5120, Severity: 16, State: 101.
2019-05-24 19:08:37.89 spid10s     Unable to open the physical file "d:\dbs\sh\sprc\1205_155146\cmd\41\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\model.mdf". Operating system error 2: "2(The system cannot find the file specified.)".
2019-05-24 19:08:37.96 spid10s     Failed to get the volume information, -1073741772
2019-05-24 19:08:37.96 spid10s     Error: 17207, Severity: 16, State: 1.
2019-05-24 19:08:37.96 spid10s     FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'd:\dbs\sh\sprc\1205_155146\cmd\41\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\modellog.ldf'. Diagnose and correct the operating system error, and retry the operation.
2019-05-24 19:08:37.98 spid10s     File activation failure. The physical file name "d:\dbs\sh\sprc\1205_155146\cmd\41\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\modellog.ldf" may be incorrect.
2019-05-24 19:08:37.99 spid10s     Error: 945, Severity: 14, State: 2.
2019-05-24 19:08:37.99 spid10s     Database 'model' cannot be opened due to inaccessible files or insufficient memory or disk space.  See the SQL Server errorlog for details.
2019-05-24 19:08:38.00 spid10s     SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.

After posting this question on social_msdn, I was given information to set the filelocation for --

filelocation.masterdatafile

filelocation.masterlogfile

however, there was no information on setting filelocation for 'msdb' and 'model' databases.

Can anyone tell me how I can correct this physical path for 'msdb' and 'model' databases?

Thanks very much.

[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server

$
0
0

I'm connecting to a local version of the SQL database. I've created both entities and want to connect to them but when I try I've gotten a "Server Error in '/' Application," error.

So far I've research the error and cannot tie down where to even begin looking

Line 23:             //ViewBag.Message = message;
Line 24: 
Line 25:             var model = _db.Breweries.ToList();
Line 26: 
Line 27:             return View(model);


Database default for ANSI_NULLS

$
0
0

SQL database has option with defaults ANSI_NULLS off.

is it recommend to set to on ?

Does Distributed AG need windows clustering?

$
0
0

Hi, Simple question - Does distributed AG need windows clustering?

------

From https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/prereqs-restrictions-recommendations-always-on-availability?view=sql-server-2017

"SQL Server 2016 introduces distributed availability groups. In a distributed availability group two availability groups reside on different clusters."

---

So looks like it does need windows clustering right?

---

Reason i ask is we have a main server where clustering is there & we have setup AG. Now, there is another stand-alone (no windows clustering) server which is to be used for reporting, but as it doesn't have windows clustering - we cannot setup AG between the transactional sql cluster & this stand alone reporting sql box with no windows clustering right?

---

just a yes or no with appropriate link will suffice, thanks.


D

Is there a way of Hiding a database from all users (except sa, dba, agent jobs, etc.) without taking it Offline

$
0
0

This is a question that should be applicable to SQL 2008 or above.... and possibly go down to 2005 level, too.

We want to make some old databases invisible to outside users without changing permissions.

You would say - take them OFFLINE …. but that causes some issues with Ola's maint job scripts; primarily index stat jobs.  (because some or one dmv generates error if only one db is offline on the server)

Any practical ideas?

Lovely Cornelia from Boston

Permissions for web services account

$
0
0
I'm trying to secure the web services account that connects to the web app. I wanted to know what is the best practice for what permission the account should have? Should the web services have execute all or should the access be limited?

I've tried to limit the access by assigning only the store proces and schema it needs but that requires updating the access every time a new store proc is added. Is this best practice or should the account just have execute all?

Thread starvation

$
0
0

Error 17189 Server failed with error code 0xc0000000 to spawn a thread to process a new login or connection. Check the SQL Server error log and the Windows event logs for information about possible related problems. [CLIENT: <I P Address >]"

SQL Version : 2008 R2

CPU : 2 ,Hyperthreading enabled

Memory : 5.5 gb of 7 GB 

I'm observing this error logging sometime in error log , but  there will be complaint from user stating the failure login during error logged.  I do use Idera sql DM third party tool  checking historically  I don't see any spike in CPU /memory on error logged particularly.

My findings .

1. Checked max workers count which seems to be normal.

2. When i queried  select * from sys.dm_os_wait_stats where wait_type='threadpool' below is the resultset

      Waittype  waitingtaskcount  wait_time_ms  max_wait_time_ms signal_wait_time_ms

    Threadpool 28830                2326035           2631                       12

I'm sure this is related to thread starvation issue but i'm not able to track the workers count during the error run time  to pinpoint that the worker threads are not enough.  

Any help to resolve this issue is appreciated !!


SANTHOSH KUMAR

Viewing all 15911 articles
Browse latest View live


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