作者:给彼此祝福_完美旳谢幕_835 | 来源:互联网 | 2014-07-11 17:33
PL/SQL创建表空间、创建用户、给用户授权declareusrNamevarchar2(20):'用户名';pwdvarchar2(20):'密码';tsNamevarchar2(20):'xmszcgl_aid';dfP
PL/SQL创建表空间、创建用户、给用户授权
declare
usrName varchar2(20) := '用户名';
pwd varchar2(20) := '密码';
tsName varchar2(20) := 'xmszcgl_aid';
dfPath varchar2(300) := 'D:\dataSource\xmszcgl_aid.data';
tmpStr varchar2(300);
isDelUsrAndTs boolean := false;
begin www.2cto.com
if isDelUsrAndTs then
tmpStr := 'drop user '||usrName||' cascade';
execute immediate tmpStr;
tmpStr := 'drop tablespace '||tsName||' including contents and datafiles';
execute immediate tmpStr;
end if;
tmpStr := 'create tablespace '||tsName||' datafile '''||dfPath||''' size 300m autoextend on next 5m maxsize unlimited';
execute immediate tmpStr;
tmpStr := 'create user '||usrName||' identified by '||pwd||' default tablespace '||tsName;
execute immediate tmpStr;
tmpStr := 'grant connect,resource,dba to '||usrName;
execute immediate tmpStr;
end;
作者 fengxuezhiye