ACCEPT sysPassword CHAR DEFAULT 'manager' PROMPT 'Please enter password for SYS (Press Enter for OS auth): ' HIDE
whenever sqlerror exit FAILURE
connect SYS/ &sysPassword as SYSDBA

set verify    off
set heading   off
set feedback  off
set echo      off
set trimout   on
set trimspool on
set pagesize  0
set define    off
set linesize  2000
set timing    off
set time      off

prompt
select 'ORACLE version: [' || version || ']' from v$instance;
select 'ORACLE_SID:     [' || instance_name || ']' from v$instance;

prompt
prompt Steps:
prompt 1. Please set "db_compat_version" parameter in gdul.ini.
prompt 2. Now is going to setup datafile.ini and asmdisk.ini...

set verify    off
set heading   off
set feedback  off
set echo      off
set term      off
set trimout   on
set trimspool on
set pagesize  0
set define    off
set linesize  2000
set timing    off
set time      off

spool conf/datafile.ini
select '<datafile>' from dual;
select ' <row> '       ||
        '<file#>'      ||file#      ||'</file#> '      ||
        '<ts#>'        ||ts#        ||'</ts#> '        ||
        '<rfile#>'     ||rfile#     ||'</rfile#> '     ||
        '<blocks>'     ||blocks     ||'</blocks> '     ||
        '<block_size>' ||block_size ||'</block_size> ' ||
        '<name>'       ||name       ||'</name> '       ||
        '<raw_offset>' ||0          ||'</raw_offset> ' ||
        '</row>'
  from v$datafile;  
select '</datafile>' from dual;
spool off

spool conf/asmdisk.ini
select '<asmdisk>' from dual;
select /*+RULE*/
      '<row> '           ||
      '<group_number>'   ||g.group_number ||'</group_number> '   ||
      '<group_name>'     ||g.name         ||'</group_name> '     ||
      '<block_size>'     ||g.block_size   ||'</block_size> '     ||
      '<au_size>'        ||g.allocation_unit_size ||'</au_size> '||
      '<disk_number>'    ||d.disk_number  ||'</disk_number> '    ||
      '<path>'           ||d.path         ||'</path> '           ||
      '<f1b1>'           ||0              ||'</f1b1> '           ||
      '<raw_offset>'     ||0              ||'</raw_offset> '     ||
      '</row>'
  from v$asm_disk d
 inner join v$asm_diskgroup g
    on d.group_number = g.group_number
  order by g.group_number, d.disk_number;  
select '</asmdisk>' from dual;
spool off

exit


