corrupt database - Veritas Net Backup

This is a discussion on corrupt database - Veritas Net Backup ; I am getting the following errors when catalog maintenance tries to run. My catalog is not getting files deleted. This database was on antoher server and was migrated using the catalog import export utility. Maintenance has not ran successfully since ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: corrupt database

  1. corrupt database


    I am getting the following errors when catalog maintenance tries to run. My
    catalog is not getting files deleted. This database was on antoher server
    and was migrated using the catalog import export utility. Maintenance has
    not ran successfully since it was moved. I would guess that I need to run
    some kind of database vaildation routine but cannot find this.

    [Tid: dcc 02-25-2006 14:14:41:002] ODBCERROR: Native = '-194',
    SQLState = '23000', ErrorMsg = '[Sybase][ODBC Driver][Adaptive Server Anywhere]Integrity
    constraint violation: No primary key value for foreign key 'FK_StorageRidBase'
    in table 'Storage'', Row = -1, Col = -1
    [Tid: dcc 02-25-2006 14:14:41:002] MigrateStoragePathsForDeletion:
    Failed to commit the DELETE FROM Storage statement.
    [Tid: dcc 02-25-2006 14:15:32:159]

  2. Re: corrupt database


    "Les Buel" wrote:
    >I am getting the following errors when catalog maintenance tries to run.

    My
    >catalog is not getting files deleted. This database was on antoher server
    >and was migrated using the catalog import export utility. Maintenance has
    >not ran successfully since it was moved. I would guess that I need to run
    >some kind of database vaildation routine but cannot find this.
    >
    >[Tid: dcc 02-25-2006 14:14:41:002] ODBCERROR: Native = '-194',
    >SQLState = '23000', ErrorMsg = '[Sybase][ODBC Driver][Adaptive Server Anywhere]Integrity
    >constraint violation: No primary key value for foreign key 'FK_StorageRidBase'
    >in table 'Storage'', Row = -1, Col = -1
    >[Tid: dcc 02-25-2006 14:14:41:002] MigrateStoragePathsForDeletion:
    > Failed to commit the DELETE FROM Storage statement.
    >[Tid: dcc 02-25-2006 14:15:32:159]


    I assume you've already fixed the problem or reloaded your database, but
    for the sake of the archives, I'll explain how I fixed this exact problem.
    My fix is not for the faint of heart!

    Fixed using dbisql.exe. Read the SP2 release notes for how to connect and
    use dbisql.exe

    The definition of FK_StorageRidBase is ( obtained from dbunload.exe )

    ALTER TABLE "engine"."Storage"
    ADD FOREIGN KEY "FK_StorageRidBase" ("RidBase")
    REFERENCES "engine"."Storage" ("Rid");

    To resolve I dropped that foreign key (may not be needed)

    ALTER TABLE "engine"."Storage"
    drop FOREIGN KEY "FK_StorageRidBase";

    The foreign key is used to make sure that for all non-null values for RidBase,
    there is a Rid entry. (primary key in table "storage"). I found the problem
    records like this:

    Select * from engine.storage a
    where a.ridbase is not null
    and not exists(select 1 from engine.storage B
    where b.sid = a.ridbase ) ;
    output to hope.txt;

    That showed 2 problem entries. I used "aspcommandush --reverselookup" on
    the file names generated. If they resolved to valid entries, I would have
    deleted them using the admin console.

    In this case, they didn't show up, so I deleted those rows from the storage
    table (rid is primary key).

    Once I deleted the rows, I was able to recreate the foreign key, and then
    grooming worked fine!




+ Reply to Thread