gen_grant_dml.sql
set echo off feedback off verify off pagesize 0 linesize 120
define v_grantee = &1
define v_grant_dml_command_file = .\log\grant_dml_&v_grantee..sql
define v_grant_dml_log_file = .\log\grant_dml_&v_grantee..log
spool &v_grant_dml_command_file.
prompt spool &v_grant_dml_log_file.
prompt set echo on feedback on
prompt show user
select
'grant select,insert,update,delete on ' || t.table_name || ' to &v_grantee;'
from user_tables t
where not exists
(select null
from user_tab_privs p
where p.owner = user
and p.table_name = t.table_name
and p.grantee = upper('&v_grantee'))
and user != upper('&v_grantee')
order by t.table_name
/
select
'grant select on ' || v.view_name || ' to &v_grantee;'
from user_views v
where not exists
(select null
from user_tab_privs p
where p.owner = user
and p.table_name = v.view_name
and p.grantee = upper('&v_grantee'))
and user != upper('&v_grantee')
order by v.view_name
/
select
'grant select on ' || s.sequence_name || ' to &v_grantee;'
from user_sequences s
where not exists
(select null
from user_tab_privs p
where p.owner = user
and p.table_name = s.sequence_name
and p.grantee = upper('&v_grantee'))
and user != upper('&v_grantee')
order by s.sequence_name
/
select
'grant execute on ' || o.object_name || ' to &v_grantee;'
from user_objects o
where object_type in ('PACKAGE')
and not exists
(select null
from user_tab_privs p
where p.owner = user
and p.table_name = o.object_name
and p.grantee = upper('&v_grantee'))
and user != upper('&v_grantee')
order by o.object_name
/
prompt set echo off feedback off
prompt spool off
spool off
@&v_grant_dml_command_file.
gen_grant_dml.sql的更多相关文章
- call_grant_dml.sql
set echo offpromptprompt =========================================================================== ...
- 最近帮客户实施的基于SQL Server AlwaysOn跨机房切换项目
最近帮客户实施的基于SQL Server AlwaysOn跨机房切换项目 最近一个来自重庆的客户找到走起君,客户的业务是做移动互联网支付,是微信支付收单渠道合作伙伴,数据库里存储的是支付流水和交易流水 ...
- SQL Server 大数据搬迁之文件组备份还原实战
一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 解决方案(Solution) 搬迁步骤(Procedure) 搬迁脚本(SQL Codes) ...
- Sql Server系列:分区表操作
1. 分区表简介 分区表在逻辑上是一个表,而物理上是多个表.从用户角度来看,分区表和普通表是一样的.使用分区表的主要目的是为改善大型表以及具有多个访问模式的表的可伸缩性和可管理性. 分区表是把数据按设 ...
- SQL Server中的高可用性(2)----文件与文件组
在谈到SQL Server的高可用性之前,我们首先要谈一谈单实例的高可用性.在单实例的高可用性中,不可忽略的就是文件和文件组的高可用性.SQL Server允许在某些文件损坏或离线的情况下,允 ...
- EntityFramework Core Raw SQL
前言 本节我们来讲讲EF Core中的原始查询,目前在项目中对于简单的查询直接通过EF就可以解决,但是涉及到多表查询时为了一步到位就采用了原始查询的方式进行.下面我们一起来看看. EntityFram ...
- 从0开始搭建SQL Server AlwaysOn 第一篇(配置域控)
从0开始搭建SQL Server AlwaysOn 第一篇(配置域控) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://www.cnb ...
- 从0开始搭建SQL Server AlwaysOn 第二篇(配置故障转移集群)
从0开始搭建SQL Server AlwaysOn 第二篇(配置故障转移集群) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://www ...
- 从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn)
从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://w ...
随机推荐
- HDU1115--Lifting the Stone(求凸多边形的重心)
Problem Description There are many secret openings in the floor which are covered by a big heavy sto ...
- ExecutorService的submit(Runnable x)和execute(Runnable x) 两个方法的本质区别
Runnable任务没有返回值,而Callable任务有返回值.并且Callable的call()方法只能通过ExecutorService的submit(Callable <T> tas ...
- Chapter 2 Open Book——14
I backpedaled. "They seemed nice enough to me. I just noticed they keptto themselves. 我改口说道,他们看 ...
- LeetCode OJ 101. Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For e ...
- nefu 179 珠子(最长递增子序列问题)
Description 小林有一串珠子,是由很多个大小不同的珠子串联在一起组成的圆环型的,且其中每个珠子的大小可以用int型的整数来表示.小林有一个爱好就是数珠子,他想数那些位置相邻而且大小只相差1的 ...
- 【转】虚拟机下安装小红帽Linux9.0图解
http://blog.163.com/ly676830315@126/blog/static/10173372220119148583539/
- PHP错误异常处理详解【转载】
异常处理(又称为错误处理)功能提供了处理程序运行时出现的错误或异常情况的方法. 异常处理通常是防止未知错误产生所采取的处理措施.异常处理的好处是你不用再绞尽脑汁去考虑各种错误,这为处理某一类错误提供了 ...
- Linux网卡配置与绑定
一定要在服务管理中关闭NetworkManager服务并禁用自动启动. 第一步:先查看下本机网卡,使用命令到network-scripts 下 [root@root~]# cd /etc/syscon ...
- rebar
www.cnblogs.com/panfeng412/archive/2011/08/14/2137990.html
- TextUtils判断
System.out.println(TextUtils.isEmpty(null)); System.out.println(TextUtils.isEmpty(""));