Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
Featured Script
The Voice of the DBA
 

Guidelines and Requirements

I saw a post from Brent that Microsoft had changed the default memory guidance. At first glance I read this as they'd changed the default values, which would be interesting. However, this is a guideline, set to 75%. I also saw a few thoughts from Randolph West on LinkedIn, and quite a few comments. The comments were interesting in a few ways.

It is easy to look at 75% and say that won't work for this server that's on my mind right now because I keep getting woken up. That might be true. However, the 75% number isn't a hard requirement. It's a guideline, a recommendation to ensure you have enough memory for the OS, but you're trying to use most for SQL Server. Feel free to adjust it if you feel the need.

There are certainly people who will also look at that number and then go to a DBA and say, "you've set this to 70% (or 85% or whatever) and that's not what Microsoft says." Which isn't true. What the text says is this under the recommended column: "75% of available system memory not consumed by other processes, including other instances. For more detailed recommendations, see max server memory"

If you go to the "max server memory" section, you see something else. It asks you to monitor before you set this, then do some calculations. Then it says: "This is a generic approximation, and your mileage might vary."

That's a great statement. What they've written might not work for you. That's true. Maybe you have little RAM and some other stuff on your server, so 75% might be way too high. Maybe you have 4TB of RAM, in which case, if you blindly set 75% you should be asked to work elsewhere. Anyone managing systems with 4TB of RAM should know how to monitor, measure, and then choose something different, which might be 85% of RAM.

While there might be some requirements for managing database systems, there really are a lot of guidelines. You have to make decisions, which means you need some knowledge on which to make good decisions. If you don't have that knowledge, or are unsure, ask others, ask the GenAI's, conduct experiments, test things. That's the job. Learn what you need to make things run better.

Better being what your clients need, want, and desire.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 Featured Contents
SQLServerCentral Article

Workspace Identity Authentication for your Power BI Semantic Models in Microsoft Fabric

Koen Verbeeck from SQLServerCentral

This article shows how you can easily create connections in your Power BI workspace that use Identity Authentication to connect to your data.

External Article

SQL Server Triggers for Business Rules Automation

Additional Articles from MSSQLTips.com

The advantage of using triggers is that the same processing can occur regardless of where or how the data has been inserted, updated or deleted. In this article, we look at several examples of where and why triggers could be useful along with an example use case.

Blog Post

From the SQL Server Central Blogs - Power BI dataflow Gen1 needs Gateway to connect to Azure SQL DB

Koen Verbeeck from Koen Verbeeck

I’m in the progress of migrating some legacy stuff at a client, and in their Power BI environment there are still quite some Power BI dataflows Gen1. I had...

From the SQL Server Central Blogs - Cosmos DB vs Traditional SQL: When to Choose What

Chris Yates from The SQL Professor

From where I stand, the decision between Cosmos DB and a traditional SQL database often wants to be chosen between a sports car and a reliable sedan. Both will...

Learn Microsoft Fabric: A practical guide to performing data analytics in the era of artificial intelligence

Site Owners from SQLServerCentral

A step-by-step guide to harness the power of Microsoft Fabric in developing data analytics solutions for various use cases

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

Copying Production Schema

If I use DBCC CLONEDATABASE, can I remove some of the information from the copy?

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

The Duplicate Cursor

Can I run this code:

DECLARE ANewTable CURSOR FOR 
SELECT * FROM ANewTable

Answer: Yes, this works

Explanation: This works. cursor runs The cursor isn't an object in sys.objects. Ref: DECLARE CURSOR - https://learn.microsoft.com/en-us/sql/t-sql/language-elements/declare-cursor-transact-sql?view=sql-server-ver17

Discuss this question and answer on the forums

 

Featured Script

Enables Change Data Capture (CDC) on all user databases

Akash Rathi from SQLServerCentral

This script loops through all user databases, skips system DBs and any you want to exclude, and enables CDC if it’s not already enabled.

-- Replace with the databases you want to exclude
DECLARE @ExcludeList TABLE (DatabaseName SYSNAME);
INSERT INTO @ExcludeList (DatabaseName)
VALUES ('master'), ('tempdb'), ('model'), ('msdb'), ('YourDB1'), ('YourDB2'); -- Add your exclusions here

DECLARE @DatabaseName SYSNAME;
DECLARE @SQL NVARCHAR(MAX);

DECLARE db_cursor CURSOR FOR
SELECT name
FROM sys.databases
WHERE state_desc = 'ONLINE'
AND database_id > 4 -- skip system DBs
AND name NOT IN (SELECT DatabaseName FROM @ExcludeList);

OPEN db_cursor;

FETCH NEXT FROM db_cursor INTO @DatabaseName;

