1、使用sqlplus登录oracle服务器
如果是本机 使用sqlplus username/password (sa sysdba、as sysoper)即可
如果远程登录 则使用 sqlplus username/password@ip/dbname(sa sysdba、as sysoper)
2、创建、删除用户
create user username identified by password;
DROP USER username CASCADE
3、查看用户表空间
select username,default_tablespace from user_users;
4、创建、删除表空间
CREATE TABLESPACE nameDATAFILE 'E:\tablespace\demo' size 800M
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO;
drop tablespace test_data including contents and datafiles
5、授权表空间
grant unlimited tablespace to username;
6、修改默认表空间
alter user username default tablespace tablespacename;
7、查看登录用户的角色权限
select * from role_sys_privs;
8、导入导出备份文件
exp demo/demo@127.0.0.1:1521/orcl file=f:/f.dmp full=y
exp demo/demo@orcl file=f:/f.dmp full=y
imp demo/demo@orcl file=f:/f.dmp full=y ignore=y
将数据导入不同的用户
imp system/密码 fromuser=源用户名 touser=目标用户名 file=xxx.dmp ignore=y grants=y
imp system/manager@orcl file=tank log=tank fromuser=seapark TABLES=(a,b)