查询所有表空间名称
select tablespace_name from dba_tablespaces;
查看表空间的名称和状态
select tablespace_name,status from dba_tablespaces;
查询当前表空间属性
select * from dba_tablespaces where tablespace_name='mtgyd'
删除表空间与表空间文件(注意:如果在创建表空间的时候带有双引号,则删除的时候也要带上)
DROP TABLESPACE "mtgyd" INCLUDING CONTENTS AND DATAFILES;
删除当前表空间的用户
drop user mtgyd cascade;
修改当前用户的密码(一般开发版本,有密码过期,所以在过期后,修改密码)
alter user system identified by manager;
查询所有用户
select username from dba_users;
查询当前所有用户的session sid值
select username,sid,serial# from v$session
select saddr,sid,serial#,paddr,username,status from v$session where username is not null-------------------此项待定。
通过查询当前连接用户的session sid值,删除其连接状态,则可以正常删除该用户。
alter system kill session '115,348';
-----------------USERNAME SID SERIAL# 此项暂时不需要用到。---------------------
创建表空间
create tablespace mtgyd_DB datafile 'D:\MyTools\oracle\oradata\sino\mtgyd_DB.dbf' size 100m autoextend on next 32m EXTENT management local;
创建用户并指定对应表空间
create user mtgyd identified by mtgyd default tablespace mtgyddb;
给用户授权dba权限
grant dba to mtgyd;
导出exp 导入imp
alter system kill session '115,348';
USERNAME SID SERIAL#
--------------------------------------ORACLE启动切换实例命令------------------------------------
---> sqlplus /nolog
---> conn / as sysdba
---> select name from v$database; // 查询当前实例名
---> select instance_name, status from v$instance; // // 查看实例状态
---> !lsnrctl status;查看实例监听器