Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: DBUNLOAD is to Watcom as _____ is to Oracle

Re: DBUNLOAD is to Watcom as _____ is to Oracle

From: Jan Rosinowski <rosinowski_at_gmx.de>
Date: Thu, 11 Feb 1999 08:27:58 GMT
Message-ID: <36c28347.142133326@bigXb>


>http://www.tc.umn.edu/nlhome/m031/hause011
>
>Let me know if it works for you.

i had to modify it a little bit as i don't use a korn shell. here we go:

expimpf.bat: (nt)

---------------------------------------------------------expimpf.bat

exp73 scott/tiger_at_dokver constraints=y file=scheme.dmp grants=y indexes=y owner=dokver rows=n

imp73 scott/tiger_at_dokver show=y full=y file=scheme.dmp recordlength=200 2>scheme.$$$

awk -f orafilt.awk scheme.$$$ >scheme.sql

---------------------------------------------------------orafilt.awk:

BEGIN {
  line="";
  startbreak=120;
}

function flushline() {
  if (1==match(line,/^(CREATE)|(GRANT)|(ALTER)|(REVOKE)/)) {     print ";";
  }
  while (length(line)>startbreak) {
    if ((i=index(line,"--")-1)==-1) { # break before line comments

      i=startbreak+index(substr(line,startbreak)," ")-1;
      if (i==startbreak+0-1) {
        break;
      }

    };
    if (!i) break;
    print substr(line,1,i);
    line = substr(line,i+1);
  }
  print line;
  line="";
}

/^ "/ {
  gsub("^ \"","",$0); # leading space+"   gsub("\"$","",$0); # trailing "
  line = line $0;
  if (length($0)!=75) {
    flushline();
  }
}

END {
  flushline();
}


the script sometimes fails as "imp73 show=y" sometimes omits linebreaks (eg. something like '...from" ' in one line (78 chars wide), next line immediately starting with ' "table.."'

any comments or improvements welcome :-)

ciao, jan Received on Thu Feb 11 1999 - 02:27:58 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US