首页 > 数据库技术 > 详细

任务型sql

时间:2016-11-01 09:43:00      阅读:235      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!