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

SQL Server Perofrmance

$
0
0

Hi Team,

We opened a case with Microsoft Support with SEV A on 08/30. this about SQL Server 2016 Performance issue.

Working day and night with Microsoft. But no improvement. 

Could anyone help me what is the next plan of action, like can we request microsoft to esclate this to next level?


Find All Client IPs from SQL Server Alert Log

$
0
0

Hello,

I have experience of Oracle database and have a very little experience in SQL Server. 
In our environment multiple SQL Server instances are running, Our IT Security team scan the systems for vulnerabilities and share the reports accordingly. Most vulnerabilities are related to database open access,for Oracle databases we get the client IP from listener's log file and white listed in sqlnet.ora file, 
Now for SQL Server how can I get client IPs from SQL Server alert log (if these client IPs are written in alert log) to implement firewall (for IPs white listing) and what is the way forward?

Regards,
Taoqir


SQL Server: Temporal Table: History table on a different filegroup without defining the schema for history table

$
0
0

Q: Is there a way that the SQL Server creates a history table automatically on a specified filegroup without creating/defining the schema for History table?

Scenario:

  1. Two years back we have enabled SYSTEM_VERSIONING(Temporal Table feature) on nearly 300 existing tables. 
  2. Prior to this we had a custom way of maintaining this feature by using triggers. So we had definitions of both history table and primary table in our Database solution created in Visual Studio 2017.
  3. With the introduction of Temporal Tables feature we have deleted the definitions of history tables from the solution to avoid schema mismatch issues when enabling Temporal feature for both existing and new tables in future.
  4. But we missed a point that the history tables are created on PRIMARY filegroup by default when the definitions of history tables are not created in the solution.
  5. Now, we want to move the existing history tables to a new filegroup,
    also, we want to avoid Brand New table's history table to be created on PRIMARY filegroup again in future.

    Want to achieve this without defining schema for history table, please suggest a way.

    From below example, underlined text is a kind of what I am looking for.
CREATE TABLE dbo.Employee   
(    
  [EmployeeID] int NOT NULL PRIMARY KEY CLUSTERED   
  , [Name] nvarchar(100) NOT NULL 
  , [AnnualSalary] decimal (10,2) NOT NULL  
  , [ValidFrom] datetime2 (2) GENERATED ALWAYS AS ROW START  
  , [ValidTo] datetime2 (2) GENERATED ALWAYS AS ROW END  
  , PERIOD FOR SYSTEM_TIME (ValidFrom, ValidTo)  
 )    ON [FG_MasterData]
 WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = history.Employee ON [FG_HistoryData]));  
* Database deployments are performed on daily basis on dev/test environments and as per the release plan in Production. So, we want this to be implemented with minimal changes and no impact/downtime.

Using SQL Server 2016 SP2 Enterprise Edition


Error while performing index reorganization

$
0
0

Hi All,

Index reorganize job is failing with below error stating - reorganize cannot be performed on indexes where page locks are disabled.

What is the purpose of page locks?

Can index reorganize be performed with page locks disabled?

Do I need to seek permission from app team to enable the page locks?

Thank You.

server_principal_id vs principal_id

$
0
0

Hello!

Can't understand this: when I read the audit file I see that one of the actions is being perfomed under testenterprise\sqlagent (server_principal_name) but this principal does not exist in the sys.server_principals and the corresponding server_principal_id is that of the public role (2):

So
Q1: How come there's server_principal_name but there is not the corresponding principal_id in the sys.server_principals?

Q2: Is it normal that the server_principal_name resolves to the role's principal_id (2) and not into the login's principal_id (which does not exist in this case)?

Thank you in advance,
Michael

SQL Server Auditing : Database Auditing for Windows Groups (AD Groups)

$
0
0

Hello All.

I have been trying to get a solution for this topic..

actually I have already posted this several times but still I didn't receive any solution.

What I am looking .In our Database environment there more than 1000 users , these users are Windows users

and these users are added as members in  several Windows AD Groups based on the DB access requirements.

There are few AD groups which are having Sysadmin server role.

Now the requirements is we need to configure DATABASE AUDIT for those AD groups which are having 'SysAdmin'

Server Role.We need to audit for DML operation (Insert, Update,Delete) for all those AD groups

which are having 'SysAdmin' Server Role. Please let me know what should be the Database Audit configuration

