生成RMAN rename写法脚本


select  'set newname for datafile ' || x.FILE# || ' to ' ||  
       new_file_Location ||   substr(x.NAME,instr(x.name,'/',-1)+1 ,length(x.name)-instr(x.name,'/',-1))                  
  from v$datafile x,(select &new_loc new_file_Location from dual);



实验一下


<pre code_snippet_id="1730831" snippet_file_name="blog_20160626_1_5099860" name="code" class="sql">SQL> select  'set newname for datafile ' || x.FILE# || ' to ' ||  
  2         new_file_Location ||   substr(x.NAME,instr(x.name,'/',-1)+1 ,length(x.name)-instr(x.name,'/',-1))                  
  3    from v$datafile x,(select &new_loc new_file_Location from dual);
Enter value for new_loc: '/home/oracle/'
old   3:   from v$datafile x,(select &new_loc new_file_Location from dual)
new   3:   from v$datafile x,(select '/home/oracle/' new_file_Location from dual)


'SETNEWNAMEFORDATAFILE'||X.FILE#||'TO'||NEW_FILE_LOCATION||SUBSTR(X.NAME,INSTR(X.NAME,'/',-1)+1,LENGTH(X.NAME)-INSTR(X.NAME,'/',-1))
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set newname for datafile 1 to /home/oracle/system01.dbf
set newname for datafile 2 to /home/oracle/sysaux01.dbf
set newname for datafile 3 to /home/oracle/undotbs01.dbf
set newname for datafile 4 to /home/oracle/users01.dbf
set newname for datafile 5 to /home/oracle/example01.dbf
 


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值