Monday, January 13, 2014

How to create a user with read only priviliges for the schema

This ain´t an easy task as I thought you will need to run some commands before you have it going.

In this case let's assume that you already have the database created and the required accounts and that you are familiar with sqlplus

1) Login as system
sqlplus system/pwd@SID




2) You will need to create the user

CREATE USER your_user IDENTIFIED BY yourPassword;


This user will be created on the default tablespace




3)  Allow the user to create a session and view the table names

GRANT CREATE SESSION TO your_user;
GRANT SELECT ON SYS.EXTERNAL_TAB$ to your_user;



4) Create the queries to grant permissions on every table:
SELECT 'GRANT SELECT ON your_schema.' ||TABLE_NAME || ' TO your_user;' FROM DBA_TABLES WHERE OWNER='schema_owner';



5) Execute the result of the previous query
GRANT SELECT ON your_schema.Table1 TO DEVELS;
GRANT SELECT ON  your_schema.Table2 TO DEVELS;
...
GRANT SELECT ON  your_schema.TableN TO DEVELS;

Now your will have a user that can only see the data there

Saturday, November 23, 2013

Are you a smart talker?

ID-100198985 Image courtesy of franky242/ FreeDigitalPhotos.net
Smart talkers are those that can have a conversation about the organization strategy, they have made an awesome research about the topic, they bring the latest hype words and everything sounds amazing, however they cannot execute

Smart talkers just keep talking but they are unable to put things into action, the problem is that in order for your organization to succeed you need to actually deliver.
We have to remember that leadership is about results, it doesn’t really matter how you do it or what is your style, you need to deliver. It is not enough to know what to do, you need to translate it to actions.

A common mistake in organizations is that people who tends to talk a lot receives more attention that they deserve. While probably they are not helping in the execution of your strategy, they are just trying to impress the boss. It is not that you must pick those quite thinkers (since that will depend in your organization culture) but if you really want to actually embrace collective intelligence in you organization, you also need to give some leverage to those that don’t talk much but can actually deliver, these people is the one that knows the product, the customers and they can help you to get better ideas of how to improve your product or service.

How can we spot smart talkers?
  • They usually say something like: That’s the same idea I had (but it was not executed by him)
  • They will talk about the same problems and solutions (but no one has done something about it)
  • They will just keep talking but they aren’t actually delivering.
  • They will usually use complex statements with hype words to sound smarter (Remember if you understand something you must be able to explain it to a 5 years old)

After all talking about great ideas is not the final end, it is executing what matters.

Friday, November 15, 2013

How to make good decisions in team


this way, that way Photo by Lori Greig

One person is not enough to make a good decisions, many teams are involved in the process of making decisions and it is very common to set a meeting to collaborate and make a consensus decision, it is called “Collective intelligence”.

CI_types1s Image by wikipedia
You should follow the following strategies to make better decisions in your team:
  1. Suspend initial judgment: Avoid the straw polls or any communication related to the topic in discussion before the meeting. These talks can create an initial judgment that will automatically create barriers in your mind to make good decisions.
  2. Define a goal as “problem to be solved” not a “judgment to be made”: In other words we are here to solve a problem not to find who is right or wrong.
  3. Paired comparison of candidates by discussing each competency: This is a rather expensive process but if you have the time, you can compare each option and figure out why one is better than the other, this will help to base your decisions on facts not on feelings.
  4. Have everyone fill a balance sheet on what is good and what is bad (fact or issues, not judgments). Don’t do it in the group (otherwise you will have correlated errors): This will help visualize better the decisions that were made and avoid focusing on commonalities.
  5. “Pre-mortem” of the decision: You need to visualize what would happen if you made X o Y decision, this will help to visualize the different scenarios, especially worst case scenarios.
  6. Have decision challengers or devil’s advocates on a rotating basis: You need to have someone to challenge the decisions made, it will help to expose the unique information and avoid the common knowledge effect.
  7. Avoid the hidden profile: During discussions people tends to focus on information they share in common which can contribute to bad decisions because it is incomplete (it lacks unique information that only some part of the group has). You need encourage people to share the unique information and make it available to everyone avoiding in this way the hidden profile effect.

References:
  • Rao, Hayagreeva (NA), Harnessing Collective Intelligence. Lecture conducted from Stanford University, Stanford, CA.

Friday, November 8, 2013

Oracle: Move undo tablespace to a different path

1) Login as sysadmin to the database (Remember that you need to be logged into the server, you cannot do this remotly)


   1: #sqlplus '/ as sysdba'

sql1

2) Check your currents undo tablespaces

select to_char(begin_time, 'DD-MON-RR HH24:MI') begin_time, 

to_char(end_time, 'DD-MON-RR HH24:MI') end_time, 

tuned_undoretention from v$undostat order by end_time;


3) Create the new undo tablespace



CREATE UNDO TABLESPACE undotbs_01 DATAFILE 

'/[your_path]/undo01.dbf' SIZE 2M REUSE AUTOEXTEND ON;

sql3

