How do I rename a data file

在论坛看到一个帖子,说是renamedatafile报错了,第一感觉他的语法有问题,也很少用这个命令,就google了一下,发现语法没有问题,可能他的操作顺序有问题。因为rename的时候数据文件必须是offline的,或者数据库是mount状态。

在仔细想了想,以前也整理过一篇rename的文章,不过那篇blog的标题是移动数据文件,和今天的这篇的唯一区别就是在Rename的同时还改了下路径。还有就是这篇是英文的,就当练习一下英语吧。

Oracle移动数据文件的操作方法

http://blog.csdn.net/tianlesoftware/archive/2009/11/30/4899172.aspx

以下内容引自网络:

Datafilescanbemovedorrenamedusingoneoftwomethods:alterdatabaseoraltertablespace.

ThemaindifferencebetweenthemisthataltertablespaceonlyappliestodatafilesthatdonotcontaintheSYSTEMtablespace,activerollbacksegments,ortemporarysegments,buttheprocedurecanbeperformedwhiletheinstanceisstillrunning.Thealterdatabasemethodworksforanydatafile,buttheinstancemustbeshutdown.

1.Thealterdatabasemethod:

1.Shutdowntheinstance.

2.Renameand/ormovethedatafileusingoperatingsystemcommands.

3.Mountthedatabaseandusealterdatabasetorenamethefilewithinthedatabase.Afullyqualifiedfilenameisrequiredinthesyntaxofyouroperatingsystem.Forexampletorenameafilecalled'data01.dbf'to'data04.dbf'andmoveittoanewlocationatthesametime(atthispointintheexampletheinstancehasbeenshutdown)and;

4.Starttheinstance.

SVRMGR>connectsys/oracleassysdba;

SVRMGR>startupmountU1;

SVRMGR>alterdatabaserenamefile'/u01/oracle/U1/data01.dbf'TO'/u02/oracle/U1/data04.dbf';

SVRMGR>alterdatabaseopen;

Noticethesinglequotesaroundthefullyqualifiedfilenamesandremember,thefilesmustexistatthesourceanddestinationpaths.Theinstanceisnowopenusingthenewlocationandnameforthedatafile.

2.Thealtertablespacemethod:

Thismethodhastheadvantagethatitdoesn'trequireshuttingdowntheinstance,butitonlyworkswithnon-SYSTEMtablespaces.Further,itcan'tbeusedfortablespacesthatcontainactiverollbacksegmentsortemporarysegments.

1.Takethetablespaceoffline.

2.Renameand/ormovethedatafileusingoperatingsystemcommands.

3.Usethealtertablespacecommandtorenamethefileinthedatabase.

4.Bringthetablespacebackonline.

SVRMGR>connectsys/oracleassysdba

SVRMGR>altertablespaceapp_dataoffline;

SVRMGR>altertablespaceapp_daterenamedatafile'/u01/oracle/U1/data01.dbf'TO'/u02/oracle/U1/data04.dbf';

SVRMGR>altertablespaceapp_dataonline;

Thetablespacewillbebackonlineusingthenewnameand/orlocationofthedatafile.

BothofthesemethodologiescanbeusedwithinOracleEnterpriseManageralso.

<!--EndFragment-->
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值