数据库对象的同义词和序列
数据库  /  管理员 发布于 7年前   193
回顾简单的数据库权限等命令;
解锁用户和锁定用户alter user scott account lock/unlock;//system下查看系统中的用户select * dba_users;//创建用户名和密码create user wj identified by wj;identified by //授予连接权和建表权grant connect to wj;连接权grant resource to wj;建表//授予查询和更新权限grant select to wj;grant Update to wj;//授予增删改查权限grant all to wj;//移除所有权限grant revoke to wj;//授予wj用户操作scott用户下emp表的权限grant all on scott.emp to wj;//移除wj用户操作scott用户下emp表的权限grant all on scott,emp from wj;//授予wj用户操作scott用户下emp表的权限grant connect on scott.emp to wj;grant select on scott.emp to wj;grant Resource on scott.emp to wj;grant Update on scott.emp to wj;//移除wj用户操作scott用户下emp表的权限grant connect on scott.emp from wj;grant select on scott.emp to wj;grant Resource on scott.emp from wj;grant Update on scott.empfrom wj;grant<--_>revoke to <---->from
同义词:私有的,公共的(public)
同义词是现有对象的一个别名
私有同义词只能在其模式内访问,且不能与当前模式的对象同名
私有同义词的定义:---定义私有同义词
system下创建
create synonym e for scott.emp;
删除同义词
drop synonym e;
公有同义词可被所有的数据库用户访问
定义公共的同义词;
create public synonym e for scott.emp;
删除前面创建的同义词dd
create or replace public synonym dd for scott.emp
序列:--序列是用于生成唯一、连续序号;可以是升序的,也可以是降序的
NEXTVAL 返回序列的下一个值
CURRVAL 返回序列的当前值
--创建序列 create sequence toys_seq start with 10 increment by 2 maxvalue 20 minvalue 1 nocycle cache --查询用户当前的序列 select * from user_sequences;
删除序列;
DROP SEQUENCE toys_seq;
sys.dual的用法
select toys_seq.nextval from dual; --获得序列toys_seq的下一个值 select toys_seq.currval from dual; --获得序列toys_seq的当前值
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号