1. 程式人生 > >oracle建庫SQL語句

oracle建庫SQL語句

1. 建立表空間

create temporary tablespace XNGPXT_TMP tempfile '/u01/opt/11g/oracle/oradata/XNGPXT_TMP.DBF' size 100m reuse autoextend on next 20m maxsize unlimited;  
create tablespace XNGPXT datafile '/u01/opt/11g/oracle/oradata/XNGPXT.DBF' size 200M reuse autoextend on next 40M maxsize unlimited default storage(initial 128k next 128k minextents 2 maxextents unlimited);

2. 建立使用者

create user username identified by password default tablespace XNGPXT temporary tablespace XNGPXT_TMP;
grant create session ,resource , dba to username identified by password;

3. 刪除表空間和使用者

drop tablespace XNGPXT_TMP including contents and datafiles cascade constraint;
drop tablespace XNGPXT including contents and datafiles cascade constraint;
drop user username cascade;

4. 修改表空間的名字

alter tablespace XNGPXT rename datafile '/u01/opt/11g/oracle/oradata/orcl/OSPBASE_DEV.DBF' to '/u01/opt/11g/oracle/oradata/XNGPXT.DBF';