Friday, August 7, 2009

Export sqlplus results to a csv file

Create the file buy_export.sql:
set echo off

set feedback off

set linesize 100

set pagesize 0

set sqlprompt ''

set trimspool on

spool buyInfo.csv


select buyid||','|| name
from dbbuy;

spool off

Run it using

sqlplus -S [username]/[password]@[SID] @buy_export.sql

Sphere: Related Content

Tuesday, August 4, 2009

Change the permission of table space

To change the permission of table space to read write use following sql command

alter tablespace TFR_REP read write;

Sphere: Related Content

Monday, August 3, 2009

To change the oracle user tablespace

In case if you have assigned wrong tablespace while creating a user, you can change tablespace of that user by following command.

first connect with the system on the database where you have created this user.

alter user AHSAN_TFR default tablespace TFR_REP quota unlimited on TFR_REP;

must assign quota otherwise you cannot run any SQL statement.

Sphere: Related Content