zoukankan      html  css  js  c++  java
  • oracle 删除表空间及数据文件方法

    --删除空的表空间,但是不包含物理文件
    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;


    以system用户登录,查找需要删除的用户:

    --查找用户
    select * from dba_users;
    --查找工作空间的路径
    select * from dba_data_files;
    --删除用户
    drop user 用户名称 cascade;
    --删除表空间
    drop tablespace 表空间名称 including contents and datafiles cascade constraint;

    例如:删除用户名成为ABC,表空间名称为ABC

    --删除用户,及级联关系也删除掉
    drop user ABC cascade;
    --删除表空间,及对应的表空间文件也删除掉
    drop tablespace ABC including contents and datafiles cascade constraint;

    删除无任何数据对象的表空间:
    首先使用PL/SQL界面化工具,或者使用oracle自带的SQL PLUS工具,连接需要删除的表空间的oracle数据局库。
    确认当前用户是否有删除表空间的权限,如果没有 drop tablespace,请先用更高级的用户(如sys)给予授权或者直接用更高级的用户。
    用drop tablespace xxx ,删除需要删除的表空间。
    删除有任何数据对象的表空间
    使用drop tablespace xxx including contents and datafiles;来删除表空间。
    注意事项:
    如果drop tablespace语句中含有datafiles,那datafiles之前必须有contents关键字,不然会提示ora-01911错误

  • 相关阅读:
    bzoj1724[Usaco2006 Nov]Fence Repair 切割木板*
    vue-cli脚手架和webpack-simple模板项目
    Vue-router 进阶
    前端路由vue-router介绍
    vue的一些特殊特性
    生命周期钩子
    过滤器
    RSA加密算法
    欧几里得算法
    动态规划
  • 原文地址:https://www.cnblogs.com/Alanf/p/9485550.html
Copyright © 2011-2022 走看看