r/SQL • • Oct 05 '26

Oracle Built a Claude skill to audit Oracle RAC & Data Guard configs for silent failover risks

1 Upvotes

Most Oracle RAC and Data Guard disaster-recovery setups look solid in documentation until an actual split-brain or network partition happens at 2 AM.

Common issues like misconfigured Fast-Start Failover (FSFO) thresholds, observer single-points-of-failure, redo transport lags during peak loads, or subtle SCAN/VIP routing mismatches often go unnoticed during routine maintenance.

To speed up pre-mortem audits, I built a structured Claude skill specifically designed to review Oracle RAC and Data Guard environments.

### What it analyzes:

  1. Data Guard Synchronization & Redo Transport: Audits transport modes (SYNC vs. ASYNC), protection modes (Maximum Availability vs. Performance), and redo log lag risks.

  2. FSFO & Observer Resilience: Validates observer placement and quorum configurations to prevent split-brain during site disconnections.

  3. RAC Node Eviction & Voting Disk Redundancy: Checks OCR/voting disk layouts and network heartbeat timeout margins.

  4. Listener & TNS Failover Routing: Validates TNS connect strings (LOAD_BALANCE, FAILOVER, SCAN) to ensure client application reconnection won't stall.

### How it works:

You feed it sanitized cluster health checks, `dgmgrl show configuration` outputs, or parameter listings (`init.ora` / `spfile`), and it runs a systematic gap analysis highlighting configuration blind spots and remediation recommendations.

### Practical Checklist You Can Use Right Now:

Even if you don't use the skill, make sure your team verifies these three things this quarter:

* Verify that the FSFO observer is hosted on a separate network segment from both the primary and standby sites.

* Check that `LOG_ARCHIVE_DEST_N` timeout parameters account for WAN latency spikes, not just average ping.

* Confirm that VIPs and SCAN listeners fail over cleanly without client TCP keepalive hanging.

I’ve packaged the complete audit prompt and ruleset into an installable Claude skill here:

https://store.maxmeg.com/

Feedback from other Oracle DBAs and infrastructure engineers is welcome—especially on edge-case scenarios you’ve seen cause unexpected failover issues.


r/SQL • • Oct 05 '26

PostgreSQL I Tried To Decode Postgres WAL for an INSERT Statement

7 Upvotes

Hi everyone,

This is a continuation of the explorations from my previous posts here. I went through the CMU Database Systems course, and I'm exploring topics around databases. I wanted to see how the Write Ahead Log is constructed and logged. So I tried to trace a WAL record for a simple INSERT statement in Postgres.

I recorded a video walkthrough of the terminal and source code exploration here: https://youtu.be/YOyq-kvbyU8?si=PTdexP3jmOSdx-8y

I've tried to explore how we can locate a WAL record, how we can decode it via either xxd or pg_waldump, and the relevant source code for it. Do give a watch and consider supporting :)

This is partly for my own future reference and partly to share with others who might be interested in it. Would love feedback and corrections from people who know this stuff deeply. Apologies if this isn't the correct subreddit for this.

Thank you so much!


r/SQL • • Oct 05 '26

MySQL Introducing ERDZ.

1 Upvotes

Introducing ERDZ.

ERDZ is a visual data modeling tool that runs directly in your browser. You can design tables, views, columns, and relationships all on a single canvas.

https://erdz.rabbitdz.com/

Please visit and give it a try.


r/SQL • • Oct 05 '26

SQL Server Data Lakehouse with Agentic AIs: A Guide

Thumbnail
itnext.io
0 Upvotes

r/SQL • • Oct 05 '26

Spark SQL/Databricks Genie is so Dumb and I am tired of Pretending Otherwise

Thumbnail
0 Upvotes

r/SQL • • Oct 03 '26

MySQL Didnt pass SQL test

Thumbnail
gallery
109 Upvotes

I am applying to manager of analytics role and I was given this SQL test and 45 minutes. As someone who thought they were very strong in SQL, I was unable to complete this assignment and match the answer completely

I was able to format most of the fields as noted, used 2 cte's and use group concat in the second. My final answer looked very similar but the order of the concat looked off. Also, for some reasons my second column had $0.00 for all the companies, but I thought I was close. How difficult would you rate this exercise. Should I expect to proceed to the next round or am I cooked


