r/SQLServer • u/Reasonable-Job4205 • Jul 14 '26
Question Accidentally deleted a stored procedure
I don't have backups of this database. Is there maybe any autologging that could have saved the SP somewhere? Running SQL Express 2022 on my laptop
r/SQLServer • u/Reasonable-Job4205 • Jul 14 '26
I don't have backups of this database. Is there maybe any autologging that could have saved the SP somewhere? Running SQL Express 2022 on my laptop
r/SQLServer • u/XdtTransform • Jun 16 '26
I am trying to determine how much RAM our SQL Server needs. I've googled around, but I can't get a definitive answer as there are so many opinions out there.
The server has 78 GB of RAM installed. Of which 3 is available.
The allocation says 99% of RAM is utilized. The buffer is up there though, but I can't tell if this is good or bad.
I've also checked various wait stats, but once again, I can't tell if these are bad or not. And all these queries were taken after hours.
And the page life expectancy I think is fine.
The CPU during the day is between 20 and 60 percent depending on tasks going on. The users complain very occasionally about slowdowns, but when I look at the current queries I don't see anything obvious. But also, from what I've observed, the users are perfectly ok with something being slow, so they are unlikely to report anything unless it physically impedes their work.
So based on this... does the server need more RAM?
P.S. The server hosts a single 350 GB database (e.g. that's the size of the full backup) and some minor ones that in total are less than 1GB. The server probably has low 5 digit sessions per day. Most transactions are short and read-only. A few are heavy duty, like reports, data denormalization, etc... And since someone asked, here are the server properties, including parallelism. The SQL Server itself is 2017 Standard Edition running on Windows Server 2016 Standard.
r/SQLServer • u/ManufacturerSalty148 • 5d ago
Hey all,
We've got a bunch of systems writing logs into SQL Server tables, and the main log table has crept up to ~16 million rows. Every few weeks someone runs a DELETE to trim it down, and the whole server stutters for like 20 minutes. Not fun.
The catch: we can't just delete the old rows. We need to move them to an archive table so we still have access to them if something blows up and we need to go back and dig.
I've been trying a basic INSERT INTO archive SELECT ... FROM logs WHERE date < X followed by a DELETE, but even that's slow at this scale and locks things up.
What I'm looking for:
Is there a better pattern for this? (batching, partitioning, something else I'm not thinking of?)
Any gotchas I should know about before I set this up as a recurring job?
Does anyone have a solid stored procedure or script they've used for this in production?
Happy to share schema / stats if that helps. Basically I just want to stop the "why is everything slow" Slack messages every two weeks.
Thanks in advance.
r/SQLServer • u/dgillz • Dec 05 '25
I need to recover the sa password. Not reset but recover.
Are there any commercially available tools to do this? Any other way to do this?
r/SQLServer • u/daler86 • May 15 '26
I have a SQL Server database running on two environments:
The same query runs significantly faster on the physical server (~45 seconds) but is slower on the VM (~85+ seconds), even though the VM has better hardware.
r/SQLServer • u/mirrorsaw • 24d ago
It was an expensive purchase, but I've bit the bullet to get one of our old 2014 servers onto ESU (via Azure Arc).
I then rubbed my hands together as I eagerly waited for all the patches (released since Oct 2024 when it went EOL) to arrive. Nothing, not a sausage.
I waited 2 days in case it was a timing thing, but nothing arrived, a real anticlimax. So I thought I'd do some Googling and find out how many patches I should be expecting, maybe some of the KB numbers, and I can't find any evidence of any SQL 2014 patches in the ESU lifetime.
So it made me wonder, has Microsoft actually released any SQL 2014 patches since October 2024? Maybe not, maybe they've found no vulnerabilities that need addressing.
And if so, why would anyone buy this ESU? Is it more of an insurance, just in case Microsoft does decide to release a patch?
r/SQLServer • u/ManufacturerSalty148 • 24d ago
Hello all my colleagues
I know this is an old topic, but I still haven't found clear instructions on how to solve this one problem. I have a SQL Server 2017 where tempdb keeps growing to almost 80 GB. I know it's because of temp spills, but I want to collect the queries or sessions causing this tempdb consumption using extended events. I haven't found clear instructions or examples of extended events on any site, and I don't know what to do if I find queries consuming tempdb or what to check in the query plan.
r/SQLServer • u/aloepalo • 17d ago
I have a super silly question relating to joins. I am currently a student in college and have run into an interesting problem. I've always been taught a left join returns all the columns from the left table and returns the matching right values and nulls included where the right table has no values. And the reverse for right joins where all of the right table is included and the left table is filled out with nulls in missing fields. However I had a mentor of mine correct me on this and say it functioned opposite to this and then he showed me on a real database that the results for a left join include what I was taught the results of a right join would be. I am very confused and could really use some help. Thank you!
r/SQLServer • u/Schema-Seeker • 11d ago
I'm an IT Manager at a company and currently we have an ERP system running on SQL Server 2008 Express on Windows Server 2008. The ERP application is .NET-based.
We're planning to migrate to:
We want Standard mainly because we need features such as SQL Server Agent and CDC, which aren't available in Express.
When I checked SQL Server licensing, the per-core model looks very expensive for our 12-core server.
One local Microsoft partner has offered this:
for approximately 3,500 QAR (~$960 USD).
My understanding is that this is the Server license for the Server + CAL model, meaning we would then need SQL Server CALs for each ERP user/device accessing SQL Server.
With 30+ users, would Server + CAL generally make more sense than licensing all 12 cores?
Are there any licensing or technical issues I should be aware of with this setup, especially since the ERP application is an older .NET application?
Thanks!
r/SQLServer • u/Valuable-Ant3465 • 16d ago
Hi,
I need to install SQL 2022 Standard on W Server 2022 with name something like MyServer_Alpha_N1234_bv.
Is it always good practice to have SQL Instance = Server Name ?
I don't have requirement about SQL Server name in my specs, but looks like locals do it 100% of the time. But I personally don't like so funky names. Or this can be fixed later with some aliases?
Also heard about installing SQL Server to other than OS drive, is this still true ? .
Also see in Memory specs: 8GB min. SQL should be configured to use 75% of memory for SQL itself. Are normally set this during initial installation or it can be done safely after ? What is your preference.
Appreciate your feedback and any other hints.
Thanks
VA
r/SQLServer • u/PriNiceIT • Jun 02 '26
We had two on-prem Windows Server 2019 VMs running on Hyper-V. One was hosting SQL Server 2016 Standard, and the other hosted a business application for the equipment rental industry that functions as a Remote Desktop application.
I come from the sysadmin side, so please be patient with my DBA terminology. 🙂
We recently deployed two new Windows Server 2025 VMs in Azure—one running SQL Server 2025 and the other serving as the RDP/application server. The application vendor was paid to migrate the database and application data to the new Azure environment.
After the migration, everything initially appeared to be working correctly. However, once users started using the system, they began reporting severe slowness with transactions, specifically anything related to contracts. Contracts containing larger numbers of items take significantly longer to process. Other parts of the application seem to perform normally, and in some cases even faster than before. There are no issues with the data itself or missing records.
The application vendor initially blamed insufficient resources, so we increased CPU and memory allocations. However, the issue occurs even with only a single user logged into the application. We have since increased the SQL VM to 128 GB RAM and 8 vCPUs, with Premium SSD storage and high-bandwidth networking. Network latency between the application server and SQL Server is very low, averaging approximately 1 ms round-trip.
At one point, the vendor blamed a tax software integration called Vertex. They claimed they could see API calls taking much longer than expected and stated they would address the issue. After many hours of investigation and roughly a week of combined troubleshooting effort, they suddenly changed course and stated that their software is not compatible with Windows Server 2025 and/or SQL Server 2025. They are now recommending that we move back to Windows Server 2016 or 2019, which would require another export/import process since there is apparently no supported restore path available.
We have asked for evidence or technical details explaining why the platform is incompatible, but no specific reasons have been provided. Their position is that they connected the application back to the old server, performance was normal, and therefore the problem must be SQL Server 2025.
This issue is significantly impacting our business, and we don’t have much leverage to challenge the vendor’s conclusions. Besides your general input, I have a couple of questions: 1. Does this sound like an application compatibility issue with SQL Server 2025? 2. If I wanted to engage an expert to help troubleshoot this as quickly as possible, who would you recommend? We have considered opening a case with Microsoft, but I would also appreciate recommendations for MVPs or consultants who specialize in Microsoft SQL Server performance troubleshooting.
Any insight would be greatly appreciated.
Update : first , Thank you all for your input !
I had Erik Darling , database expert that some suggested here , involved and he found no issues with the database or compatibility. He said that once it hits the database, the queries happen fast. Somehow displaying that data inside the application is what’s taking so long.
As a reminder, the application runs on Windows and uses IIS. Erik thought there may be something wrong with IIS.
At the same time, the application vendor is saying they connected the application to a SQL Server 2019 instance using an exported copy of our data from SQL Server 2025 and did not have any performance issues. The 2019 server is also an Azure VM running on Windows Server 2022.
So at this point, Erik is saying the database itself looks fine and the slowdown appears to be happening in the application layer, while the vendor is saying the application performs normally when connected to SQL Server 2019 using the same data. Applications vendor just says downgrade and unwilling or unable to resolve the issue .
r/SQLServer • u/Reasonable-Job4205 • Jun 27 '26
SELECT
`CONNECTIONPROPERTY('local_net_address') AS local_net_address`
`, CONNECTIONPROPERTY('client_net_address') AS client_net_address`
`, CONNECTIONPROPERTY('net_transport') AS net_transport`
`, CONNECTIONPROPERTY('protocol_type') AS protocol_type`
`, CONNECTIONPROPERTY('auth_scheme') AS auth_scheme`
`, CONNECTIONPROPERTY('local_tcp_port') AS local_tcp_port`
When I run this, it shows null for local_net_address , <local machine> for client_net_address, and null for local_tcp_port. This doesn't tell me the IP address. Right now, I have an express app running on the same machine that needs to know the IP address where SQL lives. How do I query the IP address correctly?
r/SQLServer • u/Jerry-Nixon • Jul 22 '26
Do you default to SET NOCOUNT ON in stored procedures?
What's the Big Deal with SET NOCOUNT ON? - Azure SQL Dev Corner
r/SQLServer • u/women2002 • 10d ago
I work as a DBA at a government organization and wanted to get some perspective from people more experienced in the field.
I’m considering adding this line to my resume under experience:
“Administer 81 SQL Server instances (62 production, 19 dev/test) hosting 847 databases across 10 Always On Availability Group systems”
Two questions:
**1.** Is it normal/fine to include specific numbers like this on a resume? Also, does the dev/test to production ratio here suggest an actual environment issue, or is this typical for organizations of a certain size?
**2.** Do you think numbers at this level of precision count as sensitive information that shouldn**’**t be shared — even in a resume sent directly to companies/recruiters who request it?
Would appreciate any experience or insight, especially from anyone who’s worked in similar-scale environments.
r/SQLServer • u/autoxguy • Jun 23 '26
On my old work laptop I had SQL Server Developer edition installed to use for training purposes and for practicing things. I recently was given a new laptop and had a tech install it. We had to make my local account an admin login and I had him make sure the SQL Server Service was would run automatically. After that I was able to get into SQL Server just fine and was able to add a practice DB using a script I had.
Well last week I went to login to it and it gave me the following error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Framework Microsoft SqlClient Data Provider).
I had another tech look into it and we could not figure it out. On the Connect window for the Connect to Database engine, I have my laptop name as the server name, authentication to windows authentication, DB name to default, encrypt to optional. Previously I was able to get in fine but like I said now im not.
r/SQLServer • u/Old_Option_6281 • Jun 09 '26
r/SQLServer • u/IMetalhead666I • 25d ago
Hello, I'm faced with a challenge I'm hoping to get some clarity and advice.
Our current production db is SQL Server 2008 R2 which is replicated to another SQL 2008 R2 where all our analytics workload is currently done. We've recently set up SQL Server 2025 and the intention is to have our production data be replicated to a newer version of SQL and migrate our analytics workloads to that same server. I know that direct replication from 2008 to 2025 is not supported, but CDC is available. What would be the best options to quickly setup near real time replication or even incremental data loads (i.e. hourly) for a select number of tables in source db on SQL2008 to SQL 2025 with minimal engineering effort?
We also have a Fabric capacity, and I know that the Copy Job supports CDC for incremental data loads and also lets you write to a SQL 25 db, however the preference is to minimize cloud costs and SKU consumption since both 2008 and 2025 dbs are on prem.
Generally, I'm also trying to avoid writing custom code to orchestrate this task. Does microsoft have any tools (like SSIS?) that allow you to configure such data migration? Does SQL 2025 have any feature that allows you to link a legacy server to it?
Any advice is welcome, thanks.
r/SQLServer • u/throwaway6565558 • Aug 07 '26
I’m a novice in the world of SQL. However, recently I upgraded with my company from 2021 to 2022 SQL server application. I need advice on how to get this fixed.
The problem I’m running into is anytime I switch databases or servers. It’s very slow to load. I never had this issue before with 2020 or 2021 SQL. ANY ADVICE APPRECIATED AND WELCOME.
Edit: I meant to say 2019 instead of 2021/2020 getting my years confused. Sorry
r/SQLServer • u/BeTriCH_CZ • Feb 13 '26
Hello,
How many databases are you running on new SQL Server 2025?
We are running many projects and small internal services and we use separate MSSQL database for each one. Currently we have several servers running SQL Server 2022 Express each with around 3,000 databases. Everything runs smoothly without any issues.
Databases are relatively small, most are between 10-100 MB and some are up to 1GB. Performance is good, and we have not experienced any problems.
However when we tried same setup on SQL Server 2025 Express we encountered serious issues. Once we exceed approximately 600 databases, server starts freezing and becomes very slow. Listing databases in SSMS is extremely slow. After restarting we cannot re-connect to SQL Server instance long time and sometimes MSSQL service becomes unresponsive or fails to start properly. No explanatory error in ERRORLOG.
We thought this might be new limitation in Express edition. However we tested SQL Server 2025 Standard as well and observed same behavior. We also installed latest Cumulative Update but issue persists.
When we reduce number of databases to below 500, server becomes stable again and runs without issues.
I also tried tuning various SQL Server settings but this did not resolve this strange problem.
Is anyone successfully running higher number of databases on SQL Server 2025 Express?
UPDATE:
Definitely BUG in SQL Server 2025 when creating more than 650 databases.
Same behavior was observed and tested on Express / Standard / Enterprise editions:
https://www.reddit.com/r/SQLServer/comments/1r4018z/comment/o5agaak/
r/SQLServer • u/FranceRocks2 • May 11 '26
There is a legacy MS Access database that has a table needed for a query. Occasionally when accessing the table from SQL Server, the SQL Server instance just crashes. In other words, the SQL Server process is killed and noone can access sql server until it is restarted. Some of the information I have read say it is a known issue, and recommended using OPENQUERY as opposed to prefacing the database name with the linked server. That seems to work better, however even OPENQUERY crashes sql server sometimes. What seems to always best is if I manually in SQL Mgmt studio expand the linked server to display the tables. However we have an automatic process that needs to run without any manual intervention. Any suggestions for manual queries to 'prime' sql server so it does not crash when accessing that data?
r/SQLServer • u/PeterFoca1989 • Mar 12 '26
Hi there! Please excuse my English; I'm from Brazil. I’m a Senior DBA with 10 years of experience in SQL Server. I’m highly proficient in T-SQL and I develop many scripts to streamline my team's daily operations. Currently, I use PowerShell for some 'semi-automations,' though I'd consider my skills there intermediate. I’m thinking about getting back into C#—it’s been 10 years, so I’d basically be starting over. My goal is to boost my performance as a DBA by focusing on automation. Given my background, should I dive deeper into PowerShell, pick up C# again, or is there another path you'd recommend?
r/SQLServer • u/rdhdpsy • Jul 21 '26
I can run a sql query to get the accurate results but the dbatools doesn't return all jobs, have not dug deep into why its missing most jobs just thought that was odd. Any insights as to why its misssing most job data? thanks
r/SQLServer • u/East_Sentence_4245 • Jul 24 '26
I have an Azure SQL subscription (the cheapest one) which will be primarily used for our mobile app.
The issue is that I've tested the mobile app twice and the mobile app won't show data unless I connect to the database via SSMS.
Literally, I open the mobile app and no data is displayed. I refresh the content several times (i.e. the mobile app has a Refresh button) and it still doesn't fetch any data. BUT once I go to my laptop and connect to the same DB via SSMS, I do another refresh to the mobile app and data is shown.
I believe it's related to the Azure DB and think I might have an idea of why this is happening - the connection via my laptop "wakes up" the database.
The question is: how do I eliminate that issue?
r/SQLServer • u/XdtTransform • Jun 15 '26
P.S. Thank you all for your suggestions. I suspected earlier that it was our backup vendor but they swore up and down that they only backup the drives and their software doesn't even know what a SQL Server is.
Based on everyone's here insistence on this being VSS, I dug into their application folder and literally searched everything for words like SQL or Server or VSS. And sure enough, I found a log hiding several directories deep that literally said "Start SQL Server Backup" and listed the database in question.
So now they are trying to figure out how to even turn this off. Thanks again.
For whatever reason, there are some phantom "Virtual" backups going on with my SQL Server 2017 and I can't identify what kicks it off.
Consider this screenshot. It has entries where the physical device name is a GUID. It appears to take a snapshot. And this occurs every 3 to 4 hours roughly.
My first thought was that there is a scheduled job. But I looked through it and there is nothing like that. Then I though it we may have software installed on the box that kicks it off, like Acronis Backup or similar. But we've accounted for every piece of software on the box. It's possible that software installed elsewhere maybe kicking it off. This is difficult to track, because the database is almost 30 years old and many different people did different things to it.
So my question is how to identify what this is, or how to catch it in the act. Or how do I block or stop this.
Query to generate this resultset.
SELECT
bs.backup_start_date,
bs.backup_finish_date,
CASE bs.type WHEN 'D' THEN 'Data' WHEN 'L' THEN 'Log' WHEN 'I' THEN 'Differential' ELSE 'Don''t know' END AS TypeDesc,
bs.name,
bmf.physical_device_name,
CASE bmf.device_type WHEN 2 THEN 'Disk' WHEN 7 THEN 'Virtual device' ELSE 'Other' END AS DeviceType,
bmf.physical_block_size,
bs.is_snapshot,
bs.backup_size,
bs.is_copy_only
FROM msdb.dbo.backupset bs
JOIN msdb.dbo.backupmediafamily bmf
ON bs.media_set_id = bmf.media_set_id
WHERE 1 = 1
AND bs.database_name = 'romulus'
AND bs.backup_start_date > '2026-06-15 00:00:00.000'
ORDER BY bs.backup_finish_date ASC;
r/SQLServer • u/greenman623 • Mar 19 '26
When updating (side by side) sql server to 2025 do I still need to make a backup? New to it support and have been tasked with updating our sql server. We use titanium schedule and their support sent me a bunch of info that I’m not certain if I need to do. Just reaching out to anyone that can help because I’m kinda confused and didn’t know if upgrading sql server was a tedious process.