r/SQL • • Oct 30 '26

SQL Server MS-SQL What are your best practices to provide 3rd Party Tools like Python Scripts access to your databases?

We have many blackbox MS-SQL Databases which means the databases acts as a backend to some payed applications we acquired. And unfortunately we also have inhouse developers who would really really like to read data from the production databases but because of locking and blocking mechanisms of SQL-Server I would like to avoid that situation by not grating them access to the live databases.

Please tell me if I go the right direction here and how you would solve such situation.

My thinking was that we should have either a clone of the databases by telling the application frontend to write the data seperately to 2 databases one used for reporting while one is used for live production system.

This works for applications which do support that approach however not all do support it on application level.

I heared about log shipping which would be a method SQL-Server itself could provide the tools. What do you think about log shipping on the same SQL Instance if you think that cpu and memory contention is negligible since it should not cause any blocks and locks by just reading?

Database Availability Groups are out of scope since its a Standard Edition of SQL-Server.

Replication maybe would be more efficient if they need the data faster and only some tables out of the whole database.

ETL-Tools: My Question do you think Microsoft Fabric is compareable with a ETL-Tool or would you do other approaches? Since we currently have all the options except Availability Groups however Fabric can be very costly if you have to many datasets and we have some heavier databases where each 15 seconds data could be updated due to part numbers update with many additional data.

Most of these blackbox databases are OT-Databases which collects statistical info from different kind of production machines like Siemens PLC and so on and these informations update very frequently so multiple queries in few seconds like 15s delay per each plc or system.

18 Upvotes

24 comments sorted by

2

u/TheGenericUser0815 Oct 30 '26

Why don't you want them to read prod data directly? What exactly is the problem here?

4

u/luky90 Oct 30 '26

because i dont know what their application is doing and every read can bring down production database and we will loose vendor support if its caused by non approved 3rd party client apps.

2

u/TheGenericUser0815 Oct 30 '26

The easiest way to avoid that would be a database snapshot IMO. You can create it while the workload is low and use it without bringing down production. It's a feature exclusive to enterprise edition, though.

2

u/luky90 Oct 30 '26

okay i did not know that unfortunately we are forced to stay with standard edition

2

u/tripy75 Oct 30 '26

have a dev leave an open transaction on a table used by the app while they get out for lunch and watch prod come to an halt.

I would not (usually) give access to prod to anyone.
even me as a dba should not have full, unvetted, constant access to prod.
especially as I have sysadmin permissions.

in this case, as long as pii and privacy regulations allows, I would setup either a snapshot or transactional replication, with a dedicated instance labelled as such as the subscriber.

snapshot even allow you to re-sync data every day, for bonus.

1

u/TheGenericUser0815 Oct 31 '26

Well, somebody has to have admin access. Who else would take action, if necessary?

4

u/elldude Oct 30 '26

I am no expert but I have been working on an Oracle linked server through SQL server. It's a replica and it gets updated every 20 minutes. For performance, we are creating a local copy that gets updated once a day as we don't need access to live data. It depends on your specific need and what can you afford. Also, security plays a large role.

3

u/BigMikeInAustin Oct 30 '26

Log shipping is good. On the secondary, I believe you still need to close connections for readers when making the updates (you can pick, 15 min, hourly, nightly…). I can never remember, I think this allows you to have different indexes on the secondary.

Availability groups are nicer if you need the data always in sync. I can’t remember if they added an option to have different indexes on the secondary.

If you don’t need extra features, like the job agent, or cross database queries, host it as a Fabric SQL Database and read from the analytical endpoint! Huh, I wonder how many vendor application databases this would work for.

1

u/tripy75 Oct 30 '26

Go for snapshot or transactional replication. create another instance and register it as a subscriber to the source publisher.

if the debs need write access, do not go with transactional as this might break the relationships.

I would use snapshot in this case, with a job to refresh the subscriber whenever you need to.

https://learn.microsoft.com/en-us/sql/relational-databases/replication/snapshot-replication?view=sql-server-ver17

2

u/alevine1986 Oct 30 '26

I'd use replication. The secondary isn't down when changes are applied and if you only need a subset of tables unlike log shipping. Also, if log shipping gets disrupted, it's a pain to recreate/fix log shipping vs replication.

2

u/Black_Magic100 Oct 30 '26

AGs are supported on standard edition but you only can replicate 1 DB in each group

1

u/Significant_Tune9219 Oct 30 '26

Same-instance log shipping still shares CPU, memory and tempdb, and a STANDBY restore kicks the readers off every time a log is applied. I'd put the secondary on another instance and only use it for reports that can live with that lag. For the tables that really change every 15 seconds, replicate or CDC just those and leave the rest on a nightly restore. Give the Python jobs their own login with SELECT on a few views, not the application login, and enable read committed snapshot on the reporting copy so their scans don't block each other. Dual-writing from the vendor app is the one I'd skip unless they already support it, because two writes without a shared transaction will drift and you can't patch a black box.

1

u/Holiday-Tip-3720 Oct 30 '26

custom views on a seperate instance.

1

u/Wojtkie Oct 30 '26

I worked at a place that had something like this. We had a replica server that would ingest the CDC events. This was terrible, it would still cause locks due to every cdc being captured and written. I was a downstream user.

We fixed it by setting up a Kafka stream to just push the data out and ingest into our bronze databricks for analytics pipelines.

I haven’t seen SQL server be able to support transactional and analytical workloads in an efficient manner.

1

u/xpgmi Oct 31 '26

I think the only possible solutions are log shipping or backup and restore.

1

u/LesterKurtz Oct 31 '26

We have a data warehouse for these things. Data lands in one of three places

  • an ODS for operational tasks and integrations
  • an on-prem reporting server for ad-hoc reports and legacy apps/tools
  • an azure database reporting server for Power BI and other cloud first tools

I looked at Fabric, but the pricing was an immediate turn-off for me. Since you have statistical sensor data, log shipping to a landing zone for an operational data store would be the approach I'd take.

1

u/Empty-Donut-6838 Nov 01 '26

protecting your vendor black box is 100% the right call. i never give dev scripts direct access to live ot machines because someone will inevitably run a unindexed scan and freeze the whole line. replicate a small subset to a seperate box instead

1

u/CanProfessional766 Nov 02 '26

Log shipping is a good option if a delay is acceptable, but I’d keep the reporting database on a separate SQL Server instance if possible, since using the same instance still adds resource overhead. Replication can work well when you only need selected tables and fresher data. For frequent OT updates I’d start with the simplest solution the application supports and measure the actual latency and workload before choosing Fabric or another ETL tool.

7

u/[deleted] Oct 30 '26

[removed] — view removed comment

1

u/luky90 Oct 30 '26

well the reporting must not be that realtime its just for cost estimation for cloud services like fabric would be.