使用数据库管理员身份登录
-- log as sysdba
sqlplus / as sysdba;
创建临时表空间
-- create temporary tablespace
create temporary tablespace szdt_temp_data
tempfile 'd:\szdt-environment\oracle-datafiles\szdt_temp_data.dbf'
size 32m
autoextend on
next 32m maxsize unlimited
extent management local;
创建表空间
-- create tablespace
create tablespace szdt_data
logging
datafile 'd:\szdt-environment\oracle-datafiles\szdt_data.dbf'
size 32m
autoextend on
next 32m maxsize unlimited
extent management local;
创建用户
-- create user
create user szdt identified by szdt
account unlock
default tablespace szdt_data
temporary tablespace szdt_temp_data;
给用户授予权限
-- grant permission to user
grant dba,connect,resource to szdt;
删除用户
-- delete user
drop user szdt cascade;
删除临时表空间/表空间
-- delete tempory tablespace / tablespace
drop tablespace szdt_temp_data including contents and datafiles;
drop tablespace szdt_data including contents and datafiles;
连接到用户
-- connect to user
conn szdt/szdt@127.0.0.1:1521/orcl
导出dmp文件
-- export to dmp file
exp szdt/szdt@orcl file=d:/szdt-environment/backup-dmps/szdt.dmp
导入dmp文件
-- import from dmp file
imp szdt/szdt@orcl file=d:/szdt-environment/backup-dmps/szdt.dmp full=y
这些就是oracle在命令行下创建表空间、创建用户、授权角色和导入导出用户数据的所有操作命令。