1. 管理用户
  2. 1 查询用户集合
  3. select username from dba_users;
  4. A 查询某个用户是否存在
  5. select username from dba_users where username='用户名'
  6. 2 查询用户权限
  7. select * from dba_sys_privs where grantee='用户名'
  8. 3 创建用户
  9. create user 用户名 identified by 密码;
  10. 4 删除用户
  11. drop user wp cascade;
  12. 5 切换用户
  13. A conn / as sysdba //切换管理员
  14. b conn 用户名/密码 //切换普通用户
  15. 6 细分授予权限
  16. A grant create session to wp;//授权登入权限
  17. B grant unlimited tablespace to wp;//授予zhangsan用户使用表空间的权限
  18. C grant create table to wp;//授予创建表的权限
  19. D grante drop any table to wp;//授予删除表的权限
  20. E grant create sequence,select any sequence to 用户//授予 用户查询和创建序列的权限
  21. 7 给用户授予全部权限
  22. A grant
  23. create session, create any table, create any view ,create any index, create any procedure,
  24. alter any table, alter any procedure,
  25. drop any table, drop any view, drop any index, drop any procedure,
  26. select any table, insert any table, update any table, delete any table
  27. to wp;
  28. B grant all to wp;
  29. 8 用户之间表访问的权限授予
  30. A grant select on tablename to zhangsan;//授予zhangsan用户查看指定表的权限
  31. B grant drop on tablename to zhangsan;//授予删除表的权限
  32. C grant insert on tablename to zhangsan;//授予插入的权限
  33. D grant update on tablename to zhangsan;//授予修改表的权限
  34. E grant insert(id) on tablename to zhangsan;
  35. F grant update(id) on tablename to zhangsan;//授予对指定表特定字段的插入和修改权限,注意,只能是insert和update
  36. G grant alert all table to zhangsan;//授予zhangsan用户alert任意表的权限
  37. 9 取消用户权限
  38. A revoke delete any table from wp;//取消用户删除权限,其他于此类似
  39. B revoke
  40. create session, create any table, create any view ,create any index, create any procedure,
  41. alter any table, alter any procedure,
  42. drop any table, drop any view, drop any index, drop any procedure,
  43. select any table, insert any table, update any table, delete any table
  44. from wp;
  45.  
  46. 管理表
  47. 1 创建表
  48. create table 表名;
  49. A 主键 primary key
  50. C 设置约束 constraint
  51. 2 删除表
  52. drop table 表名
  53. 3 修改表名
  54. rename 原表名 to 新表名
  55. 4 查询表结构
  56. DESC 表名
  57. 5 清除表数据
  58. delete from 表名
  59. 6 清空删除表
  60. PURGE recyclebin;
  61. 7 彻底删除表
  62. drop table 表名 purge
  63.  
  64. 字段操作
  65. 1 增加字段
  66. A 增加单字段
  67. alter table 表名 add 字段名 数据类型;
  68. B 增加多字段
  69. alter table demo1 add(字段名 数据类型, ......依此类推);
  70. 2 删除字段
  71. alter table 表名 drop column 字段名;
  72. 3 修改字段名称
  73. ALTER TABLE 表名 RENAME COLUMN 旧字段名 TO 新字段名;
  74. 4 修改字段类型
  75. ALTER TABLE 表名 MODIFY 字段名 新字段类型;
  76.  
  77. 注释
  78. 1 查询表注释
  79. select comments from user_tab_comments where table_name='表名';//需要注意的是表名需要大写,相应的还有dba_tab_comments,all_tab_comments,这两个比user_tab_comments多了ower列。
  80. 2 增加表注释
  81. comment on table demo1 is 注释;
  82. 3 查询表字段注释
  83. SELECT TABLE_NAME,COLUMN_NAME,COMMENTS FROM USER_COL_COMMENTS WHERE TABLE_NAME = '表名';//需要注意的是表名需要大写
  84. 4 增加字段注释
  85. comment on column 表名.列名 is '注释';
  86.  
  87. 序列
  88. 1 查询用户序列
  89. select sequence_name,sequence_owner from ALL_SEQUENCES where sequence_owner='用户名';//注意用户名得大写
  90. 2 增加序列
  91. create sequence demo1_seq minvalue 最小值 maxvalue 最大值 start with 1 increment by 1 cache 10;
  92. 3 查询序列
  93. select * from ALL_SEQUENCES where sequence_name='序列名';//注意序列名需要大写
  94. 4 删除序列
  95. drop sequence DEMO1_SEQ;
  96. 5 或许序列值
  97. 序列名.nextval
  98.  
  99. 触发器
  100. 1 查询触发器
  101. 2 增加触发器
  102. 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. delphi 判断是否出现滚动条

    delphi 判断是否出现滚动条     if (GetWindowlong(Stringgrid1.Handle, GWL_STYLE) and WS_VSCROLL) <> 0 the ...

  2. Android播播放完SD卡指定文件夹音乐之后,自动播放下一首

    最近做一个项目,需要连续播放音乐,播放完一首歌之后,自动播放完下一首歌.不要重复播放. 代码如下: package com.example.asyncplayer_ex; import java.io ...

  3. 2.目录:疯子讲iOS课程

    目录:疯子讲iOS课程 写这个目录让我纠结好几天,一是我在考虑要不要从Objective-c基础开始讲,是否要使用ARC的方式讲,二是本人的游戏这几天正在封测,时间也比较紧张.纠结于有些朋友可能还不了 ...

  4. cocos2d-x 资源路径研究

    调用cc.FileUtils:getInstance():addSearchResolutionsOrder("src"); 加入�一个搜索路径,就能够直接载入src文件夹下的资源 ...

  5. win7中USB音箱没有声音解决的方法

    Win7装好后,原来在XP中工作正常的USB小音箱却不工作了,重装了声卡驱动还是一样,后来通过下面尝试最终好用了. 1.右键右下角喇叭button. 2.点击"播放设备". 3.设 ...

  6. C 高级编程3 静态库与动态库

    http://blog.csdn.net/Lux_Veritas/article/details/11934083http://www.cnblogs.com/catch/p/3857964.html ...

  7. 文件I/O(不带缓冲)之文件共享

    UNIX系统支持在不同进程间共享打开的文件. 内核使用三种数据结构表示打开的文件,它们之间的关系决定了在文件共享方面一个进程对另一个进程可能产生的影响. (1)每个进程在进程表中都有一个记录项,记录项 ...

  8. 在查找预编译头时遇到意外的文件结尾。是否忘记了向源中添加“#include "StdAfx.h"”?

    在查找预编译头时遇到意外的文件结尾.是否忘记了向源中添加“#include "StdAfx.h"”? 右键选择该文件.cpp格式的->属性->预编译头,→ 不使用预编译 ...

  9. Jquery 之 日常积累(一)

    1.jquery函数在参数中传递 this,正确的写法: //页面中用 GetString(this); //脚本中定义 function GetString(obj){ var str = $(ob ...

  10. 沈逸老师PHP魔鬼特训笔记(2)

    一.这一课会学习到几个懒人函数: 1.file_put_contents (PHP 5, PHP 7) file_put_contents — 将一个字符串写入文件 说明 int file_put_c ...