zoukankan      html  css  js  c++  java
  • Oracle表空间创建要点

    ##查看 pdb 容器

    show pdbs;
    --切换到 ORCLPDB1 容器(这一步是重点)
    alter session set container=ORCLPDB1;
    ##创建临时表空间
    create temporary tablespace SHOME_TEMP tempfile '/opt/oracle/oradata/shome_temp.dbf' size 200m autoextend on next 100m maxsize 20480m extent management local;
    ##创建数据永久表空间
    create tablespace SHOME logging datafile '/opt/oracle/oradata/shome.dbf' size 200m autoextend on next 100m maxsize 20480m extent management local;
    --回到CDB容器(创建公有用户这一步是重点创建服务用户则最后执行)
    #alter session set container=cdb$root;
    ##创建用户并指定表空间
    -- 在容器ORCLPDB1中创建本地用户方法
    create user SHOME identified by "123456" default tablespace SHOME temporary tablespace SHOME_TEMP;
    -- 在CDB中创建公共用户
    #create user C##SHOME identified by "123456" default tablespace SHOME temporary tablespace SHOME_TEMP;
    ##授权
    grant connect,resource,dba to SHOME;
    #grant connect,resource,dba to C##SHOME;
    ##检查用户存在表空间
    select username,default_tablespace from dba_users where username='SHOME' order by username;

    --相关要点
    ##查询表空间
    select tablespace_name from dba_free_space group by tablespace_name;
    ##创建用户时,在oracle12以后的版本公共用户需加头缀C##
    CREATE USER C##SHOME IDENTIFIED BY "123456" DEFAULT TABLESPACE "SHOME" TEMPORARY TABLESPACE "SHOME_TEMP";
    ##删除表空间时,如果先删除表空间文件再删表空间会导致无法修补异常,可通过以下方法解决
    alter database datafile '/opt/oracle/oradata/shome.dbf' offline drop;
    --删除空的表空间,但是不包含物理文件
    drop tablespace tablespace_name;
    --删除非空表空间,但是不包含物理文件
    drop tablespace tablespace_name including contents;
    --删除空表空间,包含物理文件
    drop tablespace tablespace_name including datafiles;
    --删除非空表空间,包含物理文件
    drop tablespace tablespace_name including contents and datafiles;
    --如果其他表空间中的表有外键等约束关联到了本表空间中的表的字段,就要加上CASCADE CONSTRAINTS
    drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;

  • 相关阅读:
    动态为datagrid增加控件
    对DataGrid中的ListBox设置值
    Enhancing Inserting Data through the DataGrid Footer, Part 2
    Setting Focus to a TextBox in an EditItemTemplate
    Enhancing Inserting Data through the DataGrid Footer
    CRM选择行变色
    【转】on delete cascade
    VS如何连接2种类型的数据库
    SQL Server 已配置为允许远程连接 解决办法
    【转】sql server 重命名表字段
  • 原文地址:https://www.cnblogs.com/hujunmin/p/12957306.html
Copyright © 2011-2022 走看看