当前位置:网站首页>Insufficient permissions
Insufficient permissions
2022-07-07 21:04:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
For example, the following stored procedure is dba Create a tablespace 、 Create a user and grant permissions to this user :
create or replace procedure createTS(tname in varchar2)
is PRAGMA AUTONOMOUS_TRANSACTION; v_createsql varchar2(400); vtbsname varchar2(40); begin vtbsname := tname; v_createsql:=’CREATE TABLESPACE ‘|| vtbsname ||’ DATAFILE ”F:\APP\ADMINISTRATOR\ORADATA\’|| vtbsname ||’.dbf” SIZE 30M AUTOEXTEND ON NEXT 10M’; Dbms_Output.Put_Line(v_createsql); execute immediate v_createsql; v_createsql:=’CREATE USER ‘|| vtbsname ||’ identified by ‘|| vtbsname ||’ default tablespace ‘||vtbsname; Dbms_Output.Put_Line(v_createsql); execute immediate v_createsql; — v_createsql:=’grant ALTER SESSION,CREATE CLUSTER,CREATE DATABASE LINK,CREATE SEQUENCE,CREATE SESSION ,CREATE SYNONYM,CREATE VIEW to ‘|| vtbsname; — v_createsql:=’GRANT CREATE SESSION,CREATE CLUSTER,CREATE INDEXTYPE,CREATE OPERATOR,CREATE PROCEDURE,CREATE SEQUENCE,CREATE TABLE,CREATE TRIGGER,CREATE TYPE,INSERT ANY TABLE,UPDATE ANY TABLE,SELECT ANY TABLE,DELETE ANY TABLE to ‘|| vtbsname; v_createsql:=’GRANT connect,resource to ‘|| vtbsname; Dbms_Output.Put_Line(v_createsql); execute immediate v_createsql;
end createTS;
PROCEDURE CREATETS The compiled
Compile and pass , For example, the following operation
set serveroutput on; execute createTS(‘nk_develop14061342’);
In line 28 Error starting running command on : execute createTS(‘nk_develop14061343’) Error reporting : ORA-01031: Insufficient authority ORA-06512: stay “NK_DEVELOP131021.CREATETS”, line 22 ORA-06512: stay line 1 01031. 00000 – “insufficient privileges” *Cause: An attempt was made to change the current username or password without the appropriate privilege. This error also occurs if attempting to install a database without the necessary operating system privileges. When Trusted Oracle is configure in DBMS MAC, this error may occur if the user was granted the necessary privilege at a higher label than the current login. *Action: Ask the database administrator to perform the operation or grant the required privileges. For Trusted Oracle users getting this error although granted the the appropriate privilege at a higher label, ask the database administrator to regrant the privilege at the appropriate label. CREATE TABLESPACE nk_develop14061343 DATAFILE ‘F:\APP\ADMINISTRATOR\ORADATA\nk_develop14061343.dbf’ SIZE 30M AUTOEXTEND ON NEXT 10M CREATE USER nk_develop14061343 identified by nk_develop14061343 default tablespace nk_develop14061343 GRANT connect,resource to nk_develop14061343
The reason is that the permission is insufficient when running to grant permission
Find a post such as the following :http://bbs.csdn.net/topics/360053754
Finally found the problem , It turns out that I have no permission . Although the current user has permission to run statements , However, it is necessary to explicitly assign permissions to the current user in the stored procedure . The following is the information I found , Post it for everyone to see . ===================== 【IT168 Technical documentation 】 We know , User owned role Permissions are not available in stored procedures . Such as :
SQL> select * from dba_role_privs where grantee=’SUK’;
GRANTEE GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE ———— ———— ———— ———— SUK DBA NO YES SUK CONNECT NO YES SUK RESOURCE NO YES
– user SUK Have DBA This role – Create another test stored procedure : create or replace procedure p_create_table is begin Execute Immediate ‘create table create_table(id int)’; end p_create_table;
– Then test SQL> exec p_create_table;
begin p_create_table; end;
ORA-01031: Insufficient authority ORA-06512: stay ”SUK.P_CREATE_TABLE”, line 3 ORA-06512: stay line 1
– Be able to see . Even if you have DBA role. You can't create a table .role Not available in stored procedures .
– In this case , We generally need to explicitly perform system permissions . Such as grant create table to suk; – But this method is too troublesome , Sometimes it may take a lot of authorization to run stored procedures – actually ,oracle Provides us with the ability to use in stored procedures role The method of authority : – Change stored procedures , increase Authid Current_User When stored procedures can use role jurisdiction . create or replace procedure p_create_table Authid Current_User is begin Execute Immediate ‘create table create_table(id int)’; end p_create_table;
– Try running again : SQL> exec p_create_table;
PL/SQL procedure successfully completed
– It has been able to run .
original Is to use caller permissions
Therefore, when creating stored procedures, you need to add Authid Current_User The permissions of the current user
create or replace procedure createTS(tname in varchar2) Authid Current_User is
To dynamically create table spaces in stored procedures, for example, the following steps . 1、 Need to adopt Oracle Autonomous affairs .
Add in the stored procedure PRAGMA AUTONOMOUS_TRANSACTION; Clause 2、 You need to display the permissions of the sub configuration to create the tablespace , Otherwise, the prompt authority is insufficient . grant alter tablespace to TEST; grant create tablespace to TEST;
Thank the website owner
http://www.dbfaq.net/FAQ/FixupQL.aspx?QuestionID=112
http://bbs.csdn.net/topics/360053754
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/116452.html Link to the original text :https://javaforall.cn
边栏推荐
- 使用枚举实现英文转盲文
- Codeforces Round #275 (Div. 2) C – Diverse Permutation (构造)[通俗易懂]
- 上海交大最新《标签高效深度分割》研究进展综述,全面阐述无监督、粗监督、不完全监督和噪声监督的深度分割方法
- OneSpin 360 DV新版发布,刷新FPGA形式化验证功能体验
- Tensorflow2. How to run under x 1 Code of X
- Is it safe to open a stock account at present? Can I open an account online directly.
- 最新版本的CodeSonar改进了功能安全性,支持MISRA,C ++解析和可视化
- 部署、收回和删除解决方式—-STSADM和PowerShell「建议收藏」
- [paper reading] maps: Multi-Agent Reinforcement Learning Based Portfolio Management System
- 95年专注安全这一件事 沃尔沃未来聚焦智能驾驶与电气化领域安全
猜你喜欢

