DBA Corner

Data is stored somewhere

Author: DBA Corner

  • Use Excel Power Query to Read SQL Server Data Safely

    Excel can read SQL Server data without embedding passwords or building SQL text from worksheet cells. Power Query is the preferred workflow for most reporting workbooks. Connect with Power Query In Excel, choose Data > Get Data > From Database > From SQL Server Database. Enter the approved server and, optionally, database name. Prefer organizational…

  • Shell Script: Find the Script’s Own Directory

    A script’s current working directory and the directory containing the script are different concepts. pwd reports where the caller is working; it does not reliably report where the script file lives. Bash: directory containing the script #!/usr/bin/env bash set -euo pipefail SCRIPT_DIR=”$( cd — “$(dirname — “${BASH_SOURCE[0]}”)” >/dev/null 2>&1 pwd -P )” printf ‘Script directory:…

  • SQL Server Performance Hardware Checklist

    Choose SQL Server hardware from measured workload requirements, not a generic rule such as “buy the most CPUs possible.” Licensing, NUMA topology, storage latency, memory pressure, virtualization, and growth can matter more than a single headline specification. 1. Establish the workload Peak and typical transactions, batch duration, concurrent sessions, and data growth Read/write mix, working-set…

  • xbindkeys: Create Safe Linux Keyboard Shortcuts

    xbindkeys runs commands from keyboard or mouse shortcuts under the X Window System. It is useful for lightweight X11 desktops, but many Wayland sessions restrict global key capture; in that case, use the desktop environment’s native shortcut settings. Capture a key combination xbindkeys –key Press the desired key once. For combinations that are difficult to…

  • Oracle: Enable or Disable ARCHIVELOG Mode

    ARCHIVELOG mode is required for online backups and point-in-time recovery. Changing the mode requires the database to be mounted but not open, so plan an outage and confirm that recent backups are recoverable. Before the change Verify the current mode with SELECT log_mode FROM v$database;. Confirm the archive destination has enough capacity and is monitored.…

  • Oracle Transportable Tablespaces with Data Pump

    Transportable tablespaces move user tablespace data files plus a Data Pump metadata dump. They can be much faster than unloading and reloading large data sets, but the tablespace set must be self-contained and compatible with the target. 1. Check prerequisites and containment BEGIN DBMS_TTS.TRANSPORT_SET_CHECK( ts_list => ‘APP_DATA,APP_INDEX’, incl_constraints => TRUE, full_check => TRUE ); END;…

  • SQL Server: Monitor Free Disk Space Safely

    Monitor the volumes that contain SQL Server database files with sys.dm_os_volume_stats. It returns capacity information without enabling operating-system command execution. Free space for database volumes SELECT DISTINCT vs.volume_mount_point, vs.logical_volume_name, CAST(vs.total_bytes / 1073741824.0 AS decimal(18,2)) AS total_gb, CAST(vs.available_bytes / 1073741824.0 AS decimal(18,2)) AS free_gb, CAST(100.0 * vs.available_bytes / NULLIF(vs.total_bytes, 0) AS decimal(5,2)) AS free_percent FROM sys.master_files…

  • Oracle Disk I/O and Wait Events

    Oracle I/O troubleshooting requires both database and operating-system evidence. A high request count can identify a busy workload, while high service time can identify latency; neither alone proves that storage is the root cause. I/O by file type SELECT filetype_name, SUM(small_read_reqs + large_read_reqs) AS read_requests, ROUND(SUM(small_read_megabytes + large_read_megabytes), 1) AS read_mb, SUM(small_write_reqs + large_write_reqs) AS…