Friday, March 12, 2021

Another case of ORA-01756 error

In sqlplus, when using exec builtin instead of begin...end for running PL/SQL, you may encounter such error when perl quoting mechanism is used (q'{...}' for example) and there are new lines inside the 'execute immediate' command called from PL/SQL block (length of 'execute immediate' is too long). To overcome, use begin...end construction instead of exec.

Good Luck

Wednesday, February 10, 2021

oracle.glcm.opatch.common.api.install.HomeOperationsException: Invalid Home error

If you encountered such error during Oracle 19c installation phase, the cause may lay in the oraInventory directory. In my case it was a corruption of oraInst.loc file (it was absent). Renaming it in order the installer would create new one was the solution.

Good Luck !

Sunday, January 24, 2021

deinstall: line 265: You: command not found

My Oracle Support document 2641767.1 describes the issue and suggests to check whether an ORACLE_HOME directory is a soft link. In case when it is not, the other possible cause of the issue is a file or directory inside the ORACLE_HOME which owned by not an ORACLE_HOME owner (file inside the ORACLE_HOME is owned by root, not grid/oracle user, for example). 

Eliminating (moving) files/directories not owned by an ORACLE_HOME owner away solved the issue.

Good Luck !!!

Thursday, January 21, 2021

Shift+{Left|Right}_Arrow pressed generates C, D in bash

This situation made me stuck for a while, especially in comparison of two equal Linux systems. One Linux generates ;2D while another generates simply short D ( :-) ) when shift-left_arrow combination was pressed (it actually expected to be Esc[1;2D , but the shell ate first two symbols (Esc[ is the control sequence introducer, see console_codes (4))

It's very difficult to answer shortly what was going on because where were a lot of Linux players (program layers, terminal types etc.) in the chain between keys pressed and actually displayed on the terminal window. One of the widespread "players" is a readline library. I'm totally unable to explain that, but simple creation of the empty .inputrc file in the home directory solved the issue.

Good Luck !

Wednesday, January 6, 2021

sed tricks

 1. According to http://sed.sourceforge.net/sedfaq5.html#s5.10 you cannot directly process the EOL symbol (\n) using simple sed commands. You should read next line into the processing buffer and only AFTER THAT make necessary actions. For example, to change EOL to comma, use the following :

> grep some_info filename_containing_info | awk '{print $6}' | sed ":a;N;s/\n/\,/;ta"

2. To print values of fields in the line (for example, username and password in postgresql command creating new user):

> grep -i password filename.sql | sed -En "s/.* user ([^ ]+).* password '([[:print:]]+)'.*/\1 \2/p"

Thursday, December 24, 2020

How to reinitialize terminal (Linux, Solaris etc.)

In cases when your terminal has lost the cursor or similar you could use the OS command

reset

It will reset the special characters to their default values at least. You will not have to logoff/logon again to reinitialize your terminal session. 

P.S. You will also wish to run clear command (the shortcut for clear usually is 'Ctrl+l') before reset command as well if you need it (to clear status strings of tmux or screen sessions etc.)

Good Luck !

Sunday, December 20, 2020

How to prevent any prompting for input parameters in sqlplus if the script is invoked without any parameters (example taken from preupgrade.sql)

Rem The below code will prevent any prompting if the script is
Rem invoked without any parameters.
Rem

SET FEEDBACK OFF
SET TERMOUT OFF

COLUMN 1 NEW_VALUE  1
SELECT NULL "1" FROM SYS.DUAL WHERE ROWNUM = 0;
SELECT NVL('&&1', 'FILE') FROM SYS.DUAL;

COLUMN 2 NEW_VALUE  2
SELECT NULL "2" FROM SYS.DUAL WHERE ROWNUM = 0;
SELECT NVL('&&2', 'TEXT') FROM SYS.DUAL;
SET FEEDBACK ON
SET TERMOUT ON

The input parameter &1 was assigned value 'FILE', and &2 was assigned a value 'TEXT'. Quite useful construction.

Good Luck !