details.I have already tested in different way but I am getting any correct result.



GG



Recommend SQL database backup for db size 1TB

$
0
0
Currently, our NAV 2013 database has been growing up, it about 1TB now and running on SQL server 2008 R2 in windows server 2008 R2 enterprise edition, we would like to check if there any best practice of database backup at this size.

System.Data.SqlClient.SQLError: Exclusive access could not be obtained because the database is in use.

$
0
0

we are facing below error while restoring the database. We wanted to change the path of the database where it was store becuse that was running out of disk space.  

please suggest any way so we can store database and the thing goes running.

System.Data.SqlClient.SQLError: Exclusive access could not be obtained because the database is in use.




Database file grow - while maintenance (updateStats/rebuild)

$
0
0

hi all,

we have table  "TABLE1" contains 1.15billon records.   recently we purge this table by deleting records with required dates, 

now we have records  0.77 billon.

now when ever i made maintenance activity on this below table,  i saw the datafile & file grow upto 250GB,

how  can i handle this?  why this happen?

Maintenance query: (Ola script)

UPDATE STATISTICS [Databsename].[dbo].[TABLE1] [_WA_Sys_00000006_1387E197] WITH FULLSCAN
UPDATE STATISTICS [Databsename].[dbo].[TABLE1] [_WA_Sys_00000004_1387E197] WITH FULLSCAN
UPDATE STATISTICS [Databsename].[dbo].[TABLE1] [_WA_Sys_00000003_1387E197] WITH FULLSCAN
UPDATE STATISTICS [Databsename].[dbo].[TABLE1] [_WA_Sys_00000001_1387E197] WITH FULLSCAN
UPDATE STATISTICS [Databsename].[dbo].[TABLE1] [ix_TABLE1_aid] WITH FULLSCAN
UPDATE STATISTICS [Databsename].[dbo].[TABLE1] [PK_TABLE1] WITH FULLSCAN
ALTER INDEX [PK_TABLE1] ON [Databsename].[dbo].[TABLE1] REBUILD PARTITION = 42 WITH (SORT_IN_TEMPDB = OFF, ONLINE = ON)


PK:  ts,id

Non-clustered index:  aid,ts

 

How to associate the CPU Reads, Duration columns in the DMV dm_exec_query_stats query result with the CPU, reads, duration columns in the Profiler

$
0
0
We can use DMV or profiler to get the execution cost for some queries in SQL Server. but how to assotiate the columns they returned?

For example, we can get CPU, Reads, Duration in Profiler. and can get total_elapsed_time, total_worker_time and total_logical_reads from dm_exec_query_stats. But their values are quite different.

Then how can I convert the values gotten by DMV to the values gotten by Profiler?


SQL Managed Backup Log Events

$
0
0

Hello,

I have a couple of virtual machines in Azure that run SQL.  Recently I noticed that Managed Backups were not being performed.  I would like to be alerted that a Managed Backup has failed to run.  I am wondering if anyone knows of an Event ID either from any of the following that indicates that a backup failed:

  • VM Application Log
  • VM System Log
  • Azure Log Analytics (OMS)
  • Some other location

If I know an Event ID then I can take the appropriate steps to setup notifications and remediation.

Thank you for any help you might be able to provide,

Matt

SQL Dump

$
0
0

Hi,

I copiend SQL Dump file from PROD server to my laptop and while i try to run i am getting below warnings:

Unable to load image H:\MSSQLSERVER\MSSQL13.MSSQLSERVER\MSSQL\Binn\sqllang.dll, Win32 error 0n2
*** WARNING: Unable to verify timestamp for sqllang.dll
*** WARNING: Unable to verify checksum for mscorlib.ni.dll
*** WARNING: Unable to verify timestamp for sqlservr.exe
*** WARNING: Unable to verify timestamp for sqldk.dll
*** WARNING: Unable to verify timestamp for sqlmin.dll
*** WARNING: Unable to verify timestamp for IpcMonitor64_13.2.0.10.0.542191.dll
*** WARNING: Unable to verify timestamp for hkengine.dll
*** WARNING: Unable to verify timestamp for qds.dll

Failed to run resource governor classifier user-defined function

$
0
0

Hi.

When I use Resource Governor, Sometime I see an error:

