Can't open perl script - RemoteHostExecutor.pl

Despite banging on about making sure you have the latest OPatch applied on your database / grid homes today I was caught out.

If you have different OPatch versions between the grid and database homes you hit a mismatch error but if you have different versions on different RAC nodes you will hit this :

[root@ora01 gridhome]# $ORACLE_HOME/OPatch/opatchauto apply /u99/media/jul2020/31305382 -oh /u01/app/12.2.0/gridhome -analyze

Can't open perl script "/u01/app/12.2.0/gridhome/OPatch/auto/database/bin/RemoteHostExecutor.pl": (null)

oracle.dbsysmodel.driver.sdk.productdriver.ProductDriverException: Unable to execute command : Can't open perl script "/u01/app/12.2.0/gridhome/OPatch/auto/database/bin/RemoteHostExecutor.pl": (null)

OPatchAuto failed.

If you do a quick search you will be told to apply the latest OPatch but I was already using the latest version but once same version on all nodes - happy days!

So latest version all homes and all nodes.







Rman duplicate database - quick notes.

Quick notes on duplicating database following level 0 rman backup.

Wanted a duplicate of a db called MPROD to one called MPRODX.

So ran the rman backup and copied the backup to another server.

Started the mprodx database with a "skeleton" pfile - the db name option should suffice.

Most of the parameters are optional.

 
SQL> startup nomount pfile=/u01/app/oracle/product/12.2.0/dbhome_1/dbs/initmprodx.ora
ORACLE instance started.
 
Total System Global Area 1.6106E+10 bytes
Fixed Size                  4516272 bytes
Variable Size            2281702992 bytes
Database Buffers         1.3791E+10 bytes
Redo Buffers               29036544 bytes

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.2.0 - 64bit Production
 
Created a script to do the duplicate (the rman backup was encrypted but not a common thing to do, so ignore the decryption option). 

Created the script dupl,txt
 
set echo on;
-- set decryption identified by 'password123' ;
run {
 
allocate auxiliary channel d1  type disk ;
allocate auxiliary channel d2  type disk ;
allocate auxiliary channel d3  type disk ;
allocate auxiliary channel d4  type disk ;
 
duplicate database to MPRODX  backup location '/backup/rman_back';
 
release channel d1 ;
release channel d2 ;
release channel d3 ;
release channel d4 ;
 
}
  
Run the script in the background (change /home/oracle to wherever).

nohup rman auxiliary / cmdfile=/home/oracle/dupl.txt log=/home/oracle/refresh_mprodx.log &

At the end of this should have a duplicate database. You might hit an issue if with files already existing but if you are totally certain that you are not overwriting an existing database you can use the nofilenamecheck option to stop this. Check the log file to confirm ok.

 

Creating multiple databases with dbca

 Asked to create a number of oracle dbs all the same version, all the same.

Manually ran the dbca and saved the response file.

Edited the response file, changed the sys and system password entries and globally replaced the db name so could run the dbca from the command line and let it just do its thing. 

Remember g/^#/d and g/^$/d will replace the commented / blank lines in vi if you want to make the file easier to read.

$ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /home/oracle/dbca_oradb2.rsp

Did not want to do this for every db so put this together, bit quick and dirty but seems to do the trick.

In the response file changed the database name to dummy and let sed replace it with the correct name; tried to do this with unix variables but dbca would not pick the correct value and was up against the clock so did it this way for quickness.

#!/bin/sh

oracle_env()

{
ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1; export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin; export PATH
}

oracle_env

array=(oradb1 oradb2 oradb3 oradb4 oradb5 oradb6)

for i in "${array[@]}" ; do
ORACLE_SID=${i}; export ORACLE_SID
echo $ORACLE_SID

sed "s/dummy/$i/g" dbca.rsp > dbca_$i.rsp

$ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /home/oracle/dbca_$i.rsp

done

When finished you can delete the dbs in the same way.

dbca -silent -deleteDatabase -sourceDB oradb2 -sysDBAUserName sys -sysDBAPassword Password#2020

As always please feel free to improve and let me know.