Useful shortcuts for vi editor

Thursday, 29 December 2016

How to merge text files in cmd?

Run this command in current path
CMD> 
for %f in (*.txt) do type "%f" >> merged.txt

Monday, 19 December 2016

How to rollback committed data from flashback?

To Check
SQL>
SELECT *
  FROM HR.EMPLOYEES
       AS OF TIMESTAMP TO_TIMESTAMP ('2016-12-19 21:35:00', 'YYYY-MM-DD HH24:MI:SS')

To Save Data As Temp Table
SQL>
CREATE TABLE HR.EMPLOYEES_TEMP AS
SELECT *
  FROM HR.EMPLOYEES
       AS OF TIMESTAMP TO_TIMESTAMP ('2016-12-19 21:35:00', 'YYYY-MM-DD HH24:MI:SS')
-- WHERE EMPLOYEE_ID = 100

How to see file extensions in current directory?

$ find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u

bash: /bin/rm: Argument list too long error Solution

Command
rm -f *

Error 
bash: /bin/rm: Argument list too long error

Solution
Use following command line
$ find . -maxdepth 1 -name "*.txt" -print0 | xargs -0 rm

Saturday, 17 December 2016

How to remove shutdown, restart, sleep and hibernate options from start menu?

Run gpedit.msc -> User Configuration -> Administrative Templates -> Startup Menu and Taskbar -> Edit policy setting to Enable "Remove and prevent access to the Shut Down, Restart, Sleep, and Hibernate commands" -> Done! :)

How to disable sleep option?

Run gpedit.msc -> Computer Configuration -> Administrative Templates -> System -> Power Management -> Sleep Settings -> Edit policy setting to Enable "Turn Off Hybrid Sleep (Plugged In) and (On Battery)" ->  Edit policy setting to Disable "Allow Standby States (S1-S3) when sleeping (Plugged In) and (On Battery)" -> Done! :)

Tuesday, 13 December 2016

How to compare schemas in Toad?

Open two connections like "HR" and "HRNEW" -> Database -> Compare -> Schemas -> Define Source and Target Schemas -> Select Object Types in "Object Types to Compare" -> Check and Set "Stop when # of differences reaches" option to more than "1000" like "10000" in "Misc Options" tab -> Click "Run" image -> Check script in "Sync Script" -> Lastly click "Move Script to Editor and Run Now" button -> That's all :)