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 ...
随机推荐
- HDU1577-WisKey的眼神
Problem Description WisKey的眼镜有500多度,所以眼神不大好,而且他有个习惯,就是走路喜欢看着地(不是为了拣钱哦^_^),所以大家下次碰见他的时候最好主动打下招呼,呵呵.但是 ...
- webdriver入门
webdriver是web自动化测试中的重要工具,通过webdriver可以灵活的操纵browser完成相关的测试,目前的webdriver对主流的浏览器均有支持, 如firefox ,chrome, ...
- Robotium第一天:搭建环境测试微信
因为要在命令行下运行一些android的工具,所以配置一些环境变量会比较方便: 遇到问题: java -jar re-sign.jar 出现提示android路径没有配置好: 需要配置如下: 配置AN ...
- isset() 与 empty() 的区别
PHP的isset()函数 一般用来检测变量是否设置 格式:bool isset ( mixed var [, mixed var [, ...]] ) 功能:检测变量是否设置 返回值: 若变量不存在 ...
- java 正则
ava - 正则表达式 - Pattern - Matcher 2013-08-21 14:35 3325人阅读 评论(0) 收藏 举报 分类: JavaSE(30) 版权声明:本文为博主原创文章 ...
- 16.按要求编写Java应用程序。 编写一个名为Test的主类,类中只有一个主方法; 在主方法中定义一个大小为50的一维整型数组,数组名为x,数组中存放着{1, 3,5,…,99}输出这个数组中的所有元素,每输出十个换一行;在主方法中定义一 个大小为10*10的二维字符型数组,数组名为y,正反对角线上存的是‘*’,其余 位置存的是‘#’;输出这个数组中的所有元素。
//分类 package com.bao; public class Shuchu { int[]yi=new int[50]; String[][]er=new String[10][10]; vo ...
- 一个小知识点强引用__strong 弱引用__weak
__weak的类型的指针是不会影响对象的释放 当系统释放后 会自动的指向nil: __Strong 至少有一个__Strong类型的指针是 对象不会释放
- Linux中nmon的安装与使用【转】
一.下载nmon. 根据CPU的类型选择下载相应的版本:http://nmon.sourceforge.net/pmwiki.php?n=Site.Downloadwget http://sour ...
- MySQL慢日志查询全解析:从参数、配置到分析工具【转】
转自: MySQL慢日志查询全解析:从参数.配置到分析工具 - MySQL - DBAplus社群——围绕数据库.大数据.PaaS云,运维圈最专注围绕“数据”的学习交流和专业社群http://dbap ...
- MySQL数据库分区修改【原创】
之前有个表分区添加时s201607添加成s201617,所以在查询7月份数据时报错 错误的 alter table statistics_ticket add partition (partition ...