oracle

 

Oracle创建表空间、创建用户并指定该用户的表空间、授权

 版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/btt2013/article/details/78007011

参考链接:http://www.osyunwei.com/archives/5943.html

Oralce中表空间概念、分类、操作,参考本人博文:http://blog.csdn.net/btt2013/article/details/50931665

使用SQL Developer连接到ebankdb数据库。

1、在SQL Developer工具中,执行该语句

  1.  
    create temporary tablespace ebank_temp
  2.  
    tempfile 'ebank_temp.dbf'
  3.  
    size 2G
  4.  
    extent management local;

2、查看创建的表空间

3、依次执行以下语句,分别是:

创建表空间、创建用户并指定该用户的表空间、授予用户对表空间以及临时表空间的操作权限

  1.  
    --/ebank/oradata/data
  2.  
     
  3.  
    --ebank_temp
  4.  
    create temporary tablespace ebank_temp
  5.  
    tempfile 'ebank_temp.dbf'
  6.  
    size 2G
  7.  
    extent management local;
  8.  
     
  9.  
     
  10.  
    --ecif
  11.  
    create tablespace ecif_data
  12.  
    logging
  13.  
    datafile 'ecif_data01.dbf'
  14.  
    size 10G
  15.  
    autoextend on
  16.  
    next 50M maxsize unlimited
  17.  
    extent management local;
  18.  
     
  19.  
     
  20.  
    create tablespace ecif_index
  21.  
    datafile 'ecif_index01.dbf'
  22.  
    size 10G
  23.  
    autoextend on
  24.  
    next 50M maxsize unlimited
  25.  
    extent management local;
  26.  
     
  27.  
    --ecif
  28.  
    create user ecif
  29.  
    identified by "ecif"
  30.  
    default tablespace ecif_data
  31.  
    temporary tablespace ebank_temp
  32.  
    profile DEFAULT;
  33.  
    grant connect to ecif;
  34.  
    grant dba to ecif;
  35.  
    grant unlimited tablespace to ecif;
  36.  
     
  37.  
    --eip
  38.  
    create tablespace eip_data
  39.  
    logging
  40.  
    datafile 'eip_data01.dbf'
  41.  
    size 10G
  42.  
    autoextend on
  43.  
    next 50M maxsize unlimited
  44.  
    extent management local;
  45.  
     
  46.  
    create tablespace eip_index
  47.  
    datafile 'eip_index01.dbf'
  48.  
    size 10G
  49.  
    autoextend on
  50.  
    next 50M maxsize unlimited
  51.  
    extent management local;
  52.  
     
  53.  
     
  54.  
    --eip
  55.  
    create user eip
  56.  
    identified by "eip"
  57.  
    default tablespace eip_data
  58.  
    temporary tablespace ebank_temp
  59.  
    profile DEFAULT;
  60.  
    grant connect to eip;
  61.  
    grant dba to eip;
  62.  
    grant unlimited tablespace to eip;
  63.  
     
  64.  
    --eibs
  65.  
    create tablespace eibs_data
  66.  
    logging
  67.  
    datafile 'eibs_data01.dbf'
  68.  
    size 5G
  69.  
    autoextend on
  70.  
    next 50M maxsize unlimited
  71.  
    extent management local;
  72.  
     
  73.  
    create tablespace eibs_index
  74.  
    datafile 'eibs_index01.dbf'
  75.  
    size 2G
  76.  
    autoextend on
  77.  
    next 50M maxsize unlimited
  78.  
    extent management local;
  79.  
     
  80.  
    --eibs
  81.  
    create user eibs
  82.  
    identified by "eibs"
  83.  
    default tablespace eibs_data
  84.  
    temporary tablespace ebank_temp
  85.  
    profile DEFAULT;
  86.  
    grant connect to eibs;
  87.  
    grant dba to eibs;
  88.  
    grant unlimited tablespace to eibs;
  89.  
     
  90.  
     
  91.  
    --pibs
  92.  
    create tablespace pibs_data
  93.  
    logging
  94.  
    datafile 'pibs_data01.dbf'
  95.  
    size 5G
  96.  
    autoextend on
  97.  
    next 50M maxsize unlimited
  98.  
    extent management local;
  99.  
     
  100.  
    --alter database datafile'pibs_index01.dbf' RESIZE
  101.  
    create tablespace pibs_index
  102.  
    datafile 'pibs_index01.dbf'
  103.  
    size 2G
  104.  
    autoextend on
  105.  
    next 50M maxsize unlimited
  106.  
    extent management local;
  107.  
     
  108.  
    --pibs
  109.  
    create user pibs
  110.  
    identified by "pibs"
  111.  
    default tablespace pibs_data
  112.  
    temporary tablespace ebank_temp
  113.  
    profile DEFAULT;
  114.  
    grant connect to pibs;
  115.  
    grant dba to pibs;
  116.  
    grant unlimited tablespace to pibs;
  117.  
     
  118.  
    --bo
  119.  
    create tablespace bo_data
  120.  
    logging
  121.  
    datafile 'bo_data01.dbf'
  122.  
    size 1G
  123.  
    autoextend on
  124.  
    next 50M maxsize unlimited
  125.  
    extent management local;
  126.  
     
  127.  
    create tablespace bo_index
  128.  
    datafile 'bo_index01.dbf'
  129.  
    size 500M
  130.  
    autoextend on
  131.  
    next 50M maxsize unlimited
  132.  
    extent management local;
  133.  
     
  134.  
    --bo
  135.  
    create user bo
  136.  
    identified by "bo"
  137.  
    default tablespace bo_data
  138.  
    temporary tablespace ebank_temp
  139.  
    profile DEFAULT;
  140.  
    grant connect to bo;
  141.  
    grant dba to bo;
  142.  
    grant unlimited tablespace to bo;
  143.  
     
  144.  
     
  145.  
    --pmbs
  146.  
    create tablespace pmbs_data
  147.  
    logging
  148.  
    datafile 'pmbs_data01.dbf'
  149.  
    size 5G
  150.  
    autoextend on
  151.  
    next 50M maxsize unlimited
  152.  
    extent management local;
  153.  
     
  154.  
    create tablespace pmbs_index
  155.  
    datafile 'pmbs_index01.dbf'
  156.  
    size 2G
  157.  
    autoextend on
  158.  
    next 50M maxsize unlimited
  159.  
    extent management local;
  160.  
     
  161.  
    --pmbs
  162.  
    create user pmbs
  163.  
    identified by "pmbs"
  164.  
    default tablespace pmbs_data
  165.  
    temporary tablespace ebank_temp
  166.  
    profile DEFAULT;
  167.  
    grant connect to pmbs;
  168.  
    grant dba to pmbs;
  169.  
    grant unlimited tablespace to pmbs;
  170.  
     
  171.  
     
  172.  
    --rpt
  173.  
    create tablespace rpt_data
  174.  
    logging
  175.  
    datafile 'rpt_data01.dbf'
  176.  
    size 2G
  177.  
    autoextend on
  178.  
    next 50M maxsize unlimited
  179.  
    extent management local;
  180.  
     
  181.  
    create tablespace rpt_index
  182.  
    datafile 'rpt_index01.dbf'
  183.  
    size 1G
  184.  
    autoextend on
  185.  
    next 50M maxsize unlimited
  186.  
    extent management local;
  187.  
     
  188.  
    --rpt
  189.  
    create user rpt
  190.  
    identified by "rpt"
  191.  
    default tablespace rpt_data
  192.  
    temporary tablespace ebank_temp
  193.  
    profile DEFAULT;
  194.  
    grant connect to rpt;
  195.  
    grant dba to rpt;
  196.  
    grant unlimited tablespace to rpt;
  197.  
     
  198.  
    --weixin
  199.  
    create tablespace weixin_data
  200.  
    logging
  201.  
    datafile 'weixin_data01.dbf'
  202.  
    size 1G
  203.  
    autoextend on
  204.  
    next 50M maxsize unlimited
  205.  
    extent management local;
  206.  
     
  207.  
    create tablespace weixin_index
  208.  
    datafile 'weixin_index01.dbf'
  209.  
    size 500M
  210.  
    autoextend on
  211.  
    next 50M maxsize unlimited
  212.  
    extent management local;
  213.  
     
  214.  
    --weixin
  215.  
    create user weixin
  216.  
    identified by "weixin"
  217.  
    default tablespace weixin_data
  218.  
    temporary tablespace ebank_temp
  219.  
    profile DEFAULT;
  220.  
    grant connect to weixin;
  221.  
    grant dba to weixin;
  222.  
    grant unlimited tablespace to weixin;
  223.  
     
  224.  
    --wbs
  225.  
    create tablespace wbs_data
  226.  
    logging
  227.  
    datafile 'wbs_data01.dbf'
  228.  
    size 1G
  229.  
    autoextend on
  230.  
    next 50M maxsize unlimited
  231.  
    extent management local;
  232.  
     
  233.  
    create tablespace wbs_index
  234.  
    datafile 'wbs_index01.dbf'
  235.  
    size 500M
  236.  
    autoextend on
  237.  
    next 50M maxsize unlimited
  238.  
    extent management local;
  239.  
     
  240.  
    --wbs
  241.  
    create user wbs
  242.  
    identified by "wbs"
  243.  
    default tablespace wbs_data
  244.  
    temporary tablespace ebank_temp
  245.  
    profile DEFAULT;
  246.  
    grant connect to wbs;
  247.  
    grant dba to wbs;
  248.  
    grant unlimited tablespace to wbs;