4) Set your system to use the new tablespace



ALTER SYSTEM SET UNDO_TABLESPACE = 

undotbs_01; 
sql4

5) Restart your database (There are some other ways but I prefer this one)

SHUTDOWN IMMEDIATE

sql5
STARTUP
sql6

6)  Drop your old undo tablespace to free some space

DROP TABLESPACE undotbs_02 INCLUDING CONTENTS AND DATAFILES;
sql7
Notes:
I had to do this movement in order to create some space in the file system, the partition was completely full and the database crashing. One of those things that you find in your development servers sometimes :)

Thursday, October 31, 2013

Correct overgeneralization

Correct overgeneralization is the feeling that you can forecast where things are going with just a few hints, some people can call it a hunch but the people that really has it, they are correct most of the time. This "ability" is especially useful for companies dealing (creating) with innovation where things have not been set yet and we need to forecast and set the expectations over the product that might have not even been designed yet. A leader with this skill can help you to create a vision of the product in a short or even long term.

One of the things we have to be careful with this type of distortion is when people have too much power because they can become overconfident in the decisions that they are taking or they stop listening to the advices of others to focus on this vision. As leaders is better if we can back up these decisions with data or a close tracking of the expectations and possible turnovers that we can find.

Wednesday, October 30, 2013

The five cognitive distortions of people who gets stuff done

This is from lecture from Michael Dearing about the characteristics that he has found to be common across colleges and founders that get things done.

  • Personal exceptionalism: This is the believe that you are unique and your destiny is to do something great, something like if you were chosen for that.
  • Dichotonomous thinking: If you are one of those people that things that something is right or wrong and there is not a gray area in the middle, this is you cognitive distortion
  • Correct overgeneralization: You are able to forecast in someway what is going to happen or what is going to be needed and you are correct most of the time.
  • Blank-canvas thinking: This is for the people who is able to think outside the box, even when there is an established way of doing things and they know it, they will find other way around to make things probably better.
  • Schumpeterianism: This is based on the last name of an infamous economist Joseph Schumpeter and it means someone who is able to create innovation by the meaning of destroying his previous creation. Sometimes to make something better you have to kill your favorites, this is something that I heard from Stephen King in the book on writing.
 What I mainly learned about this talk is how to find and control entrepreneurs and direct them the right way or even I felt identified with some of those distortions and it helped to better understand what is the risk of following such schemas.

Friday, October 25, 2013

Good boss, bad boss by Bob Sutton

A very interesting book and lecture from Bob Sutton about leadership and what makes the difference between a good boss and a bad boss.



In this book Bob defines a good boss and someone that people likes to work with him, it doesn't really matter if the numbers of the company are excellent or if the leader actually makes more money per year., what is important is that the people that he leads will want to work and continue working with him. Don't misunderstand this as a poor performers.

Starting with the facts that you will actually increase your chances to live longer (because bosses are the most stressful part of most jobs) to the fact that with the right influence people can perform better.

Across the book, Bob mentions a series of examples and ideas to improve your influence over people, what traps to avoid and how to be a good boss.

These are some of the ideas that were given during the lecture:
  • A good boss have a moderate assertiveness. As a leader you most know where the team is heading and you must be able to select what to do and what not to do If you made a mistake you must be able to retake the route.
  • A leader must be able to get real information from his subordinates. I know it sounds easy but it is actually hard because we tend to kill the messenger, so people will tend to tell you only good news.
  • A leader must be able to set an environment where people feel confident to share their ideas and fight for it. Everyone can have a great idea, if  they can actually talk about it, you must protect those that are sensitive to rejected ideas and encourage people to put ideas over the table every time they can.
  • It is better when you break things down to smaller tasks. People will always feel better when they feel that they are moving forward and that they are actually accomplishing something. Note to myself:. I'm realizing that this goes hand on hand with the fact that you need to break down things to small task in your project plan to create a better estimation (if a task takes longer than 4 weeks, maybe it is time to break it down)
  • Smart talk trap: Avoid the smart talkers, people that will just talk about how things should be done but they don't actually execute it, this people is not useful to the organization.
  • If you made a mistake it is better if you accept it, show that you have learn and implement a solution.
  • The toxic tandem: Leaders have the attention of their let's call followers, but people will imitate the behavior of the leader, some times leaders will just try to ignore and do whatever they want (including some misbehavior just because they are leaders) you must watch out for this, this will also be imitated by your followers. The problem is that eventually some leaders tend to ignore this, be careful.
  • Power, when you are the leader you have the power to make certain decisions the problem with this is that people with power tends to focus on themselves and pay little attention to others which leads to poor decision making.
  • A great phrase I got from the lecture is: Debate, decide and deliver. In an open environment it is probable that you will find situations where two people have similar ideas but they can't decide which one take this must exist for a successful company but what it is more important is that you must not focus on keep fighting, you must focus on delivering.
  • In a small team a bad resource can ruin your team for a 30% to 40%. That's why I think that the process of hiring new people must be done carefully (remember it is easier to kick someone out when you are in this part)