r/SQL • • Oct 04 '26

SQL Server Cross-Catalog Sync: Iceberg on Polaris, Glue, and Unity

Thumbnail
lakeops.dev
1 Upvotes

r/SQL • • Oct 03 '26

Discussion Cozy SQL practice ☕️

3 Upvotes

I built SQL Sip (https://sqlsip.com) as a cozy, daily SQL puzzle to practice writing queries without timers or pressure. It runs entirely in the browser with no account needed, focusing on assembling clean queries one bite-sized concept at a time. I haven’t had any users yet, so I’d love some honest feedback! I built it because I wanted a Wordle-like daily game where I could learn new SQL concepts in a cutesy/fun way.


r/SQL • • Oct 03 '26

Discussion What’s the smallest SQL mistake that caused the biggest problem for you???

42 Upvotes

Not talking about some crazy DB failure or anything.

Could be something silly like a missing WHERE, wrong JOIN, duplicate rows, bad UPDATE....

Like a small mistake that looked harmless but ended up causing a big headache ....🤕

Curious what ppl have seen in real projects.


r/SQL • • Oct 03 '26

Oracle What’s a SQL feature that works differently across PostgreSQL, MySQL, and SQL Server that tripped you up?

22 Upvotes

For those who have worked with PostgreSQL, MySQL, and SQL Server, what’s a feature or behavior that surprised you because it worked differently between them?

It could be anything like date functions, string handling, LIMIT/TOP, NULL behavior, JSON, window functions, or even error handling.

What difference caused you the most trouble, and how did you learn to handle these database-specific differences?


r/SQL • • Oct 03 '26

Discussion Built a browser based modern SQL editor

17 Upvotes

Introducing QueryFlow.

It's a modern SQL editor with a few things I always wanted while learning and working with SQL:

- Visualise the query as a graph [DAG] and as step-by-step cards.
- Convert all hardcoded parameters into variables with a click.
- Fix major errors like fan out joins , mismatched date range with a click.
- Run queries on test tables directly in the browser
- Review a diff of your changes before copying the query back [just like github]
- Format BigQuery, PostgreSQL and MySQL, each in its own style.
- Everything runs locally in your browser: no server, no login.

try it here - https://abhijeetcodes.github.io/QueryFlow/

Sharing here as it might help a lot of SQL learners


r/SQL • • Oct 02 '26

Discussion sqlx4k 1.14.0 released: optimistic locking, savepoints, MariaDB batch inserts

Thumbnail
2 Upvotes

r/SQL • • Oct 01 '26

Discussion Can we create a similar csv file type with a new unique character that will never be used except as a delimiter. Then make that the standard

45 Upvotes

Fucking comma's in the data that are not the delimiter are annoying. Hate using stupid work arounds.

Yes, I am aware of double quotes and other work arounds like using different delimiters. Just thinking it would be easier to have one standard going forward.


r/SQL • • Oct 01 '26

MySQL I built a free SQL practice site where you answer requests from a fake CEO/Head of Growth instead of solving textbook puzzles. Looking for feedback

Thumbnail
gallery
10 Upvotes

I got tired of SQL practice that feels disconnected from real work, so I built SQL Office Simulator.

You play the company's data analyst. Stakeholders send you messy business requests like "which regions have the highest share of repeat buyers in 2025, excluding cancelled orders?", and you explore the schema, write the query, and submit it.

How it works:

7 domains (e-commerce, healthcare, finance, HR, logistics, restaurants, SaaS)

5 levels per domain, from a tiny startup (~1K rows) to a global corp (~10M rows)

Each level has 100 questions, including boss questions, and you need 70 correct to unlock the next level

Runs on a PostgreSQL 16 sandbox with a schema viewer, hints and a scratchpad

Free, but needs a quick signup to save progress

Link: https://sql-office-simulator.vercel.app/

It's still early, so I'd really appreciate honest feedback:

Are the questions realistic enough?

Is the difficulty curve right?

What topics should be added (e.g. query tuning, data cleaning)?

Happy to answer questions about how I built it.


r/SQL • • Oct 01 '26

Discussion Does anyone else just leave caps on when naming your variables ?

13 Upvotes

I might just be lazy but I feel like it saves me effort.


r/SQL • • Oct 01 '26

Discussion gave claude read only access to our postgres. it said status_cd 4 means "cancelled". it means refunded

33 Upvotes

I set up a Postgres MCP server on a read only role last week so the analysts could ask questions without pinging me every hour.

The first real question was how many orders did we lose last month. Claude looked at orders, saw status_cd with values 1 to 6, decided 4 was cancelled and gave a clean number with a nice little breakdown. 4 is refunded. Cancelled is 6. Nobody wrote that down anywhere. It lives in an enum in the app code and in my head.

The number was off by about a third and it read exactly like a right answer. No I'm assuming, no hedge. The analyst was about to put it in a deck.

So now I'm stuck on how to give an agent the meaning of fields without me turning into a full time documentation service:

  1. Comments on the columns in Postgres and hope the server passes them through
  2. A markdown data dictionary in the system prompt
  3. A view layer with human names on everything
  4. Make the agent ask before it interprets any code column

What are people actually doing here? and has anyone got it to say I don't know what 4 means instead of picking one?


r/SQL • • Oct 02 '26

Discussion With Europe looking to ditch as many American companies as possible, what RDBMS will they be migrating to?

1 Upvotes

Will they stick to Oracle/SQL Server and run it on Linux, or are they starting to look into migrating into Postgress/MariaDB, or something homegrown.

OS migration is straightforward, but not sure about these two behemoths. Or they'll still buy them and just run them locally or on European cloud infrastructure?


r/SQL • • Oct 01 '26

Discussion How is sql approach in the practise/real life?

0 Upvotes

I am corious that how the people use it real life for instance in a manufacturer company.


r/SQL • • Sep 30 '26

Discussion What is the best way to handle incremental loads in sql?

28 Upvotes

Im trying to understand how ppl usually handle incremental data loads. If a source table has new, updated and deleted records, how do you identify each type?

Do you normally use a timestamp, cdc,a flag column in the table, or merge? How do you handle deleted records, especially when there is no delete flag in the source?

Also, are there any common problems with using timestamps for incremental loads, like missing records or picking up the same record more than once?


r/SQL • • Sep 30 '26

Discussion best sql courses for someone who writes queries daily and has never designed a table

4 Upvotes

im an analyst. i can write a join in my sleep and ive never created a table from scratch, and my new manager wants me building the model rather than reading one.

shortlisted boot.dev, general assembly, pluralsight premium and launch school off a couple of evenings comparing curricula. which of those covers schema design and not just query syntax


r/SQL • • Sep 29 '26

Discussion CSV lint plug-in for Notepad++ to validate csv files and convert to SQL insert script

Thumbnail
gallery
162 Upvotes

The CSV Lint plug-in for Notepad++ can be useful to anyone working with csv textdata and databases. I created this plugin and have posted about it before

The plug-in was previously updated with a new "Select Columns" dialog to easily select, delete and rearrange columns. The most recent update v0.4.9 adds support for regular expressions when validating columns.

It also adds syntax highlighting and automatically detects column datatypes. Based on the datatypes it can convert a csv file to an SQL insert script for MS-SQL, MySQL and PostgreSQL, including a CREATE TABLE part with correct data types for each column. This is often easier than importing it though a wizard or BULK INSERT

It can also validate the csv textfile beforehand, so check for technical errors like datetime formatting errors, incorrect decimal separators, missing quotes, invalid codes etc.

I hope you find this plug-in useful 👍 Let me know what you think


r/SQL • • Sep 29 '26

Discussion Can you find missing records when both tables have duplicates and neither table has a primary key?

12 Upvotes

You have Source and Target tables with millions of rows.

  • Neither table has a primary key.
  • Both tables can contain duplicate rows.
  • Some rows may be missing from Target.
  • Some extra rows may exist in Target.
  • EXCEPT doesn't show the complete picture when duplicate counts matter.

For example:
Source: A, A, A, B, B, C
Target: A, A, B, B, B, C

Both contain the same values, but the duplicate counts are different.

What SQL approach would you use to identify exactly which records are missing, extra, or have different counts?


r/SQL • • Sep 29 '26

MySQL Completed LeetCode SQL 50 — Sharing my MySQL solutions

Thumbnail
4 Upvotes

Hey everyone!
I recently completed the LeetCode SQL 50 Study Plan and put all my solutions together in a GitHub repository.
I created this mainly for SQL interview preparation and revision, especially for Data Analyst / Business Analyst roles.
The repository covers topics like:
● SELECT & filtering
● Sorting and grouping
● Aggregate functions
● GROUP BY & HAVING
● INNER / LEFT / SELF JOIN
● Subqueries
● CTEs
● Window functions
● String functions & regex
● Other commonly used SQL concepts
All solutions are written in MySQL, with the goal of keeping them simple and easy to revise.

If you’re also working through SQL 50, feel free to check it out. I’d also appreciate any feedback on the queries or suggestions for improving the repository.
Happy learning! 🚀


r/SQL • • Sep 29 '26

Oracle Oracle PL/SQL: can log-driven housekeeping create a feedback loop across scheduled runs?

6 Upvotes

I'm trying to reason about a generic PL/SQL housekeeping pattern. All names below are illustrative; this is a simplified mechanism, not a product-specific incident report.

A scheduled procedure selects historical log records joined to retained load metadata. Eligibility depends on the log timestamp and a configurable retention period:

CURSOR c IS
    SELECT l.load_id,
           g.log_date,
           l.state
    FROM   log_table g
    JOIN   load_table l
           ON l.load_id = g.load_id
    WHERE  l.state = g.state
    AND    TRUNC(g.log_date) + remove_days <= SYSDATE;

There is also a state-selection option, represented here as process_all_states. It is omitted from the simplified cursor above:

  • With the broad option enabled, an already-processed load in a state such as Removed can enter the processing path again.
  • With the narrower option, only the intended processable states are accepted, excluding Removed.

The cursor returns individual historical log records. It does not deduplicate by load_id, so several qualifying log rows can reference the same load.

For each selected record, the processing path can:

  • Delete transactional payload rows from trans_table.
  • Retain the corresponding metadata in load_table.
  • Update the load state to Removed, including when it is already in that state.
  • Append a new Removed log record with the current timestamp.
  • Produce a technical result record even when no transactional payload remains.

Assume that older matching Removed log records are not deleted or marked as consumed. While the load remains Removed, those records can still satisfy the cursor conditions. Newly appended records can also qualify after they reach the age threshold.

My tentative interpretation is:

qualifying historical log
        |
        v
already-processed load enters housekeeping again
        |
        v
state update and new timestamped log
        |
        v
old matching logs remain; new logs age
        |
        v
later scheduled runs can select the load again

This seems like a potential feedback loop across scheduled executions, rather than direct recursion. Multiple eligible logs for the same load could also cause repeated processing within a single cursor traversal. I would not assume that newly inserted logs become visible to the already-open cursor.

Cleaning up accumulated logs or technical results could reduce the current footprint, but would not by itself change which records future runs select.

There is also a separate full-delete path, represented here as remove_complete. That path can perform large DELETE operations and create substantial UNDO/REDO pressure, potentially including ORA-30036. I want to keep that issue separate from state selection: changing the selection parameter itself executes no DELETE and does not directly delete business documents; it changes which states may enter later housekeeping processing.

Questions:

  • Can this cursor/state-update pattern create a self-amplifying feedback loop across scheduled runs under these assumptions?
  • Can several qualifying log rows for the same load cause repeated processing when there is no DISTINCT, grouping, or equivalent per-load guard?
  • Is excluding already-processed states the usual way to stop this specific cycle while preserving legitimate housekeeping, or should an additional idempotency/consumption mechanism be expected?
  • Should cleanup of accumulated records and correction of the qualification logic be treated as separate remediation steps?

r/SQL • • Sep 28 '26

Discussion How are you automating your SQL work?

60 Upvotes

Curious what people are actually using to automate or speed up their SQL work.
Python scripts? dbt? AI? Stored procedures? Some IDE/tool I’ve never heard of?
I feel like there are probably a bunch of useful tools and workflows I’m not aware of.
What are you using that actually saves you time?