(2017/8/30)通过pl/sql登录到Oracle数据库上,然后执行菜单:文件/新建/命令窗口 ,
打开一个命令窗口然后在该命令窗口中执行脚本创建和删除表空间:
1.创建表空间:
create tablespace MOF_TEMP
datafile 'D:oracleproduct10.2.0oradataorclMOF_TEMP.dbf' size 500M
autoextend on next 100M maxsize unlimited logging
extent management local autoallocate
segment space management auto;
1) DATAFILE: 表空间数据文件存放路径
2) SIZE: 起初设置为500M
3) UNIFORM: 指定区尺寸为128k,如不指定,区尺寸默认为64k
4) 空间名称MOF_TEMP与 数据文件名称 MOF_TEMP.dbf 不要求相同,可随意命名.
5) AUTOEXTEND ON/OFF 表示启动/停止自动扩展表空间
6) alter database datafile ' D:oracleproduct10.2.0oradataorclMOF_TEMP.dbf ' resize 500m; //手动修改数据文件大小为500M
7) DROP TABLESPACE db_name_INCLUDING CONTENTS AND DATAFILES; //删除表空间
测试创建表空间
create tablespace IMSTEST
datafile 'D:ORACLEPRODUCT10.2.0ORADATAHNORCLIMTEST.def' size 200M
autoextend on next 20M maxsize unlimited logging
extent management local autoallocate
segment space management auto;
commit;
创建用户,设置DBA角色
CREATE USER MARTIN
IDENTIFIED BY martinpwd
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP;
--创建新用户
CREATE USER jack
IDENTIFIED BY "123"
DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP"
grant connect to jack ;
grant dba to jack ;
grant sysdba to jack ;
//删除用户
drop user jack cascade;
[Oracle 10g]-关于表空间的更名
SQL> SELECT file_name, tablespace_name FROM dba_data_files;
删除用户名字
drop user PROJECTNAME cascade;
create tablespace TBS_PROJECTNAMETEST datafile 'D: bs_PROJECTNAME_test.dbf' size 20000M
autoextend on next 1000M maxsize unlimited logging extent management local
autoallocate segment space management auto;
CREATE USER PROJECTNAME
IDENTIFIED BY "PROJECTNAME"
DEFAULT TABLESPACE "TBS_PROJECTNAMETEST"
TEMPORARY TABLESPACE "TEMP" ;
grant connect to PROJECTNAME ;
grant dba to PROJECTNAME ;
grant sysdba to PROJECTNAME ;
创建无限表空间 Sql代码
CREATE TABLESPACE test DATAFILE 'D:ORACLEPRODUCT10.1.0ORADATAORACLETEST1.DBF' SIZE 20000M
AUTOEXTEND ON NEXT 1000M MAXSIZE UNLIMITED LOGGING PERMANENT
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT MANUAL
FLASHBACK ON;
备注:随笔中内容来源于网上资料整理,仅供参考。