执行日志:
temporary TABLESPACE 已创建。
tablespace ECIF_DATA 已创建。
tablespace ECIF_INDEX 已创建。
user ECIF 已创建。
grant 成功。
grant 成功。
grant 成功。
tablespace EIP_DATA 已创建。
tablespace EIP_INDEX 已创建。
user EIP 已创建。
grant 成功。
grant 成功。
grant 成功。
tablespace EIBS_DATA 已创建。
tablespace EIBS_INDEX 已创建。
user EIBS 已创建。
grant 成功。
grant 成功。
grant 成功。
tablespace PIBS_DATA 已创建。
tablespace PIBS_INDEX 已创建。
user PIBS 已创建。
grant 成功。
grant 成功。
grant 成功。
tablespace BO_DATA 已创建。
tablespace BO_INDEX 已创建。
user BO 已创建。
grant 成功。
grant 成功。
grant 成功。
tablespace PMBS_DATA 已创建。
tablespace PMBS_INDEX 已创建。
user PMBS 已创建。
grant 成功。
grant 成功。
grant 成功。
tablespace RPT_DATA 已创建。
tablespace RPT_INDEX 已创建。
user RPT 已创建。
grant 成功。
grant 成功。
grant 成功。
tablespace WEIXIN_DATA 已创建。
tablespace WEIXIN_INDEX 已创建。
user WEIXIN 已创建。
grant 成功。
grant 成功。
grant 成功。

操作结果:

查看创建的用户

 
原文地址:https://www.cnblogs.com/xiaozhuzhuchuangdiqiu/p/10312643.html