Wednesday, December 22, 2010

Recovering a dropped User.

Jonathan Lewis provided a link on how to recover a dropped user and I went to that link to find out how that was done. This is the link to that site.

I tried it out on the database on my laptop and it works like jiffy. Below is what I did.




create user flashtest identified by flashtest ;

grant connect,resource,dba to flashtest;

conn flashtest/flashtest;

create table emp(ename varchar2(20),city varchar2(20));

insert into emp values('azar','riyadh');

insert into emp values('kareem','dubai');

insert into emp values('azmi','chennai');

insert into emp values('idress','riyadh');

insert into emp values('ajmal','chennai');

commit;

select current_timestamp from dual;

conn / as sysdba

drop user flashtest cascade;

shutdown immediate

startup mount

flashback database to timestamp to_date('22-DEC-10 09.25.30','DD-MM-YY HH24:MI:SS');

alter database open read only;

conn flashtest/flashtest;

select * from emp;

host exp flashtest/flashtest file=emp.dmp log=emp.log direct=y consistent=y statistics='none';

conn / as sysdba

shutdown immediate

startup mount

recover database;

alter database open;

conn sys as sysdba

create user flashtest identified by flashtest;

grant connect,resource,dba to flashtest;

host imp flashtest/flashtest file=emp.dmp log=emp.log full=y



This seem to be perfect if we can shutdown and startup the data base so easily. How do we recover if the database can not be shutdown and still the user need to be recovered. I know if it is asking for too much. But since I am a developer and not a DBA down time is still a taboo for me. I am eager to know how this is done traditionally.

Alert Log

We can obtain the location of the alert log using the below query.

select VALUE from v$parameter where upper(name) ='BACKGROUND_DUMP_DEST';

Tuesday, December 21, 2010

Nocopy

In today's plsqlchallenge I learned another new thing. It is the NOCOPY option for the parameters in a procedure or a function. I was under the impression that when we pass a variable with the nocopy option the variables changes in the procedures will not be passed over. But that doesn't seem to be correct. When we pass a parameter with the NOCOPY option, no seperate copy of the variable is made in the memory and the passed variable is used to modify. This makes more sense while using collection variables. If for example we pass a VARRAY as in out parameter without the NOCOPY option then the variable is copied to a temporary variable and then the changes are made. In the case of NOCOPY the changes are made to the original variable itself. In case an exception occurs then in the case of NOCOPY the original variable would have changed but in the case where NOCOPY is not specified the orginal value remains intact. Below is the sample code from todays sample quiz.



create or replace package plch_pkg
is
type number_nt is table of number;

procedure pass_nums1 (nums in out number_nt);

procedure pass_nums2 (nums in out nocopy number_nt);

procedure show_nums (nums in number_nt);

end;
/

create or replace package body plch_pkg
is
procedure pass_nums1(nums in out number_nt) is
begin
for indx in nums.first..nums.last
loop
nums(indx):=nums(indx)*2;
raise value_error;
end loop;
end pass_nums1;

procedure pass_nums2(nums in out nocopy number_nt) is
begin
for indx in nums.first..nums.last
loop
nums(indx):=nums(indx)*2;
raise value_error;
end loop;
end pass_nums2;

procedure show_nums(nums in number_nt) is
l_return pls_integer :=0;
begin
for indx in nums.first..nums.last
loop
l_return := l_return+nums(indx);
end loop;
dbms_output.put_line(l_return);
end show_nums;
end plch_pkg;
/

show err


declare
nums1 plch_pkg.number_nt :=plch_pkg.number_nt(1,2,3);
nums2 plch_pkg.number_nt :=plch_pkg.number_nt(1,2,3);
begin
begin
plch_pkg.pass_nums1(nums1);
exception when others then
plch_pkg.show_nums(nums1);
end;
begin
plch_pkg.pass_nums2(nums2);
exception when others then
plch_pkg.show_nums(nums2);
end;
end;
/

Tuesday, November 16, 2010

Alias In Unix

Alias is definitely one of those commands which we would have read about in the beginners books on learning unix. But it took me 10 years to really use this command.

I had to change directories frequently and was tired of typing the whole directoy path and was thinking of a smarter way to accomplish it. I googled for a while and found this method.

