连接到 oracle

1
2
sqlplus /nolog
conn sys/sys@127.0.0.1/oral as sysdba;

1.删除

1
2
3
4
5
// 删除用户, $user_name替换成实际的用户
drop user $user_name cascade;

// 删除表空间, $tablespace_name替换成实际的表空间名
drop tablespace $tablespace_name INCLUDING CONTENTS;

2.创建

1
2
3
4
5
// 新增表空间
create tablespace $tablespace_name datafile '$tablespace_name.DBF' size 300m autoextend on next 10m maxsize unlimited;

// 新增用户
create user $user_name identified by $user_password default tablespace $tablespace_name;

3.授权

1
grant resource,connect,dba to $user_name;

4.导入数据

1
imp $user_name/$user_password@127.0.0.1/orcl file='D:\DB\0529\0529.dmp' full=y