Getting List of Users and Roles on Oracle DB

This is a simple SQL statement to get you a list of all users and their roles in the Oracle DB:

“SELECT * FROM DBA_role_privs;”

And if you want to get the list of users related to a specific role, you can simply modify the SQL statement to be like this:

“SELECT * FROM DBA_role_privs where GRANTED_ROLE=’SSE_ROLE’;”

Source: http://www.dbforums.com/oracle/1650816-how-get-list-all-users-their-roles.html

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

Knowing when you should be concerned about your Linux CPU Load Average

This is one of the most important things to learn by any System Admin.; the CPU Load Average.

You can get the value simply by running the command “top” to get you the average value in the last 1 min, 5 min and 15 min.

How can you know whether that load average is high or not? That depends on the number of cores you have on your server, so for example, if you have 1 core, then a max. of load average value of 1 would be ok, although you should be a little concerned when it reaches about 0.7 (70%), if you have 2 cores, then 1.4 would be the max. accepted value …etc.

You can get to know the number of cores you have by the following command: “cat /proc/cpuinfo | grep “model name” | wc -l“, so for example if you have 8 cores, then a value of 5.6 (70%) is the max. accepted value, where you should start getting worried afterwards.

As a rule: “The “100% utilization” mark is 1.00 on a single-core system, 2.00, on a dual-core, 4.00 on a quad-core, etc.”, and you can start worrying above the 70% utilization.

 

Source: http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages

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

How to get number of cores on your Linux Box

cat /proc/cpuinfo | grep “model name” | wc -l

example output: 24

This means that you have 24 cores on your server.

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

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