zoukankan      html  css  js  c++  java
  • ORA-01950: no privileges on tablespace xxx ORA-01950: 对表空间 'xxx'无权限

    场景:

    创建用户,在用户scheme下新建了一张表,插入数据时报错 ORA-01950: 对表空间 'xxx'无权限

    创建用户

    /*第1步:创建临时表空间  */
    create temporary tablespace odi_temp 
    tempfile 'C:appORACLEoradataorclodi_temp.dbf'
    size 50m 
    autoextend on 
    next 50m maxsize 20480m 
    extent management local; 
      
    /*第2步:创建数据表空间  */
    create tablespace odi_data 
    logging 
    datafile 'C:appORACLEoradataorclodi_data.dbf'
    size 50m 
    autoextend on 
    next 50m maxsize 20480m 
    extent management local; 
      
    /*第3步:创建用户并指定表空间  */
    create user sakila identified by sakila
    default tablespace odi_data 
    temporary tablespace odi_temp
    profile default ;
    
    /*第4步:给用户授予权限  */
    grant connect,resource to sakila;

    创建表

    CREATE TABLE actor (
      actor_id numeric NOT NULL ,
      first_name VARCHAR(45) NOT NULL,
      last_name VARCHAR(45) NOT NULL,
      last_update DATE NOT NULL,
      PRIMARY KEY  (actor_id)
      );

    插入数据时报错

    INSERT INTO actor (
        actor_id,
        first_name,
        last_name,
        last_update
    )
    VALUES
        (
            '1',
            'PENELOPE',
            'GUINESS',
            '2006-02-15 04:34:33.000'
        );

    报错信息:

    ORA-01950: 对表空间 'ODI_DATA' 无权限

    ORA-01950: no privileges on tablespace 'ODI_DATA'

    原因:

    没有分配表空间配额: 

    配额(quota):允许被使用的空间。用户可以在表空间上可以使用的空间。

    解决办法:

    使用sys用户添加用户在表空间上的配额,

    alter user SAKILA quota unlimited on odi_data;

    这个问题如果在创建用户时,给该用户授予表空间配额可以避免。下面的红色部分

    参照 http://docs.oracle.com/database/121/SQLRF/statements_8003.htm#SQLRF01503

    /* 创建用户并指定表空间  */
    create user username identified by password 
    default tablespace user_data 
    temporary tablespace user_temp
    quota unlimited
    on user_data profile default ;
  • 相关阅读:
    [译]K-D-B-tree(草稿,第一次翻译)
    [LeetCode]Letter Combinations of a Phone Number
    [LeetCode]Multiply Strings
    [LeetCode]Populating Next Right Pointers in Each Node
    [LeetCode]Sum Root to Leaf Numbers
    [LeetCode]String to Integer (atoi)
    [LeetCode]Path Sum II
    [LeetCode]Minimum Depth of Binary Tree
    线上死锁问题排查
    Redis(四):独立功能的实现
  • 原文地址:https://www.cnblogs.com/xqzt/p/4438414.html
Copyright © 2011-2022 走看看