Skip to main content

Posts

Showing posts from 2020

RMAN refresh standby database from backup

  Record the steps I took to refresh standby database: couple of links I use as reference: https://support.oracle.com/epmos/faces/SearchDocDisplay?_afrLoop=467283015956943&_afrWindowMode=0&_adf.ctrl-state=fuirhqzw5_4 https://walkthrough-dba.blogspot.com/2019/04/rman-duplicate-database-without.html step 1:  on primary: take a backup to file system run  { allocate channel c1 type disk;  allocate channel c2 type disk;  backup as compressed backupset database format '/u99/jsun/ffdeip/backup_%d_%U';  backup as compressed backupset archivelog all format '/u99/jsun/ffdeip/backup_%d_%U'; backup current controlfile for standby format '/u99/jsun/ffdeip/stby_control_ffdeip.bck' } step 2: transfer the backup in step 1 to standby host, e.g. scp step 3: on standby: duplicate to standby srvctl start instance -d FFDEIPDG -i FFDEIPDG1 -o nomount asmcmd rm +oradata01/ffdeipdg/datafile/* asmcmd rm +oradata01/ffdeipdg/tempfile/* asmcmd rm +oraflash01/ffdeipdg/archivelog/* e

Opatch apply/lsinventory error: oneoff is corrupted or does not exist

I am applying the quarterly patch for 19c RDBMS, I tried using napply but failed, but somehow it corrupted the inventory though nothing applied. further apply and lsinventory command ran into error like this: $ ./OPatch/opatch lsinventory Oracle Interim Patch Installer version 12.2.0.1.21 Copyright (c) 2020, Oracle Corporation.  All rights reserved. Oracle Home       : /u02/app/oracle/19.0.0 Central Inventory : /u01/app/oraInventory    from           : /u02/app/oracle/19.0.0/oraInst.loc OPatch version    : 12.2.0.1.21 OUI version       : 12.2.0.7.0 Log file location : /u02/app/oracle/19.0.0/cfgtoollogs/opatch/opatch2020-09-08_13-35-59PM_1.log Lsinventory Output file location : /u02/app/oracle/19.0.0/cfgtoollogs/opatch/lsinv/lsinventory2020-09-08_13-35-59PM.txt -------------------------------------------------------------------------------- Inventory load failed... OPatch cannot load inventory for the given Oracle Home. LsInventorySession failed: Unable to create patchObject Possible ca

RMAN validate all databases on host shell script

This script will loop all running db instances and run rman validate database #!/bin/sh #created on March, 2020 by Jiulu Sun #use the following two commands to manually generate the instance list and create oratab_host file to loop # ps -ef|grep ckpt |awk '{print $8}'|awk -F "_" '{if (NF==3) print $3;if (NF==4) print $3"_"$4}'|grep -v "ASM"|grep -v '^_' > dblist_vdclracdev01 # for inst in $(<dblist_vdclracdev01)^Jdo^Jgrep -i ${inst}":" /etc/oratab|awk -F ":" '{print $1":"$2}'^Jdone > oratab_vdclracdev01 #now the oratab_host file is created, validate all of them. LOG_LOCATION=/u01/dba/jsun timestamp=`date  +%Y_%m_%d_%H_%M_%S` hostname=`hostname` RMANLOG_FILE=$LOG_LOCATION/RmanValidate_$hostname_$timestamp.log SQLPLUS_LOGFILE=$LOG_LOCATION/sqlplus_logfile_$hostname_$timestamp.log ORATAB=$LOG_LOCATION/oratab_vdclracdev01 HOSTNAME=`hostname` export NLS_DATE_FORMAT="dd-mo

EZCONNECT without a password

this is helpful. https://perfstat.wordpress.com/2015/02/06/ezconnect-without-a-password/ EZCONNECT without a password Leave a reply After encountering this little annoyance for the nth time, I thought I should write it up once and for all, so it is committed to my electronic memory. The EZCONNECT naming method is a handy way of connecting to an Oracle database by its service name, which avoids the need for aliases in the TNSNAMES file, or lengthy SQL*Net connection strings : 1 2 SQL> connect user/password@hostname:port/service_name Connected. However, one would expect that if you don’t want to specify the password on the command line, then simply omit the password and await the prompt. But… 1 2 3 SQL> connect user@hostname:port/service_name ERROR: ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA Without the password present, the command interpreter parses the string differently, and (according to Oracle