alias abc = ‘cd change/to/directory/abc’

And now add the above command to the .profile so that we can just use the abc command when ever we want to move to the directory abc. Its very basic but pretty cool.

Tuesday, November 09, 2010

Loading data from a file into the database quickly

Below is a small procedure I created to load the contents of a file quickly into a database.



create or replace directory ext as 'C:\Nirmala\OracleLearning\ext';

create or replace procedure search_file(l_file_name varchar2
, search_string varchar2 default null ) as
l_table_count number;
begin

select count(1)
into l_table_count
from all_tables
where table_name = upper(trim(replace(l_file_name,'.','')));
if(l_table_count=1) then
execute immediate ' drop table '||trim(replace(l_file_name,'.',''));
end if;

execute immediate ' create table '||trim(replace(l_file_name,'.',''))||' (text clob ) organization external (type oracle_loader default directory ext location ('''||l_file_name||'''))';

execute immediate ' create table '||trim(replace(l_file_name,'.',''))||'_perm as select text , rownum line_number from '||trim(replace(l_file_name,'.',''));

end ;

Monday, November 08, 2010

Password Case sensitive in Oracle 11g.

Today I learned a new thing that from Oracle 11g the password has become case sensitive. The user id is still not case sensitive.
In older verison I never had a problem when I entered the password in upper or lower case. I checked on 10g and the password is case insensitive but in 11g it is sensitive. I guess if I read the new features guide I would have already know it. So its time again to remind my self that I need to read it.

Thursday, November 04, 2010

7 Sins to stay away from

Politics without principles.
Wealth without work.
Pleasure without conscience.
Knowledge without character.
Commerce without morality.
Science without humanity.
Worship without sacrifice.

Tuesday, November 02, 2010

Word Power Made Easy - 2

fungible
:easily replaceable.

Autarky
:the condition of self-sufficiency, especially economic, as applied to a nation.
:a national policy of economic independence

Zeitgeist
:The taste, outlook, and spirit characteristic of a period or generation.

snivel
:to weep or cry with sniffling.

Schwag
:free merchandise

garter
:Also called, British , sock suspender, suspender. an article of clothing for holding up a stocking or sock, usually an elastic band around the leg or an elastic strap hanging from a girdle or other undergarment.
:a similar band worn to hold up a shirt sleeve.
:a leather strap for passing through a loop at the back of a boot and buckling around the leg to keep the boot from slipping.

foibles
:a minor weakness or failing of character; slight flaw or defect: an all-too-human foible.

paean
:any song of praise, joy, or triumph.

francophile
:friendly to or having a strong liking for France or the french.

kibble
: pet food.

tykes
: any small child.

Wednesday, October 27, 2010

Oracle Database Manual Creation

Finally I create a database manually on my machine. This is no big thing but I consider it an achivement in itself. Below are the steps I followed to create my sample database.

1) Create the init.ora file: I copied the sample init.ora file provided by the Oracle installations which will be located at ORACLE_HOME\dbs folder. I modifed the parameters in the file and created the flash_recovery_area folder.
2) Connect to an idle Instance: I have a default database already installed on my machine when I initially installed Oracle. So I had to shut it down using the "shutdown immediate" command.(The shutdown command was somehow taking a very long time so I restarted the machine and shutdown the instance again.) Then I connected to the idle instance.
3)Start the instance: Start the instance using the below command
startup nomount pfile='c:\mynewdb\init.ora' <\code>
4) Create Database Command: Execute the create database command now as shown below.



CREATE DATABASE mynewdb
USER SYS IDENTIFIED BY mynewdb
USER SYSTEM IDENTIFIED BY mynewdb
LOGFILE GROUP 1 ('c:\mynewdb\redo01.log') SIZE 100M,
GROUP 2 ('c:\mynewdb\redo02.log') SIZE 100M,
GROUP 3 ('c:\mynewdb\redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
DATAFILE 'c:\mynewdb\system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE 'c:\mynewdb\sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE tbs_1
DATAFILE 'c:\mynewdb\tbs_01.dbf' SIZE 325M REUSE
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE 'c:\mynewdb\temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE UNDOTBS
DATAFILE 'c:\mynewdb\UNDOTBS.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;


I ran into the below issues which took quite some time for me to find and fix them.

a)For undo table space, in the init.ora I gave a different name for the undo tablespace and in the create database command I used a different one, because of which my create statement was failing.

b)After I fixed that issue I have still getting some error during the default tablespace creation and I found that in my create statement the default tablespace does not have a datafile associated with it. I added the highlighted line in my create database command and the command worked fine. I am not sure what the issue really is because I took that particular create statement from the Oracle Database Administrator's Guide. Well I am not too bothered about that cause my database is created now(Yay..)

5)TableSpace Creation: Now I created some more tablespaces using the below commands.


CREATE TABLESPACE users LOGGING
DATAFILE 'c:\mynewdb\users01.dbf'
SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;

CREATE TABLESPACE indx LOGGING
DATAFILE 'c:\mynewdb\indx01.dbf'
SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;



6)Run Script to Create Data Dictionary Views: Finally I ran the catproc.sql and catalog.sql files located in the \rdbms\admin directories.
Well that completes my database creation manually. I am hoping that my original database installed previously also works fine.


I created a new user in the db and granted the create session and resource privileges. After that I try to connect to the DB but I get the below error

Error accessing PRODUCT_USER_PROFILE
Warning: Product user profile information not loaded!
You may need to run PUPBLD.SQL as SYSTEM

I connect as system and then run the pupbld.sql file from the sqlplus\admin directory. After that I am able to connect to the directory without any issues.


set ORACLE_SID = mynewdb

Thursday, October 14, 2010

dxdiag

Today I got a new machine(yay!!) and I had to install all my applications again on my machine. I wanted to know wether my machine was a 32 bit machine or a 64 bit one. I right clicked on "my computer" properties but that didn't give me enough information so I had to google and came across this command "dxdiag". When we click start>run and then type "dxdiag" then a diagnostic window opens which gives the details of the hardware on the machine. More can be read from this link on wiki site. But the irony is that even after checking all this I am unable to find whether my machine is a 32 bit one or a 64 bit one. I downloaded the 64 bit versions of Oracle developer and the database hoping that my machine is indeed a 64 bit one. Lets see if all the installs work or not.

Update:
Well supposedly my machine is not a 64 bit machine. I got to know that from the microsoft site. So now I am going to download all the 32 versions and install them again.

Monday, October 04, 2010

Testing my first Javascript on my blog

Its been just two weeks that I started working on Javascript and I am loving every bit of it. I am not an expert yet. What the.. I am not even an intermediate developer of Javascript but I think I will be there sooner than later. I just wanted to check if I can write a little javascript code in my blog. So this posting is a experiment in the direction.

Click here to know who is the model in the above pic.

Thursday, September 30, 2010

Spooling a Query into a .csv file from sqlplus

This is one of the ways we can spool the output of a query into a .csv file.

set colsep , -- To separate columns with a comma
set pagesize 0 -- only one header row
set trimspool on -- To remove trailing blanks
set linesize 1000 -- It should be the sum of the column widths
set echo off -- Incase you have it on.
set feedback off -- To prevent any feedback rows int he output file.
spool test.csv

select *
from all_users;

spool off

Monday, August 30, 2010

Swap Space(Virtual Memory)

Today I was trying to install a program on my machine and I got a error stating the swap space was not sufficient. After I goggled a little I found that swap space is nothing but virtual memory and to increase the virtual memory I had to do this . Well I never imagined it would be that simple. Anyways now I am juggling with the real issues related to the program's installation and not something related to my hardware.

Friday, July 16, 2010

UTL_FILE Error

I was getting the below error while working on a small program using UTL_FILE.

ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 41
ORA-06512: at "SYS.UTL_FILE", line 478

I have been banging my head on what could be the possible cause for this error. Because I created the directory and it has all the read write permissions on it.

Finally after some goggling I found the issue was because I was passing the directory names in lower case. Till now I was under the impression that Oracle would take lower case parameter as well. Well now I know that I need to pass the directory name in upper case at least while executing the UTL_FILE package.

Wednesday, July 07, 2010

DBA_TAB_MODIFICATIONS

Today I got to learn about this view in Oracle which stores all the inserts, updates and deletes done on a particular table. There are three views corresponding to it.
DBA_TAB_MODIFICATIONS
ALL_TAB_MODIFICATIONS
USER_TAB_MODIFICATIONS
All we need to in this case is to execute the below procedure to update these views with the information.

exec dbms_stats.flush_database_monitoring_info

This proc would populate the data into the views and we can easily tell the number of inserts, updates and deletes that happened on a particular table. I learned this primariy from this link. According to Martin's blog the data would not record insertes done by multiple table inserts. But would record all the other DML operations on the table.

Friday, June 18, 2010

DBMS_UTILITY.FORMAT_ERROR_BACKTRACE

As much as I like coding in PL\SQL I always hated those exceptions in the code. Whenever the code fails all I get is the line number of the error on the last exception section of the code and finding out on which line the error really occured would invlove removing the exception block which sometimes is really wacky when
the process invloves calling multiple program units.
But today I came across this new utility in 10g DBMS_UTILITY.FORMAT_ERROR_BACKTRACE which can be used to trace the line numbers of all the programs in which the error occured.

I am really ashamed of myself for not knowing it this long. 10g was released long back and 11g is also soon becoming matured enough for many applications to be upgraded to it. But I am glad I learned about it neverthless. I guess its high time I read the new features document.

Example Code:
--------------
declare
l_emp_id number(10);
begin
select EMPNO
into l_emp_id
from emp
where 1=2;
exception when no_data_found then
dbms_output.put_line('sqlcode-->'sqlcode);
dbms_output.put_line('DBMS_UTILITY.FORMAT_ERROR_BACKTRACE-->'DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
end;
/

Thursday, June 17, 2010

Escape in SQL

Below is one example to use escape in SQL(Oracle).

select * from all_tables where table_name like '%TEST/_%TABLE%' ESCAPE '/';

Using Bulk collect in PL\SQL

I am used to using bulk collect in cursor variables. But I guess i have'nt worked on it enough to master its usage. Yesterday's question on plsqlchallenge really made me thing of them some more. I am reproducing the examples here for my reference in the future.

You can use BULK COLLECT with both implicit and explicit cursors, in both static and dynamic SQL, and with cursor variables. The following blocks demonstrate each approach.
With an explicit cursor:

DECLARE
CURSOR employees_cur IS SELECT * FROM employees;
TYPE employees_aat IS TABLE OF employees%ROWTYPE
INDEX BY BINARY_INTEGER;
l_employees employees_aat;
BEGIN
OPEN employees_cur;
FETCH employees_cur BULK COLLECT INTO l_employees;
CLOSE employees_cur;
END;

With an implicit cursor:

DECLARE
TYPE employees_aat IS TABLE OF employees%ROWTYPE
INDEX BY BINARY_INTEGER;
l_employees employees_aat;
BEGIN
SELECT * BULK COLLECT INTO l_employees FROM employees;
END;

With a dynamic SQL statement (Oracle 9i Release 2 and above):

DECLARE
TYPE employees_aat IS TABLE OF employees%ROWTYPE
INDEX BY BINARY_INTEGER;

l_employees employees_aat;
BEGIN
EXECUTE IMMEDIATE 'SELECT * FROM employees' BULK COLLECT INTO l_employees;
END;

And here's an example of using BULK COLLECT with a cursor variable:

DECLARE
l_cursor sys_refcursor;
l_list DBMS_SQL.varchar2s;
BEGIN
OPEN l_cursor FOR
SELECT last_name
FROM employees;

LOOP
FETCH l_cursor
BULK COLLECT INTO l_list
LIMIT 100;

EXIT WHEN l_list.COUNT = 0;
END LOOP;

CLOSE l_cursor;
END;

Thursday, May 27, 2010

Result_cache

Result_Cache is a new feature in 11g using which we can store the results of a query in SGA. We can define deterministic functions also using the result_cache keyword. Here is a nice reference which gives a small example of how result_cache really works.

I came across the result_cache in one of the questions I was answering for plsqlchallenge.com . My rank naturally stumbled becasue of the fact that I did'nt know anything about how to use the result_cache in a function. Good thing is that now I know it.

Tuesday, May 25, 2010

Translate

I was answering this question on plsqlchannel.com yesterday. I was way too confident that my answer was correct that I clicked the answer without giving it even a second thought. It was only when I saw my rank drop a whopping 30 points that I noticed the blunder that I did. The first blunder is that I should have cross checked my result once before submitting. Cause getting it right is more important that getting it faster. This is one thing that I have to relearn and hopefull teach my daughter. And the second is that I did'nt know that TRANSLATE always needs all the three arguments as not nulls. If anyone of them is a null then the result would be a null.

I was under the impression that TRANSLATE('ABCD','BCD','') would simply replace the 'BCD' with the '' and the reuslt would be 'A' . But I was utterly wrong. TRANSLATE would not do this. There is another function for this kind of a thing and we need to use REPLACE for that. REPLACE('ABCD','BCD','') would give the result of 'A'.

One thing to learn today. Actually two things. One in Oracle and one in Life. Get it right not just fast.

Monday, May 10, 2010

The Audacity of Hope - Book Review

Today I officially completed the book "The Audacity of Hope " by Barak Obama. I brought this book while I was traveling to Pune in Hyderabad airport. I was pleasantly surprised to see that book in Hyderabad. The book was priced at Rs.250 which I thought was a pretty good deal for a book in an airport.

The book definitely is a good read and a very pleasant one for that. I think for me it was my first introduction to American history and the amazing things that this country has in store for itself and for the whole world. Being an immigrant in this country and that too an unwilling one I had trouble adjusting to American way of living and the way things work in here But once I started working I think I have started realizing the good sides of it. And reading "The Audacity of Hope" really made me appreciate the american way even more. What is more endearing to me is the realization of the inherent flaws of humans and still striving to make this world a better place. And the way Obama writes his thought, it seems like its a no brainer. What is to be appreciated is the blatant frankness of the author in admitting the flaws that American ways have inflicted on foreign soils.

Reading the way in which Obama explains some of the points from the American Constitution, I envied all those students who got to listen to him really teach about American Constitution in his classes. Of course I know I would be worst fit in such a setting, but even then what is wrong in dreaming..

What is more interesting to me personally was the last chapter in which he talks about Family and his Family in particular. The relationship he has with Mitchel and how she manages and juggles as a working woman and a mom. Being a working mom myself I did identify very much with many of the feelings Obama says Mitchell Obama goes through, like feeling not good enough as a mom and at work. I am sure there is no reason for Mitchel Obama to feel that way but I definitely for one feel that way so many times. But reading this book has given me a new perspective of looking at things and made me realize that I am not alone and there are hundred of people who feel like me. And what I am doing is the best for my kids and my family,

Obama is a great writer and thinker. He has a uncanny way of connecting with people through his books. I can'nt wait to read his first book "The dreams of my father".

Tuesday, May 04, 2010

Open Command Prompt from any folder.

Follow this link to open command prompt from any folder.

Wednesday, March 24, 2010

dbms_utility.comma_to_table

This is the name of the proc which made my life much easier today. I had a requirement to update a table based on two parameters passed to a procedure. The update would have been simple had those parameters been tow columns corresponding to the two columns in a table. But those two parameters would be a comma separated strings. I need to derive the values by parsing the strings.
Below is a sample program used to solve this issue.


create or replace procedure emp_upd_prc
(ip_ename varchar2,
ip_ename_upd varchar2) as

l_ename_upd_array dbms_utility.uncl_array;
l_count binary_integer;
l_ename_array dbms_utility.uncl_array;

begin

dbms_utility.comma_to_table(ip_ename,l_count,l_ename_array);
dbms_utility.comma_to_table(ip_ename_upd,l_count,l_ename_upd_array);


for i in 1..l_count
loop

update emp
set ename = l_ename_upd_array(i)
where ename = l_ename_array(i);

end loop;

end emp_upd_prc;
/

But the limitations with using dbms_utility.comma_to_tabs procedure is that it can not take number string. Like in my case i tried to send a list of empno as the first parameter and a list of names as the second parameter. But i am getting the following error.

ERROR at line 1:
ORA-20001: comma-separated list invalid near 4
ORA-06512: at "SYS.DBMS_UTILITY", line 238
ORA-06512: at "SYS.DBMS_UTILITY", line 255
ORA-06512: at "SCOTT.EMP_UPD_PRC", line 12
ORA-06512: at line 1

After some googling I found that this procedure have some limitations. It does not accept numbers or special characters in strings. I guess there should be some way to overcome these issues. But as of now my requirement luckily has character data as both the parameters and not numeric, in which case I would have spent more time of finding the alternatives to the problem.

Friday, February 12, 2010

Inserting into a CLOB column using JDBC.

Below is a sample program to insert data into a table which has a clob column. The insert is pre compiled in the database in a procedure which takes in parameters for the columns. One of the parameters is the of type clob. The clob parameter is read from a file set as a parameter.

import java.io.*;
import java.sql.*;
import java.lang.reflect.*;
import oracle.jdbc.*;
import java.util.*;

public class CallProc {
public static void main(String args[]) throws Exception {

DriverManager.registerDriver(new oracle.jdbc.OracleDriver());

//intg6i
//Connection conn =DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = godzilla)(PORT = 1541))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = DI55)))", "mars", "mars");

String url = "jdbc:oracle:thin:@godzilla:1541:DI55";

Properties props = new Properties();
props.put("user", "mars");
props.put("password", "mars");
props.put("SetBigStringTryClob", "true");

Connection conn = DriverManager.getConnection(url, props);
CallableStatement cstmt = null;
ResultSet rs = null;

System.out.println("Here");
cstmt = conn.prepareCall("{ call MS_2262_TRAN_EMAIL_STG_I(?,?,?,?,?,?,?,?,?,?,?,?,?,? )}");
cstmt.setString(1,"SKamble@phxa.com");
cstmt.setString(2,"VSavvich@phxa.com");
cstmt.setString(3,"ARavindran@phxa.com;NSarmadzhiev@phxa.com;NGodavarthi@phxa.com");
cstmt.setString(4,"");
cstmt.setString(5,"FW: Natixis WO for web services F/O/R and fulfillment");
cstmt.setString(6,"");
cstmt.setString(7,"01/25/2010 16:44:25");
cstmt.setString(8,"Y");
cstmt.setString(9,"00000000A49F721FD035D511808D009027A83B5007003937B623EDADD3118071009027A83B50000000AA28D70000499E0AB23BD25A45AAE078142A9F1989000003B2D8CC0000");

String str =readFileAsString(args[0]);
cstmt.setString(10, str);
cstmt.setString(11,"KMILLER");
cstmt.setString(12,"KMILLER");
cstmt.setString(13,"KMILLER");
cstmt.registerOutParameter(14,OracleTypes.CURSOR);
System.out.println("Here");
cstmt.executeQuery();

rs = (ResultSet)cstmt.getObject(14);
}

private static String readFileAsString(String filePath)
throws java.io.IOException{
StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = new BufferedReader(
new FileReader(filePath));
char[] buf = new char[1024];
int numRead=0;
while((numRead=reader.read(buf)) != -1){
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
buf = new char[1024];
}
reader.close();
return fileData.toString();
}

}

Sunday, January 31, 2010

Sudo

This is what I learned on sudo today. I hope i will update this post at a later time with more information but i am typing this down so that i don't forget and so that I can reference it at a later point of time.

We can sudo into a unix/linux box using the command sudo -u dba -i. (dba is the user whose permissions you will have ). After sudo ing into the machine we can connect using sysdba and access the all the database features.

I was doing some execises and came across this problem of creating a view in a schema. All I had to do was grant the create view previlage to this user but i did'nt know how to connect as dba or any other user in the database using which i can grant the premission to this view. So what i did was sudoed into the machine using sudo -u dba -i and connected to the database as sysdba. Then granted the permission. I never thought it could be so easy. But i guess when you have complete peace(@3 am in the morning) ideas strike you fast.

Friday, January 15, 2010

Quotes

18-Feb-2010
------------
You would not bother about what other people think of you if you know how seldom they do.

01-Mar-2010
------------
Our doubts are traitors, and make us lose the good we oft might win, by fearing to attempt.

12-Feb-2010
------------
Prefer self-restraint to self-denial.(Shashi Tharoor on fasting).

19-jan-2010
------------
The inherent vice of capitalism is the unequal sharing of blessings. The inherent blessing of socialism is the equal sharing of misery

15-jan-2010
------------
Don't just read the easy stuff. You may be entertained by it, but you will never grow from it.