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 !

Wednesday, December 2, 2020

root sqlplus / as sysdba ORA-12546: TNS:permission denied nt main err code: 516

One of the causes of such error I would like to describe below. 

It might sound crazy, but there is software of some vendors, and such software requires logon to an Oracle instance as sysdba from root OS account. 

I stuck into the error :


ERROR:
ORA-12546: TNS:permission denied

Addind root to group dba didn't help to resolve the ORA-12546, but adding root to oinstall did :). Actually root must be the member of group dba to avoid the

ERROR:
ORA-01017: invalid username/password; logon denied

You haven't to add root to these groups, you can simply use newgrp command (newgrp [-] oinstall , then newgrp [-] dba). After such 'manipulations' you will be able to logon as sysdba.

Good Luck !