2019-08-28 15:19:00.38 spid151     Process ID 153 was killed by hostname SERVERNAME, host process ID 6252.
2019-08-28 15:19:00.38 spid153 Error: 10982, severity: 16, state: 1.
2019-08-28 15:19:00.38 spid153 Failed to run resource governor classifier user-defined function 'dbo.RGGroup'. Last error 3602, state 135. See previous errors in SQL Server error log from session ID 153 for details. Classifier elapsed time: 0 ms.

RG settings see below:

Function:

CREATE FUNCTION [dbo].[RGGroup]()
RETURNS SYSNAME
WITH SCHEMABINDING
AS
BEGIN
DECLARE @WorkloadGroup AS SYSNAME
SELECT TOP 1
       @WorkloadGroup = 
	  CASE
                            WHEN IS_SRVROLEMEMBER ('rgAdminUsers') = 1
                                THEN 'PoolAdminUsersGroup'
                            WHEN IS_SRVROLEMEMBER ('rgDWHUsers') = 1
                                THEN 'PoolDWHUsersGroup'
                            WHEN IS_SRVROLEMEMBER ('rgDNSUsers') = 1
                                THEN 'PoolDNSUsersGroup'
                            ELSE 'default'
                        END;

RETURN @WorkloadGroup
END

Pools:

CREATE RESOURCE POOL PoolDNSUsers 
WITH (  
     MIN_CPU_PERCENT = 0,  
     MAX_CPU_PERCENT = 20,  
     CAP_CPU_PERCENT = 20,       
     MIN_MEMORY_PERCENT = 0,  
     MAX_MEMORY_PERCENT = 20  
      );  

CREATE RESOURCE POOL PoolDWHUsers 
WITH (  
     MIN_CPU_PERCENT = 0,  
     MAX_CPU_PERCENT = 90,  
     MIN_MEMORY_PERCENT = 0,  
     MAX_MEMORY_PERCENT = 90  
      );  
	 
CREATE RESOURCE POOL PoolAdminUsers 
WITH (  
     MIN_CPU_PERCENT = 0,  
     MAX_CPU_PERCENT = 100,        
     MIN_MEMORY_PERCENT = 0,  
     MAX_MEMORY_PERCENT = 100  
      );  

USE [master]
GO

/******  ******/
CREATE WORKLOAD GROUP [PoolDNSUsersGroup] WITH(group_max_requests=0, 
		importance=Medium, 
		request_max_cpu_time_sec=0, 
		request_max_memory_grant_percent=25, 
		request_memory_grant_timeout_sec=0, 
		max_dop=0) USING [PoolDNSUsers], EXTERNAL [default]
GO

/******  ******/
CREATE WORKLOAD GROUP [PoolDWHUsersGroup] WITH(group_max_requests=0, 
		importance=Medium, 
		request_max_cpu_time_sec=0, 
		request_max_memory_grant_percent=40, 
		request_memory_grant_timeout_sec=0, 
		max_dop=0) USING [PoolDWHUsers], EXTERNAL [default]
GO
/******  ******/
CREATE WORKLOAD GROUP [PoolAdminUsersGroup] WITH(group_max_requests=0, 
		importance=Medium, 
		request_max_cpu_time_sec=0, 
		request_max_memory_grant_percent=100, 
		request_memory_grant_timeout_sec=0, 
		max_dop=0) USING [PoolAdminUsers], EXTERNAL [default]
GO

RG:

USE [master]
GO

ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION = [dbo].[RGGroup]);
GO

ALTER RESOURCE GOVERNOR WITH (MAX_OUTSTANDING_IO_PER_VOLUME = DEFAULT);
GO

ALTER RESOURCE GOVERNOR RECONFIGURE;
GO

Requests are killed under the account, which falls into the pool "PoolAdminUserGroup".

When Resource Governor is disabled - all fine.

What could be the problem?

Replication Issue

$
0
0

Hi All,

There is replication setup between SQL & Aurora in our environment. And its reported that the data is not matching between them. I have less experience in troubleshooting SQL replication issues. Also have no idea on sql-aurora replication setup& how it works.

The publisher & distributor is a SQL DB and subscriber is an Aurora DB in this case. I could just see the log reader agent running on SQL. Replication type - transactional replication.

Verified the below:

