码迷,mamicode.com
首页 > 数据库 > 详细

任务型sql

时间:2016-11-01 09:45:59      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:files   ace   修改   空间   数据文件   ant   res   data   文件   

1.创建表空间与用户,因为数据文件没有指定路径,所以需要修改数据文件路径,才有了下面的需求。

create tablespace wo datafile ‘wo.dbf‘ size 20m;
create user wo identified by "123abc" default tablespace wo;
grant connect,resource to wo;

 

针对非系统表空间,对sysaux,users表空间同样适用
select * from v$datafile;
select tablespace_name,file_name,online_status from dba_data_files where tablespace_name=‘WO‘;
alter tablespace WO offline;
host mv /u01/app/oracle/product/11.2/db_1/dbs/wo.dbf /u01/app/oracle/oradata/LCP1/datafile/
alter tablespace WO rename datafile ‘/u01/app/oracle/product/11.2/db_1/dbs/wo.dbf‘ to ‘/u01/app/oracle/oradata/LCP1/datafile/wo.dbf‘;
select tablespace_name,file_name,online_status from dba_data_files where tablespace_name=‘WO‘;
alter tablespace WO online;

 

针对系统表空间,对UNDOTBS1、TEMP表空间也适用。该方法需要数据库处于mount状态
shutdown immediate
startup mount
host mv /u01/app/oracle/product/11.2/db_1/dbs/system01.dbf /u01/app/oracle/oradata/LCP1/datafile/
alter tablespace WO rename datafile ‘/u01/app/oracle/product/11.2/db_1/dbs/system01.dbf‘ to ‘/u01/app/oracle/oradata/LCP1/datafile/system01.dbf‘;
alter database open;
select tablespace_name,file_name,online_status from dba_data_files where tablespace_name=‘SYSTEM‘;

任务型sql

标签:files   ace   修改   空间   数据文件   ant   res   data   文件   

原文地址:http://www.cnblogs.com/createyuan/p/6018181.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!