WHILE @@FETCH_STATUS = 0
BEGIN
SET @SQL = '
USE [' + @DatabaseName + '];
IF NOT EXISTS (SELECT 1 FROM sys.change_tracking_databases WHERE database_id = DB_ID())
BEGIN
IF NOT EXISTS (SELECT 1 FROM sys.databases WHERE name = ''' + @DatabaseName + ''' AND is_cdc_enabled = 1)
BEGIN
EXEC sys.sp_cdc_enable_db;
PRINT ''CDC enabled for database: ' + @DatabaseName + ''';
END
ELSE
BEGIN
PRINT ''CDC already enabled for database: ' + @DatabaseName + ''';
END
END
ELSE
BEGIN
PRINT ''CDC already enabled for database: ' + @DatabaseName + ''';
END';

EXEC sp_executesql @SQL;

FETCH NEXT FROM db_cursor INTO @DatabaseName;
END;

CLOSE db_cursor;
DEALLOCATE db_cursor;

More »

 

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.


SQL Server 2016 - Administration
Object owner question - Hello, Currently all of our tables e.t.c are owned by dbo. In one of our databases I need to move the tables to a different owner to prevent an ownership chain. What I'm a bit unsure about is the best type of account to use for the table owner. I think 'user without login' is […]
SQL Server 2016 - Development and T-SQL
Encryption or Certificate - Trying to NOT put hardcoded password in Proc - We have a few stored procs where we need to a dos command "net use" EXEC master..xp_cmdshell 'NET USE \\\ /USER:<domain\username>    /PERSISTENT:yes'   I am trying to figure out a way to retrieve a password stored somewhere that is obfuscated from nefarious people, via encryption or any other way really, So that […]
SQL Server 2019 - Development
Next dates - CREATE TABLE ADMITS ( ID_NUM INT varchar(15) null ,provider_id varchar(15) null ,provider_name varchar(36) null ,ADMIT_DATE DATE NULL ,DISCHARGE_DATE DATE NULL ,swpa_description varchar(max) null ,date_dispensed DATE NULL ,drug_name varchar(max) null ,discharge_to_dispensed int ) INSERT INTO ADMITS (ID_NUM,provider_id,provider_name, ADMIT_DATE, DISCHARGE_DATE,swpa_description,date_dispensed,discharge_to_dispensed) VALUES ('008012773','006467','WHITE DEER RUN LLC', '2024-02-06', '2024-02-11','Residential Detox, Rehab, HWH (non hosp)','2024-02-22','GABAPENTIN, 300 MG ORAL CAPSULE',11) ,('008012773','006467','WHITE […]
Amazon AWS and other cloud vendors
Moving a database from AWS RDS Custom to RDS Standard - Having real fun with this. It isn't possible to set the option group, to enable the AWS SQL backup routines, because you can't execute the CloudShell command to assign an options group (aws rds modify-db-instance), in RDS Custom. I can't restore an RDS Custom snapshot, because that will just create another RDS Custom, and I […]
Reporting Services
2 table designs within one section to keep data for one section value within one - My requirement is to display data for  a number of routes within 2 tables and keep everything in one page where each value for the route generates a new page. I have created a group for route calling it 'sectie1'  and set proper behavior for this sectie (page break, having headers on each page etc). […]
Editorials
Ghostworkers - Comments posted to this topic are about the item Ghostworkers
T-SQL
Backup information incorrect after AAG toggle - Good morning all, I have the attached T-SQL query that has been working well for sometime. This past Saturday during patching, the AAG toggled from primary on server1 to primary on server2. Now the query does not report differentials from the current primary server. Any pointer/suggestions on what I fail to see is greatly appreciated. […]
Backup information incorrect after AAG toggle - Good morning all, I have the attached T-SQL query that has been working well for sometime. This past Saturday during patching, the AAG toggled from primary on server1 to primary on server2. Now the query does not report differentials from the current primary server. Any pointer/suggestions on what I fail to see is greatly appreciated. […]
Article Discussions by Author
Fetch fields like email address from multiple records into single cell - Comments posted to this topic are about the item Fetch fields like email address from multiple records into single cell
Enables Change Data Capture (CDC) on all user databases - Comments posted to this topic are about the item Enables Change Data Capture (CDC) on all user databases
Free T-SQL Script: Database Schema Documentation Generator for Generative AI Services Integration - Comments posted to this topic are about the item Free T-SQL Script: Database Schema Documentation Generator for Generative AI Services Integration
Fetch fields like email address from multiple records into single cell - Comments posted to this topic are about the item Fetch fields like email address from multiple records into single cell
Using psycopg2 to Connect Python to PostgreSQL - Comments posted to this topic are about the item Using psycopg2 to Connect Python to PostgreSQL
SQL Server 2022 - Development
Trying Different CTAs in Car Insurance Ads, Any Tips - Hey everyone, I’ve been experimenting a bit with digital ads for car insurance, and one thing that keeps confusing me is how small changes in call-to-action buttons can really affect clicks. I figured I’d share what I’ve noticed so far and maybe get your thoughts too. Pain Point So here’s the deal. I was running […]
ssms aborting in object explorer details - Hi i just set up a new pc after my touch pad went bad.  our tech guy installed a version of ssms that says its this  SQL Server Management Studio 21.4.12+5.36408.4.  its not the version i used before.   I'm not 100% certain what image he uses to set up a new pc. I'm getting the […]
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

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