Checked the log reader agent status - its running fine. And every time I refresh I could see the updated time in the last action time with message as '1 transaction with 1 command delivered'. Also I see lot entries stating''approximately xxx log
records have been scanned n pass #4, 0 of which were marked for replication".
No other errors found under log reader history & also could see the 'xact_seqno' which gives the transaction number of last processed transaction continuously changing.

Under replication monitor, its not showing the subscription details as the subscriber is Aurora. So unable to verify any issues from distributor to subscriber end. Unable to check the no.of undistributed commands as well.

Seems there is a job running in Aurora which pulls the data & its in not working.

Could someone let me know what should be cause for data not being replicated & also tell me the other checks that needs to be done from SQL or Aurora end on this.

Thank You.

How to track the difference data column while comparing with 2 tables having same column names

$
0
0

I have 2 tables Snapshot table and temptable. temptable is holding copy of snapshot table before snapshot gets incremental load. My objective is to pull the Rowid & column and value which ever has difference compare to each other.

So I need Some code or the ways or articles to implement this.

Snapshot Table:

RowIDObject Column2 Column31            Jack   USA2            Ryan   GER

Temp Table:

RowIDObject Column2 Column31            Jack   USA2            Ryan   GER

Snapshot Table After Incremental load

RowIDObject Column2 Column31            Jack   UAE2            Ryan1   GER

I want to hold in a new table

RowID ColumnChanged ActualValue Updated Value1       Column3       USA         UAE2       Column2       Ryan        Ryan1

Note: I am using Azure SQL DB.


Performance counters missing for single database

$
0
0

Hi,

Performance counters are missing for a single catalog within my sql server instance.  I can see all the counters I expect to see, but in the list of instances, one catalog is missing.

For example, the "Data file size" counter is not available for this catalog.

I have tried unloading and reloading the counters as per various articles, but it made no difference: the catalog remained missing.

The catalog was created a week ago, but is completely standard.  In addition, I have created other catalogs in the same way in the past 3 months without this problem.

How can I resolve this?  It is a problem because we have 24/7 counter monitoring, which is now turned into 24/7 email alerting about counters missing...

Thanks for your help,

Question on audit

$
0
0

Hello,

The goal: to audit creating new server logins

The solution: create the SERVER_PERMISSION_CHANGE_GROUPaudit specification as described here

My actions:

1) create a new audit

2) create the new audit specification:

3) Enable 1 and 2
4) Create a new server login:

5) Query the audit file:

- No events after creating a new login...

On contrary, using GRANT operator gets registered in the log:

Why the creation of the new login has not been registered in the log?

Thank you in advance,
Michael

Questions on SQL Audit

$
0
0

Hello!

Thisdocument says:

"The SQL Server Audit feature enables you to audit server-level and database-level groups of events and individual events."

...and it does contain the list of atomic events but only for the database-level audit (Database-Level AuditActions) - for server-level audit there's only the list of action GROUPS (Server-Level Audit ActionGroups) and the audit server operation event classes are given for each audit group instead, for example:

SERVER_OPERATION_GROUP This event is raised when Security Audit operations such as altering settings, resources, external access, or authorization are used. Equivalent to theAudit Server Operation Event Class.

Anyway I don't seem to understand how the class description corresponds to the contents of the audit events being registered (event 33205) so

Q1: Is there a way to audit server-level actions instead of action groups?

Q2: Does any documentation on how to parse the audit event 33205 exist ?

Thank you in advance,
Michael

DB stuck in restoring

$
0
0

Hi guys, 

I have a db which is in restoring state, the restore started 20 hours ago. Usually the restore takes only one hour. If I run 

select * FROM sys.dm_exec_requests r CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) a 

I retrieve nothing. I guess that is something to do with the space allocation r with the auto-growth but I can access the db to check the setting.

Question 1: In order to stop the restore shall I stop SQL? Delete the db and restore it again?

Question 2: Is there a way to check the percentage restored (if there is any)?

Many Thanks

SQL Server Perofrmance

$
0
0

Hi Team,

We opened a case with Microsoft Support with SEV A on 08/30. this about SQL Server 2016 Performance issue.

Working day and night with Microsoft. But no improvement. 

Could anyone help me what is the next plan of action, like can we request microsoft to esclate this to next level?

Viewing all 15264 articles
Browse latest View live


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