创建表空间及用户的sql:
-- 重复执行时,先删除
declare
num integer;
begin
select count(1) into num from dba_users where username = upper('kd_sale_dx') ;
if num >0 then
execute immediate 'drop user kd_sale_dx CASCADE ';
end if;
select count(1) into num from dba_tablespaces where tablespace_name = upper('KTS_KD_SALE_dx') ;
if num >0 then
execute immediate 'drop tablespace KTS_KD_SALE_dx including contents cascade constraints ';
end if;
end;
/
-- 先创建表空间
create tablespace KTS_KD_SALE_dx
datafile 'D:\oradata\orcldx\KTS_KD_SALE_dx.DBF'
size 100M
reuse
autoextend on
next 500M
maxsize unlimited
online
nologging
segment space management auto
default nocompress
/
-- 创建用户,密码是 1
-- Create the user
create user KD_SALE_dx identified by "1" default tablespace KTS_KD_SALE_dx;
-- 给用户赋权限
-- Grant/Revoke role privileges
grant connect to KD_SALE_dx;
grant resource to KD_SAL