Intro
We all know Windows is the preferred platform for Oracle DBAs !! I hear that every day :D. All right, maybe not so much ;). But Jokes aside, when your client has the majority of his DB workload running on windows, itβs hard to dodge the job. It becomes even more challenging to switch to GUI clicks when coming from Linux world. Thatβs why I had to google a lot along my years working on non Unix shops. After a while, I wound up curating a bunch of useful tips through the years and kept them in a text file, however I think a web page is a way better place to navigate than a raw text in a notepad anytime a quick help is needed.
This list wonβt have a specific structure but Iβll try to keep it coherent.
Basic windows Checks
Check OS versions
C:>winver
-- A Window will appear
C:>systeminfo | findstr OS
OS Name: Microsoft Windows Server 2012 Standard
OS Version: 6.2.9200 N/A Build 9200
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Server
OS Build Type: Multiprocessor Free
BIOS Version: Phoenix Technologies LTD 6.00, 9/21/2015
Check uptime and last boot
Choose from following options
C:> systeminfo | find "System Boot Time" System Boot Time: 2022-05-04, 8:59:32 PM
C:> NET STATS srv Statistics since 2022-05-04 8:59:55 PM C:> wmic OS GET CSName,LastBootUpTime CSName LastBootUpTime BROKDBA 20220504205932.600144-240
Check Service Uptime
Extract the service PID from the service name
C:> sc queryex MSSQLSERVER SERVICE_NAME: MSSQLSERVER TYPE : 10 WIN32_OWN_PROCESS STATE : 4 RUNNING (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0 PID : 5068 ----> Copy PID FLAGS :
Check the uptime in PowerShell
PS C:> Get-Process | select name, id, starttime | select-string 5068 @{Name=sqlservr; Id=5068; StartTime=11/24/2020 09:46:20}
Check CPUs
-- Dos Command line C:> wmic CPU Get NumberOfCores,NumberOfLogicalProcessors /Format:List
NumberOfCores=6 NumberOfLogicalProcessors=12
-- Powershell PS C:> WmiObject -class win32_processor -Property Name, NumberOfCores, NumberOfLogicalProcessors | Format-List -Property Name, NumberOfCores, NumberOfLogicalProcessors Name : Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz NumberOfCores : 6 NumberOfLogicalProcessors : 12
Check running Services
PS C:> net start ... OracleOraDB19Home1TNSListener ... Windows Search Windows Update ..
Manage services
--- Start stop C:> net start/stop "SERVICE-NAME"
--- Delete a Service
C:> SC DELETE "SERVICE-NAME"
User management
Show current user
PS C:> whoami
DomainmyUser
List user group members
PS C:> NET LOCALGROUP ORA_DBA Alias name ORA_DBA Comment Oracle DBA Group Members ------------------------------------- DOMAINdbadmin DOMAINUser2 NT AUTHORITYSYSTEM
Add new user
Syntax: net user username password /ADD /DOMAIN
C:> net user Oracle * /add /MyDomain
Type a password for the user: ***** Retype the password to confirm: **** The command completed successfully.
-- Change password C:> net user Oracle * Type a password for the user: Retype the password to confirm:
list all processes in Windows
Choose from following options
C:> tasklist
--- Via WMI ( more details) C:> wmic process
--- PowerShell PS C:> get-process
tail -f in PowerShell
PS C:> Get-Content -Path "C:APPORACLEdiagrdbmsPATHtracealert_MYDB.log" -Wait
Storage
Check system Block size
C:> fsutil fsinfo ntfsinfo D: NTFS Volume Serial Number : Version : Bytes Per Sector : 512 Bytes Per Physical Sector : <Not Supported> Bytes Per Cluster : 4096 -------- 4K /64K etc.. Bytes Per FileRecord Segment : 1024 Clusters Per FileRecord Segment:
Check (shared) drive space usage
This is specially useful to check shared drive overall usage as you canβt see the info through the explorer
C:> fsutil volume diskfree D: Total # of free bytes : 37252968448 Total # of bytes : 858856091648 Total # of avail free bytes : 37252968448 --> 34.69GB free