Fix duplicated package ID in red hat satellite


Our red hat satellite stops to sync from the subscribed red hat channel. We turned the debug on and found out it is caused by the duplicated package ID in the self-managed oracle database. Here is how to fix it:

1) Turn on debug to find out the duplicated package ID.

echo “debug=7” >> /etc/rhn/rhn.conf

2) Run the sync, and monitor the log.

satellite-sync

tail -f /var/log/rhn/rhn_server_satellite.log

{\’package_id\’: [97018, 97018, 97018, 97018, 97018, 97018, 97018…
SYNC ERROR: unhandled exception occurred: SYNC ERROR: unhandled exception occurred:

3) As above, we can see the ID is 97018. Backup the database before making any changes.

rhn-satellite stop
db-control backup /var/satellite/DBBAK/2014-07-28
rhn-satellite start

4) Connect to Oracle, then remove the duplicated package.

(Optional, in case the ORACLE_SID has not been setup)
sudo su – oracle
. oraenv
ORACLE_SID = [/usr/bin/logname] ? rhnsat

Run sqlplus and execute the following sql statements.

set feedback on;
delete from rhnChannelPackage where package_id=97018;
select count(*) from rhnChannelPackage where package_id=97018;
delete from rhnPackage where id=97018;
select count(*) from rhnPackage where id=97018;
commit;

5) Run the sync again to confirm it fixed the issue.

satellite-sync or  satellite-sync -c channel_name

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s