DBA Corner

Data is stored somewhere

Category: Guide

  • Script SQL Server Agent Jobs with PowerShell and SMO

    SQL-DMO and ActiveX Script job steps belong to an older SQL Server era. For current systems, use SQL Server Management Objects (SMO) from PowerShell and the maintained SqlServer module. Script every SQL Server Agent job Import-Module SqlServer $serverName = “SERVER\INSTANCE” $outputDir = “C:\DBA\SqlAgentJobs” New-Item -ItemType Directory -Force -Path $outputDir | Out-Null $server = New-Object Microsoft.SqlServer.Management.Smo.Server…

  • Monitor Oracle Processes and Threads on Windows

    On Windows, Oracle database activity is easiest to diagnose by correlating Oracle sessions with operating-system process and thread identifiers. The old Quick Slice utility is no longer needed; use supported Windows tools such as Task Manager, Performance Monitor, or Process Explorer. Map sessions to Windows activity SELECT s.sid, s.serial#, s.username, s.status, s.program, p.spid, p.stid, p.pname,…

  • Benchmark File Compression Tools Safely

    Compression choices should be based on your own data, recovery-time objectives, and available CPU. A benchmark copied from another system can be misleading because text, database exports, binaries, and already-compressed files behave very differently. Benchmark without changing the source file The following commands write new compressed files and leave sample.dat untouched: /usr/bin/time -f ‘gzip elapsed=%e…

  • SQL Server 2000 Product Key and MDAC: Historical Inventory Note

    This is a historical inventory note. SQL Server 2000 and the Microsoft Data Access Components (MDAC) era are obsolete and unsupported. Do not expose product keys by querying the Windows registry from inside SQL Server. Inventory a current SQL Server instance SELECT SERVERPROPERTY(‘ServerName’) AS server_name, SERVERPROPERTY(‘ProductVersion’) AS product_version, SERVERPROPERTY(‘ProductLevel’) AS product_level, SERVERPROPERTY(‘Edition’) AS edition, SERVERPROPERTY(‘ProductUpdateLevel’)…

  • 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;…