• 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;

  • 相关阅读:
    不喜欢数据库编程
    配置 yum 源的两种方法
    编译内核后iptables无法启动问题
    国外免费空间
    iptables--静态防火墙实例教程
    25 Most Frequently Used Linux IPTables Rules Examples
    如何开启或关闭SELinux
    google提供免费企业邮局
    RAID 0, RAID 1, RAID 5, RAID 10 Explained with Diagrams
    CentOS软件管理之fastestmirror和RPMforge
  • 原文地址:https://www.cnblogs.com/hujunmin/p/12957306.html
Copyright © 2020-2023  润新知