using instr function to get filesytem structure for manual db clone

Tagged: , ,

  • This topic is empty.
Viewing 0 reply threads
  • Author
    Posts
    • #1892
      Amit Bansal
      Keymaster

      While performing a manual db cloning, you are required to create database directories. Using instr and substr function can help you with this and can list the create directory script

      <br />
      select distinct('mkdir -p '||substr(file_name,1,instr(file_name,'/',-1,1)-1)) from dba_data_files<br />
      union<br />
      select distinct('mkdir -p '||substr(name,1,instr(name,'/',-1,1)-1)) from v$controlfile<br />
      union<br />
      select distinct('mkdir -p '||substr(member,1,instr(member,'/',-1,1)-1)) from v$logfile<br />
      union<br />
      select distinct('mkdir -p '||substr(file_name,1,instr(file_name,'/',-1,1)-1)) from dba_temp_files;<br />
      

      Hope this helps

Viewing 0 reply threads
  • You must be logged in to reply to this topic.