oracle常用DBA命令

1.查看用户拥有的数据库对象
select object_name from user_objects;


2.查看约束信息
select constraint_name from user_constraints;


3.查看用户所拥有的表
select table_name from user_tables;


select *from tab;


4.查看用户所拥有的视图
select view_name from user_views;


5.查看用户所拥有的触发器
select trigger_name from user_triggers;


6.查看用户拥有的序列
select sequence_name from user_sequence;


7.查看用户拥有的索引
select index_name from user_indexs;


8.显示当前用户
show user;


9.切换用户
conn scott/tiger;


10.将用户赋予某种角色登录
conn scott/tiger as sysdba;


11.查看所有用户
conn system/unis;
select username from dba_users;


12.查看用户所拥有的权限
select *from session_privs;


13.给用户加锁
alter user scott account lock;


14.给用户解锁
alter user scott account unlock;


15.修改用户密码
alter user zzg identified by zzg123


16.新建用户
create user zzg identified by zzg123;


17.删除用户及相关对象
drop user zzg cascade;


18.给用户赋权(多个采用逗号间隔)
grant create session,create table to zzg;


19.分配表空间给用户
alter user zzg default tablespace ts_zzg;


20.授权表空间给用户
grant unlimited tablespace to zzg;


21.删除表空间
drop tablespace ts_zzg including contents and datafiles cascade constraints;

你可能感兴趣的:(oracle,sql)