Wednesday, June 23, 2010

How to connect sys without sysdbda or sysoper privileges

conn sys/sys as sysdba


alter system set O7_DICTIONARY_ACCESSIBILITY = true scope=spfile;


O7_DICTIONARY_ACCESSIBILITY is static parameter restart is necessary


shutdown immediate

startup

conn sys/sys

Monday, June 14, 2010

To create an external table you have to create a directory.
this directory contains a file, book1.csv
so logon to sys as sysdba
then issue the command
create or replace directory EXTERNAL as 'E:\EXTERNAL\';

GRANT READ, WRITE ON DIRECTORY EXTERNAL TO SCOTT;

Now connect scott

now issue the following script :
create table extern_emp
(
id varchar2(10),
name varchar2(200),
address varchar2(1000)
)
organization external
(
default directory EXTERNAL
access parameters
(
records delimited by newline
fields terminated by ','
)
location('book1.csv')
)
parallel
;



But the CSV files are comma-seperated.


Any field of the csv file may contain comma.
So the previous script will be the following with highlighted portion:

create table extern_emp
(
id varchar2(10),
name varchar2(200),
address varchar2(1000)
)
organization external
(
default directory EXTERNAL
access parameters
(
records delimited by newline
fields terminated by ','
optionally enclosed by '"'
)
location('book1.csv')
)
parallel
;