How to unlock an Oracle user

ALTER USER myuser ACCOUNT UNLOCK;

Convert Timestamp to Date or Date to Timestamp online

This webpage has an applet that does the job and more :
http://www.ewert-technologies.ca/home/html/timestamp_converter.html

If you like a non-applet solution try : http://timestamp-to-date.com/ or the best one out there in my opinion http://www.epochconverter.com/

Get Current Time or Date of an Oracle DB


Note: This is on Oracle DB

To get the server Date:
SELECT sysdate FROM dual;
This will give you the system date in this format, Ex: 18-AUG-09

To get the server TimeZone:
SELECT sessiontimezone FROM dual;
This will give you the system timezone in this format, Ex: Asia/Calcutta

To get the server time:
SELECT systimestamp FROM dual;
This will give you the system time in this format,
Ex: 18-AUG-09 04.49.43.648480000 AM -07:00

How to clear the memory cache in Linux

sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

How to findout who locks your Oracle DB user


select USERID,
         userhost,
         decode(returncode,01017,'Login Error','Acount Locked') "ISSUE",
         spare1,
         TO_CHAR ( CAST(
                                   ( FROM_TZ(
                                                     CAST(
                                                               TO_DATE(
                                                                              TO_CHAR( ntimestamp# , 'DD/MM/YYYY HH:MI PM'),
                                                                              'DD/MM/YYYY HH:MI PM'
                                                                            )
                                                                AS    TIMESTAMP
                                                             ) ,
                                                      'GMT'
                                                   ) AT LOCAL
                                    )
                                    AS TIMESTAMP)
                                  , 'DD/MM/YYYY HH:MI PM')  "Time",
           sqltext,
           comment$text from SYS.aud$
           where ( returncode=1017 OR returncode=28000 )
           order by ntimestamp# desc ;



How to delete records older than 7 days from sys.aud$

delete from sys.aud$ where trunc(NTIMESTAMP# ) < trunc(sysdate - 7);

you can change the number 7 above to any number of days you like.

Global search and replace in vi or vim

To perform a global search and replace in vi, use the search and replace command in command mode ( press Esc to enter command mode )


:%s/search_string/replacement_string/g