cluvfy stage -post crsinst -n nserver-rac1,server-rac2
Windows – Determine System Properties with Powershell
systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List Get-WmiObject -Class Win32_OperatingSystem | ForEach-Object -MemberName Caption [System.Environment]::OSVersion.Version [Environment]::OSVersion
Oracle – Display Contextual Information in sqlplus session (using sys_context)
Find username, db_name etc. from sqlplus session
select sys_context ('USERENV', 'SESSION_USER') from dual; select sys_context ('USERENV', 'DB_NAME') from dual;
Oracle 12.2 – Security Change for sqlplus
See article by Mike Dietrich:
Linux – sort output of dh -h command
df -h | grep -v ^none | ( read header ; echo “$header” ; sort -rn -k 5)
Oracle – 12cR2
PDB
Local Undo
Flashback PDB
Character Set (CDB must be AL32UTF8)
Oracle – tkprof – Extract all waits from output file using Powershell
$astr=@("Event", "\*\*\*\*", "--------") #Gets them all #set up the regexp $regex = '(?ms) Event waited on(.+?)\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*' #get-content gets an array of strings, join them all into one string separated by newline $string=(Get-Content .\CCI1_ora_15824_2.txt) -join "`n" # search for the regexp in the string and output the matches Select-String -input $string -Pattern $regex -AllMatches | ` % { $_.Matches } | ` % { $arr = $_.Value -split "`n" foreach ($line in $arr) { # output only lines that do not contain the strings in the array, trim it and replace "more than one space" with a semi-colon Select-String -input $line -pattern $astr -NotMatch | ForEach-Object {$_.Line.Trim() -replace ' +',";"} } }
Oracle – sql – escape characters
select username from dba_users where username like '%\_J' escape '\';
Linux – Install rlwrap from epel (Extra Packages for Enterprise Linux )
What is rlwrap?
rlwrap (readline wrapper) is a utility that provides command history and editing of commands for programs such as sqlplus, rman.
Red Hat Linux 7 and OEL 7
Execute the commands as root.
Get Extended Packages for Enterprise Linux (EPEL)
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Install EPEL
rpm -ivh epel-release-latest-7.noarch.rpm
Install rlwrap
yum install rlwrap
Red Hat Linux 6 and OEL 6
Execute the commands as root.
Get Extended Packages for Enterprise Linux (EPEL)
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Install EPEL
rpm -ivh epel-release-latest-6.noarch.rpm
Install rlwrap
yum install rlwrap
Locking Problems (Red Hat Linux 7)
Connect as root
Stop packagekitd service if it is running (to stop locks on yum)
systemctl disable packagekitd.service
The processes:
root 13447 1 0 Jan02 ? 00:07:13 /usr/libexec/packagekitd
root 17522 13447 33 10:46 ? 00:01:23 /usr/bin/python /usr/share/PackageKit/helpers/yum/yumBackend.py get-updates none
hold a lock on yum – had to kill 13447
Example Session (with Oracle Enterprise Linux 6)
[root@oel6]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm --2018-10-24 06:07:00-- https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm Resolving dl.fedoraproject.org... 209.132.181.25, 209.132.181.24, 209.132.181.23 Connecting to dl.fedoraproject.org|209.132.181.25|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 14540 (14K) [application/x-rpm] Saving to: “epel-release-latest-6.noarch.rpm” 100%[=================================================================================================================================>] 14,540 88.7K/s in 0.2s 2018-10-24 06:07:01 (88.7 KB/s) - “epel-release-latest-6.noarch.rpm” saved [14540/14540] [root@oel6]# rpm -ivh epel-release-latest-6.noarch.rpm warning: epel-release-latest-6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY Preparing... ########################################### [100%] 1:epel-release ########################################### [100%] [root@oel6 network-scripts]# yum install rlwrap epel/metalink | 26 kB 00:00 epel | 3.2 kB 00:00 epel/primary | 3.2 MB 00:02 epel 12516/12516 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package rlwrap.x86_64 0:0.42-1.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================================================================================== Package Arch Version Repository Size =========================================================================================================================================================================== Installing: rlwrap x86_64 0.42-1.el6 epel 93 k Transaction Summary =========================================================================================================================================================================== Install 1 Package(s) Total download size: 93 k Installed size: 203 k Is this ok [y/N]: y Downloading Packages: rlwrap-0.42-1.el6.x86_64.rpm | 93 kB 00:00 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 Importing GPG key 0x0608B895: Userid : EPEL (6) <epel@fedoraproject.org> Package: epel-release-6-8.noarch (installed) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered outside of yum. Installing : rlwrap-0.42-1.el6.x86_64 1/1 Verifying : rlwrap-0.42-1.el6.x86_64 1/1 Installed: rlwrap.x86_64 0:0.42-1.el6 Complete! [root@oel6]#
SQL Server – Decrease size of Out-of-Control Transaction Log File
https://www.brentozar.com/archive/2009/08/backup-log-with-truncate-only-in-sql-server-2008/