一 管理用户
1 查询用户集合
select username from dba_users;
A 查询某个用户是否存在
select username from dba_users where username='用户名'
2 查询用户权限
select * from dba_sys_privs where grantee='用户名'
3 创建用户
create user 用户名 identified by 密码;
4 删除用户
drop user wp cascade;
5 切换用户
A conn / as sysdba //切换管理员
b conn 用户名/密码 //切换普通用户
6 细分授予权限
A grant create session to wp;//授权登入权限
B grant unlimited tablespace to wp;//授予zhangsan用户使用表空间的权限
C grant create table to wp;//授予创建表的权限
D grante drop any table to wp;//授予删除表的权限
E grant create sequence,select any sequence to 用户//授予 用户查询和创建序列的权限
7 给用户授予全部权限
A grant
create session, create any table, create any view ,create any index, create any procedure,
alter any table, alter any procedure,
drop any table, drop any view, drop any index, drop any procedure,
select any table, insert any table, update any table, delete any table
to wp;
B grant all to wp;
8 用户之间表访问的权限授予
A grant select on tablename to zhangsan;//授予zhangsan用户查看指定表的权限
B grant drop on tablename to zhangsan;//授予删除表的权限
C grant insert on tablename to zhangsan;//授予插入的权限
D grant update on tablename to zhangsan;//授予修改表的权限
E grant insert(id) on tablename to zhangsan;
F grant update(id) on tablename to zhangsan;//授予对指定表特定字段的插入和修改权限,注意,只能是insert和update
G grant alert all table to zhangsan;//授予zhangsan用户alert任意表的权限
9 取消用户权限
A revoke delete any table from wp;//取消用户删除权限,其他于此类似
B revoke
create session, create any table, create any view ,create any index, create any procedure,
alter any table, alter any procedure,
drop any table, drop any view, drop any index, drop any procedure,
select any table, insert any table, update any table, delete any table
from wp; 二 管理表
1 创建表
create table 表名;
A 主键 primary key
C 设置约束 constraint
2 删除表
drop table 表名
3 修改表名
rename 原表名 to 新表名
4 查询表结构
DESC 表名
5 清除表数据
delete from 表名
6 清空删除表
PURGE recyclebin;
7 彻底删除表
drop table 表名 purge 三 字段操作
1 增加字段
A 增加单字段
alter table 表名 add 字段名 数据类型;
B 增加多字段
alter table demo1 add(字段名 数据类型, ......依此类推);
2 删除字段
alter table 表名 drop column 字段名;
3 修改字段名称
ALTER TABLE 表名 RENAME COLUMN 旧字段名 TO 新字段名;
4 修改字段类型
ALTER TABLE 表名 MODIFY 字段名 新字段类型; 四 注释
1 查询表注释
select comments from user_tab_comments where table_name='表名';//需要注意的是表名需要大写,相应的还有dba_tab_comments,all_tab_comments,这两个比user_tab_comments多了ower列。
2 增加表注释
comment on table demo1 is 注释;
3 查询表字段注释
SELECT TABLE_NAME,COLUMN_NAME,COMMENTS FROM USER_COL_COMMENTS WHERE TABLE_NAME = '表名';//需要注意的是表名需要大写
4 增加字段注释
comment on column 表名.列名 is '注释'; 五 序列
1 查询用户序列
select sequence_name,sequence_owner from ALL_SEQUENCES where sequence_owner='用户名';//注意用户名得大写
2 增加序列
create sequence demo1_seq minvalue 最小值 maxvalue 最大值 start with 1 increment by 1 cache 10;
3 查询序列
select * from ALL_SEQUENCES where sequence_name='序列名';//注意序列名需要大写
4 删除序列
drop sequence DEMO1_SEQ;
5 或许序列值
序列名.nextval 六 触发器
1 查询触发器
2 增加触发器
3 删除触发器

