Cannot Login to Remote Desktop With Correct Credentials

You are using Microsoft RDP and trying to connect to a remote machine. You enter the correct credentials but you cannot login. The message that you get is that the credentials are incorrect. While there could a litany of reasons why this is happening, but one more think you could check is the registry entry for the attribute LmCompatibility level at this location HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\LmCompatibilityLevel. Try setting it to 5 which essentially sets NTLMv2 to security level 5. Retest your issue and it might just work.

Find Children of a Parent ESS Job

Just a handy query to fetch the children of an ESS Job:

SELECT requestid, 
       scheduled scheduled_time, 
       absparentid parent_id,
DECODE(state,
       1,'Wait', 
       11,'Warning',
       2,'Ready', 
       12,'Succeeded',
       3,'Running', 
       13,'Paused',
       4,'Completed', 
       14,'Pending Validation',
       5,'Blocked', 
       15,'Validation Failed',
       6,'Hold', 
       16,'Schedule Ended',
       7,'Canceling', 
       17,'Finished',
       8,'Expired', 
       18,'Error Auto-Retry',
       9,'Canceled', 
       19,'Error Manual Recovery',
       10,'Error',
       state) status
FROM FUSION.ESS_REQUEST_HISTORY
WHERE absparentid = '489329'; --parent Process ID

Regular Expressions to the Rescue

A few situations where using regular expressions led to better, cleaner and leaner code. More information is available, of course, in the manual.

--remove all special characters except the following:
--those between ' ' and '{'
--'}' and '~'
--the number of nested REPLACEs in the code that I had to clean up
--gave me a serious headache
SELECT REGEXP_REPLACE(:p_string,'[^[ -{,},~]]*','') FROM dual;

Short Explanation:
–  : Range operator, used here to indicate the range ‘ ‘ to ‘{‘
[ … ]  : Matches any single character in the list within the brackets
[^ … ] : Matches any single character not in the list within the brackets
*  : Matches zero or more occurrences of the preceding subexpression
So, the expression [^[<list of characters>]]* matches all characters which are not in <list of characters>

--in a given string
--if a double-quote is preceded by letter(s), the output should be a string with the double-quote (") replaced with two double-quotes ("")
--if a double-quote is preceded by number(s) then the output should be a string where the number(s) is enclosed within double-quotes
--for example
--abc"d should produce abc""d as output
--ab"c"d should produce ab""c""d as output
--abc"d12" should produce abc""d"12" as output
--ab12"c34" should produce ab"12"c"34" as output
WITH mydata AS(
select 'abc"d' test_string from dual union all
select 'ab"c"d' test_string from dual union all
select 'abc"d12"' test_string from dual union all
select 'abc"d5"' test_string from dual union all
select 'ab12"c34"' test_string from dual
)
SELECT test_string
,regexp_replace(test_string,'([[:digit:]]*")','"\1') result_string
FROM mydata;

Short Explanation:
[ … ] : Matches any single character in the list within the brackets
[[:digit:]] : POSIX character class which matches digits
* : Matches zero or more occurrences of the preceding subexpression
( … ) : Treats the expression within parentheses as a unit or subexpression
\n : Back reference. Matches the nth preceding subexpression. The \1 used here refers to the first preceding subexpression which is ([[:digit:]]*”)
So, the expression ([[:digit:]]*”) matches all double-quotes optionally preceded by numbers and replaces it with the a double-quote followed by the matched expression.

--Given a string of the form HOURS:MINUTES:SECONDS (ex. 11:32:09)
--add the values of HOURS, MINUTES and SECONDS to SYSDATE
SELECT TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS') sys_date
, TO_CHAR(SYSDATE + NUMTODSINTERVAL(REGEXP_SUBSTR (:p_string,'[^:]+',1, 1),'HOUR') --add hours
+ NUMTODSINTERVAL(REGEXP_SUBSTR (:p_string,'[^:]+',1, 2), 'MINUTE') --add minutes
+ NUMTODSINTERVAL(REGEXP_SUBSTR (:p_string,'[^:]+',1, 3),'SECOND') --add second
,'DD-MON-YYYY HH24:MI:SS') sys_date_added_to_tag from dual;

Short Explanation:
[^ … ] : Matches any single character not in the list within the brackets
+ : Matches one or more occurrences of the preceding subexpression.
So, the expression [^:]+ will return one or more consecutive characters which are not colons and hence will return 11, 32 and 09