Monday, November 14, 2016

Convert Oracle date to int using native Microsoft date

SQL Server/Excel

select getdate() 'Today',convert(int,getdate())

2016-11-14 16:05:35.207 42687

Oracle

select current_date,cast(current_date - date '1900-01-01' as int)
from dual;

14-NOV-16 42687

Thursday, November 10, 2016

Oracle subtract days/Hours from current timestamp


select to_timestamp(to_char(systimestamp + INTERVAL '-1' DAY, 'dd-mon-yy hh.mi.ss.ff4 AM')) from dual; ------ -1 day


select to_timestamp(to_char(systimestamp + INTERVAL '-2' HOUR, 'dd-mon-yy hh.mi.ss.ff4 AM')) from dual; ----- -2 hours current date time


select to_timestamp(to_char(systimestamp + INTERVAL '-1' DAY, 'dd-mon-yy hh.mi.ss.ff4 AM')) + INTERVAL '-2' HOUR from dual; ------- -2 hours -1 day

Thursday, August 25, 2016

Change Linux root user password of Cloudera Hadoop nodes

Cloudera Manager only uses the root credentials when adding a new node to the cluster. Once the node has been added and the Cloudera Manager agent deployed the server will no longer use the root credentials.

i.e.  Once your cluster is set up, you can safely change the root password. Cloudera Manager does not save SSH credentials and all credential information is discarded once the installation is complete.


Changing the root password will not affect any currently deployed services. Nodes talk to each other o SSH key based authentication 

sh-4.2# passwd root
New password: 
Retype new password:
passwd:all authentication tokens updated successfully.

Monday, June 29, 2015

Splunk useful commands

put cluster in maintenance mode

$SPLUNK_HOME/bin/splunk enable maintenance-mode

rolling restart


splunk rolling-restart cluster-peers


Daily License volume by host

index=_internal source=*license_usage.log type=Usage 
 | stats sum(b) as bytes by h 
 | eval MB = round(bytes/1024/1024,1)
 | fields h MB
 | rename h as host


Friday, May 29, 2015

Command to recursively delete files older than N days

this command will delete all files inside c:\Folder and subfolders which are older than <Number of Days>

forfiles -p "C:\Folder" -s -m *.* /D -<Number of Days> /C "cmd /c del @path"

Wednesday, April 22, 2015

List of Splunk universal forwarders with client OS & version

index=_internal source=*metrics.log group=tcpin_connections | eval sourceHost=if(isnull(hostname), sourceHost,hostname) | dedup sourceHost | table sourceHost sourceIP os version | sort version

Friday, March 27, 2015

Linux Commands

List all Linux users

cut -d: -f1 /etc/passwd

set password never to expire

chage -I -1 -m 0 -M 99999 -E -1 username

find process uptime

systemctl status splunk