Oracle 常用命令的更多相关文章

  1. Oracle常用命令1

    一. 安装是用户管理: sqlplus /nolog; connect /as sysdba; alter user sys identified by change_on_install; alte ...

  2. oracle常用命令总结

    声明:本文为博主在做项目中用到的一些常用命令,请勿转载,只为保存. oracle常用命令总结 创建表空间: --create tablespace vms--datafile 'e:\vms.dbf' ...

  3. oracle常用命令【转载】

    oracle常用命令 一.Oracle数据库实例.用户.目录及session会话查看: 1.ORACLE SID查看设置 查看SID.用户名 $ env|grep SID .select * from ...

  4. Data Base Oracle 常用命令

    Data Base  Oracle 常用命令 1.登录:(不需要密码,属于管理员权限) conn /as sysdba; 2.查看数据库存储位置: select name from v$datafil ...

  5. oracle常用命令(1)

    oracle常用命令 一.登录 1.管理员身份登录:sqlplus/nolog--->conn/as sysdba 2.普通用户登录:sqlplus/nolog---->conn 用户名/ ...

  6. Oracle常用命令大全(很有用,做笔记)

    一.ORACLE的启动和关闭 1.在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a.启动ORACLE系统 oracle>svrmgrl ...

  7. oracle常用命令(比较常见好用)

    一.ORACLE的启动和关闭 1.在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle  a.启动ORACLE系统 oracle>svrmgr ...

  8. linux下 oracle常用命令

    打开图形化窗口: 1)Database Configuration Assistant windows    (添加数据库实例) $ dbca 2)Oracle Net Configuration A ...

  9. 收集整理的oracle常用命令大全

    一.Oracle的启动和关闭 1.在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a.启动ORACLE系统 oracle>svrmgrl ...

  10. Oracle常用命令大全

    一.ORACLE的启动和关闭 1.在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a.启动ORACLE系统 oracle>svrmgrl ...

随机推荐

  1. Flex4之元数据标签使用

    Flex 元数据标签 1.[ArrayElementType] 使用ArrayElementType元数据标签可以让你定义数组元素的数据类型. 程序代码: [ArrayElementType(&quo ...

  2. PHP 正则表达式语法

    则表达式简介 在某些应用中,往往有时候需要根据一定的规则来匹配(查找)确认一些字符串,如要求用户输入的 QQ 号码为数字且至少 5 位.用于描述这些规则的工具就是正则表达式. 最简单的匹配 最简单的匹 ...

  3. php执行的困惑

    最近在用php语言实现各种数据结构算法排序,可以说是很蛋疼的一件事,最近遇到了一个问题,不知道是什么原因,姑且放到这里,希望能看到的人予以帮助 首先我用php写了这样一个类 class ListNod ...

  4. MySQL查询缓存详解

    一:缓存条件,原理 MySQL Query Cache是用来缓存我们所执行的SELECT语句以及该语句的结果集,MySql在实现Query Cache的具体技术细节上类似典型的KV存储,就是将SELE ...

  5. zookeeper-3.4.6安装

    下载zookeeper包并解压 配置.在conf文件夹中将zoo_sample.cfg复制一份为zoo.cfg 修改zoo.cfg 在/home/admln/zookeeper中新建一个文件myid( ...

  6. Simple Membership 学习笔记

    第一步:新建项目后添加对WebMartix.Data 和 WebMatrix.WebData的引用第二步:在web.config中添加membership配置节第三步:修改Global.asax文件 ...

  7. HDU 3999 The order of a Tree 二叉搜索树 BST

    建一个二叉搜索树,然后前序输出. 用链表建的,发现很久没做都快忘了... #include <cstdio> #include <cstdlib> struct Node{ i ...

  8. 关于location.href几种用法的区别

    常见的几种开发形式: self.location.href; window.location.href; this.location.href; location.href; parent.locat ...

  9. C# WPF 连接数据库Sqlhelper类

    从视频上学习到的WPF连接数据库的方法 需要配置一个 configuration 文件,包含 SQL instance 的相关信息 using System; using System.Collect ...

  10. 网络编辑器插件ckeditor+ckfinder配置

    原帖地址 另外一个 去掉编辑器的下边栏 在config.js中加入: config.removePlugins = 'elementspath'; config.resize_enabled = fa ...