C language helps you understand pointers from multiple perspectives (1. Character pointers 2. Array pointers and pointer arrays, array parameter passing and pointer parameter passing 3. Function point

How to meet the dual needs of security and confidentiality of medical devices?

Measure the height of the building

如何满足医疗设备对安全性和保密性的双重需求?
MySQL约束之默认约束default与零填充约束zerofill

How to meet the dual needs of security and confidentiality of medical devices?

CodeSonar如何帮助无人机查找软件缺陷?

C语言多角度帮助你深入理解指针(1. 字符指针2. 数组指针和 指针数组 、数组传参和指针传参3. 函数指针4. 函数指针数组5. 指向函数指针数组的指针6. 回调函数)

使用枚举实现英文转盲文

Make this crmeb single merchant wechat mall system popular, so easy to use!
随机推荐
Helix QAC 2020.2新版静态测试工具,最大限度扩展了标准合规性的覆盖范围
Data sorting in string
POJ 3140 contents division "suggestions collection"
[matrix multiplication] [noi 2012] [cogs963] random number generator
ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
Klocwork 代码静态分析工具
恶魔奶爸 A3阶段 近常速语流初接触
C语言多角度帮助你深入理解指针(1. 字符指针2. 数组指针和 指针数组 、数组传参和指针传参3. 函数指针4. 函数指针数组5. 指向函数指针数组的指针6. 回调函数)
gridView自己定义做时间排版「建议收藏」
神兵利器——敏感文件发现工具
Can Huatai Securities achieve Commission in case of any accident? Is it safe to open an account
How to choose financial products? Novice doesn't know anything
开户必须往账户里面赚钱吗,资金安全吗?
私募基金在中國合法嗎?安全嗎?
Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
DataTable数据转换为实体
Codeforces Round #275 (Div. 2) C – Diverse Permutation (构造)[通俗易懂]
刚开户的能买什么股票呢?炒股账户安全吗
Validutil, "Rethinking the setting of semi supervised learning on graphs"
Cantata9.0 | new features