--查看所有用户的连接数
select username,count(username) from v$session where username is not null group by username;
--查看用户会话的SID
select username,sid,serial# from v$session where username='AMI';
--删除连接绘画的SID
alter system kill session '47,21';
--删除用户
drop user AMI cascade;
--查询数据库的所有表空间的数据文件
select * from dba_data_files;
--删除表空间和临时表空间
drop tablespace BPAS including contents and datafiles cascade constraint;
drop tablespace BPAS_INX including contents and datafiles cascade constraint;
drop tablespace GROUP1 including contents and datafiles cascade constraint;
--创建ami用户并授予dba权限
create user ami identified by ami;
grant connect,resource,dba to ami;
--授予oracle用户识别/backup目录。自己理解的意思
create directory dump_dir as '/backup';
grant read,write on directory dump_dir to system;
--添加表空间和临时表空间
create tablespace BPAS datafile '/u01/app/oracle/oradata/bpas/db1.dbf' size 100M autoextend on;
create tablespace BPAS_INX datafile '/u01/app/oracle/oradata/bpas/db2.dbf' size 100M autoextend on;
create temporary tablespace GROUP1 tempfile '/u01/app/oracle/oradata/bpas/db3.dbf' size 500M autoextend on;
--以ami用户导入数据
--impdp ami/ami directory=dump_dir dumpfile=expdp_user_ ami.dmp logfile=impdp.log schemas=ami
--以ami用户导出数据ami用户所有数据
--expdp ami/ami directory=dump_dir dumpfile=expdp_user_ami.dmp logfile=expdp.log schemas=ami