设为首页 加入收藏

TOP

oracle使用脚本创建数据表空间和用户
2014-11-24 02:33:11 来源: 作者: 【 】 浏览:2
Tags:oracle 使用 脚本 创建 数据 空间 用户
oracle使用脚本创建数据表空间和用户
-- 创建表空间(企业库)-----
declare v_rowcount number(5);
begin
select count(*) into v_rowcount from dual
where exists (select 1 from dba_tablespaces where tablespace_name='PLSTWHEPT');
If v_rowcount = 0 Then
Execute immediate 'CREATE TABLESPACE PLSTWHEPT DATAFILE ''E:\app\lukelu\oradata\PLSTWHEPT.dbf'' SIZE 50M
AUTOEXTEND ON NEXT 1M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K
SEGMENT SPACE MANAGEMENT AUTO';
End If;
end;
/
www.2cto.com
-- 创建表空间(用户库)
declare v_rowcount number(5);
begin
select count(*) into v_rowcount from dual
where exists (select 1 from dba_tablespaces where tablespace_name='PLSTWMWH1');
If v_rowcount = 0 Then
Execute immediate 'CREATE TABLESPACE PLSTWMWH1 DATAFILE ''E:\app\lukelu\oradata\PLSTWMWH1.dbf'' SIZE 50M
AUTOEXTEND ON NEXT 1M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K
SEGMENT SPACE MANAGEMENT AUTO';
End If;
end;
/
---- 创建用户并把用户赋予某个空间----
declare v_rowcount number(5);
begin
select count(*) into v_rowcount from dual
where exists (select 1 from all_users where username= 'plstwms') ;
If v_rowcount = 0 Then
Execute immediate 'create user plstwms identified by "999666" DEFAULT TABLESPACE PLSTWHEPT TEMPORARY TABLESPACE TEMP';
End If;
end;
/
grant create any table to plstwms ;
grant dba to plstwms;
grant execute on DBMS_LOCK to plstwms;
grant select on DBA_OBJECTS to plstwms;
grant create any sequence to plstwms;
---- 创建用户----
declare v_rowcount number(5);
begin
select count(*) into v_rowcount from dual
where exists (select 1 from all_users where username= 'plstwms1') ;
If v_rowcount = 0 Then
Execute immediate 'create user plstwms1 identified by "999666" DEFAULT TABLESPACE PLSTWMWH1 TEMPORARY TABLESPACE TEMP';
End If;
end;
/
grant create any table to plstwms1 ;
grant dba to plstwms1;
grant execute on DBMS_LOCK to plstwms1;
grant select on DBA_OBJECTS to plstwms1;
grant create any sequence to plstwms1;
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇利用脚本建立scott模式 下一篇 linux系统oracle数据安装配置脚本

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·新书介绍《Python数 (2025-12-25 04:49:47)
·怎么利用 Python 进 (2025-12-25 04:49:45)
·金融界大佬力荐,Pyt (2025-12-25 04:49:42)
·你必须要弄懂的多线 (2025-12-25 04:22:35)
·如何在 Java 中实现 (2025-12-25 04:22:32)