Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This script requires Powershell, sqlplus aka Oracle command line client and tnsname resolution of your target databases
- #A typical use case would be to find the lock status of an account in multiple databases
- $databases = @("fndev", "fntst")
- $credential = Get-Credential
- $username = $credential.GetNetworkCredential().username
- $password = $credential.GetNetworkCredential().password
- if (!$password) { Write-Host "password is null"; Exit }
- foreach ($db in $databases)
- {
- $sqlQuery = @"
- set NewPage none
- set heading off
- set feedback off
- select count(*) from psoprdefn where oprid='PS' and ACCTLOCK = '0';
- exit
- "@
- write-host -nonewline -f yellow $db
- $sqlQuery | sqlplus -silent $username/$password@$db | write-host
- write-host
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement