Saturday, August 25, 2012

v$session equivalent in sqlserver ,User Connected to SqlServer and Kill session

SELECT login_name,session_id
FROM sys.dm_exec_sessions
go



For kill Session
select  login_name, session_id,  host_name from 
FROM sys.dm_exec_sessions ;


KILL SESSION_ID
go

Monday, July 23, 2012

Create table at Run Time

create or replace procedure p1
as
begin
execute immediate 'create table table_name (column_name datatype)';
end;
/



SQL> exec p1;
ORA-01031: insufficient privileges
ORA-06512: at "schema.procedure", line 4 / line 7
ORA-06512: at line 1

oops error !!!!!!


Don't worry

Just add one line to your procedure:



create or replace procedure p1
AUTHID CURRENT_USER
as
begin
execute immediate 'create table table_name (column_name datatype)';
end;
/

SQL> exec p1;
PL/SQL procedure successfully completed.

Sunday, July 1, 2012

TRY to execute select query on tablAe , that contains BLOB datatype

sql>select * from blob_test; (in 10g)
error
SP2-0678: Column or attribute type can not be displayed by SQL*Plus

solve (try this)
-------
 select utl_raw.cast_to_varchar2(a)  from blob_test;
-- where 'a' is column_name and 'blob_test' is table_name

Wednesday, June 27, 2012

ORACLE Error - ORA-01034 & ORA-27101

Error : ORA-01034: ORACLE not available
       ORA-27101: shared memory realm does not exist

Cause: This error shown while connected to oracle schema,because of Oracle service is running but database is not opened.

Solution -> connect to oracle schema and startup database
 sql>sys/password as sysdba
 sql>startup


Monday, June 18, 2012

SP2-0110: Cannot create save file "afiedt.buf"

This error is most general error, everybody face this error either he is a student or trainee or experienced. Most of trainee starts from oracle and we generally used the SQL CMD to write the commands and execute the command. The feature of SQL CMD is that we can re-edit the SQL if it is not executed well, to use this feature we need to assign a buffer file where it can save the the previous execution history.

Error
SP2-0110: Cannot create save file "afiedt.buf"

SOLUTION-

1.Open CMD
2.set editor=notepad
3.open sqlplus and login with user

4.Thats it.
web stats