[Spacewalk-list] accidentally hit ctrl+c near the beginning of spacewalk-upgrade-schema and now getting errors during script restart

Sabuj Pattanayek sabujp at gmail.com
Fri May 28 00:11:44 UTC 2010


Hi,

I accidentally hit ctrl+c near the beginning of the
spacewalk-schema-upgrade script and it's giving the error :

Unknown schema name [no rows selected] found.

Which shows that's it's blowing up here near the beginning of the script :

my $schema_versions = run_query(\%options, <<EOF);
        select rhnPackageName.name, PE.evr.as_vre_simple()
        from rhnVersionInfo, rhnPackageName, rhnPackageEVR PE
        where rhnVersionInfo.label = 'schema'
                and rhnVersionInfo.name_id = rhnPackageName.id
                and rhnVersionInfo.evr_id = PE.id;
EOF
if (not @$schema_versions) {
        die "No existing schema version info found in rhnVersionInfo.\n";
}
if ($schema_versions->[0][0] ne 'rhn-satellite-schema'
        and $schema_versions->[0][0] ne 'spacewalk-schema'
        and $schema_versions->[0][0] ne 'satellite-schema') {
        die "Unknown schema name [$schema_versions->[0][0]] found.\n";
}

Basically the sql :

select rhnPackageName.name, PE.evr.as_vre_simple()
        from rhnVersionInfo, rhnPackageName, rhnPackageEVR PE
        where rhnVersionInfo.label = 'schema'
                and rhnVersionInfo.name_id = rhnPackageName.id
                and rhnVersionInfo.evr_id = PE.id;

is looking for "'rhn-satellite-schema", "spacewalk-schema", or
"satellite-schema" , probably in this case the 2nd one. Here's the log
file from the update, i.e. this is how far it got before I hit ctrl +
c :

# more 20100527-183318-to-spacewalk-schema-0.7.log
SQL> whenever sqlerror exit sql.sqlcode
SQL> select 'spacewalk-schema-0.6-to-spacewalk-schema-0.7/002-rhn_db_environment-rhn_environment-drop.sql'
from dual;

'SPACEWALK-SCHEMA-0.6-TO-SPACEWALK-SCHEMA-0.7/002-RHN_DB_ENVIRONMENT-RHN_ENVIRON
--------------------------------------------------------------------------------
spacewalk-schema-0.6-to-spacewalk-schema-0.7/002-rhn_db_environment-rhn_environm
ent-drop.sql


SQL> alter table rhn_config_macro drop constraint
rhn_confm_envir_environment_fk;

Table altered.

SQL> alter table rhn_config_macro drop primary key;

Table altered.

SQL> drop index rhn_confm_environment_name_pk;
drop index rhn_confm_environment_name_pk

^^ the last drop didn't get committed. Any ideas on how to get one of
those magic strings "'rhn-satellite-schema", "spacewalk-schema", or
"satellite-schema" back into the DB so that the script can continue
and finish ? Don't have a backup of the DB :( .

Thanks,
Sabuj




More information about the Spacewalk-list mailing list