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: avoiding corrupted block (ora-01578)

Re: avoiding corrupted block (ora-01578)

From: Anton Dischner <dischner_at_klch.med.uni-muenchen.de>
Date: Fri, 11 Jun 1999 11:38:15 +0200
Message-ID: <110619991138159552%dischner@klch.med.uni-muenchen.de>


Hi Nathan,

#include <sys/types.h>
#include <sys/uio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>

void main()
{

   unsigned register i;
   char puffer[16384];
   unsigned int block = 0, block1 = 0;
   int err, fd;
   char datei[80];
   int zaehler = 0;

   for (i=0; i<16384; ++i)

      puffer[i] = (i % 64) + ' ';
   do
   {
   zaehler ++;
------> sprintf(datei, "/bar/datei%d\0", zaehler);

   fd = open(datei, O_CREAT | O_RDWR | O_TRUNC, 0666);    if (fd <= 0) perror("Er”ffnen Datei : ");    for (i=0; i<640; ++i) /* 117773 */    { sprintf(puffer, "%10d", i);

      err = write(fd, puffer, 16384);
      if (err < 0) perror("Error writing: ");
   }
   close(fd);
   printf("File %s written\n", datei);

   fd = open(datei, O_RDONLY);
   if (fd <= 0) perror(datei);
   for (i=0; i<640; ++i)
   { err = read(fd, puffer, 16384);

      if (err < 0) perror("Error reading : ");
      sscanf(puffer, "%d", &block1);
      if (block1 != i) 
      {  printf("Blocknumber %d wrong: %d\n", i, block1);
         exit(1);
      }

   }
   close(fd);
   } while(err >= 0);
   exit(0);
}

Use correct directory at ------>
We let it run using a script like:
while sleep 10
do
 <name of the c-program>
 rm /bar/*
done

> Is there something we can do at Start of day to scan for bad blocks > before we allow user to use it ? We can estimate the daily usage size.

Use:

exp scott/tiger file=/dev/null full=yes

or something like this.

Use 'analyze table <tablename> compute' to scan a table.

Again Good luck

Toni Received on Fri Jun 11 1999 - 04:38:15 CDT

Original text of this message

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