Category Archives: Uncategorized

How to determine history of DB startup in Oracle 11g

SQL> SELECT STARTUP_TIME FROM dba_hist_database_instance ORDER BY startup_time DESC; STARTUP_TIME ————————————————————————— 29-SEP-13 03.43.07.000 AM 29-SEP-13 03.42.31.000 AM 29-SEP-13 03.12.45.000 AM 29-SEP-13 03.11.28.000 AM 28-SEP-13 11.56.35.000 PM 07-SEP-13 10.04.07.000 PM 6 rows selected. Credit goes to Abdulrahman Galal from Oracle.

Posted in Uncategorized | Tagged , , , | Leave a comment

Replacing a string with another in a text file using sed

sed -i ‘s/old-test/new-text/g’ filename This replaces the word old-test with the word new-text in the file named filename.

Posted in Uncategorized | Tagged , , , | Leave a comment

Delete files older than X days

find /path/to/folder -mtime +14 -exec rm {} \; This finds all files within that folder that are older than 14 days, then executes rm on them

Posted in Uncategorized | Tagged , , , , | Leave a comment

How to switch from one user to another in sqlplus

for example, you’re connected as sysdba using “sqlplus / as sysdba”, all you have to do is type “connect”, then enter the desired username and password, and there you go!

Posted in Uncategorized | Tagged , , , | 2 Comments

How to get current logged-in user in sqlplus

select user from dual;

Posted in Uncategorized | Tagged , , | 2 Comments