OMS 13c agent installation failed with "The referenced database doesn't contain a valid management Repository."
Cause :-
Generally this error comes when the database we are using as OMS database was already used as a database for OMS installation before or A failed OMS installation already happened using this database.
Solution :-
we have to properly clean the database before using it again as a OMS database :-
Below steps I did to clean my database :-
1. Drop sysman related schemas.
[oracle@ ~]$ . .bash_profile
[oracle@ ~]$ sqlplus / as sysdba
SQL> DROP USER SYSMAN CASCADE;
User dropped.
SQL> DROP USER SYSMAN_OPSS CASCADE;
User dropped.
SQL> DROP USER SYSMAN_MDS CASCADE;
User dropped.
SQL> DROP USER SYSMAN_STB CASCADE;
User dropped.
SQL> DROP USER SYSMAN_BIPLATFORM CASCADE;
User dropped.
SQL> DROP USER SYSMAN_RO CASCADE;
User dropped.
2. Remove Synonyms related to sysman accounts :-
DECLARE
CURSOR l_syn_csr IS
SELECT 'DROP ' ||
CASE owner
WHEN 'PUBLIC'
THEN 'PUBLIC SYNONYM '
ELSE 'SYNONYM ' || owner || '.'
END ||
synonym_name AS cmd
FROM
dba_synonyms
WHERE
table_owner IN (
'SYSMAN',
'SYSMAN_MDS',
'MGMT_VIEW',
'SYSMAN_BIP',
'SYSMAN_APM',
'BIP',
'SYSMAN_OPSS',
'SYSMAN_RO'
);
BEGIN
FOR l_syn_rec IN l_syn_csr LOOP
BEGIN
EXECUTE IMMEDIATE l_syn_rec.cmd;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line( '===> ' || l_syn_rec.cmd );
dbms_output.put_line( sqlerrm );
END;
END LOOP;
END;
/
PL/SQL procedure successfully completed.
3. Removing remaining Objects and tablespaces :-
SQL> DROP USER mgmt_view CASCADE;
User dropped.
SQL> DROP TABLESPACE mgmt_ecm_depot_ts INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
Tablespace dropped.
SQL> DROP TABLESPACE mgmt_tablespace INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
Tablespace dropped.
SQL> DROP TABLESPACE mgmt_ad4j_ts INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
Tablespace dropped.
4. As proper database cleaning using RepManager dropall didn't happen, so we have to clean up the registry details :-
DELETE
FROM
schema_version_registry
WHERE
(comp_name,owner) IN (
('Authorization Policy Manager','SYSMAN_APM'),
('Metadata Services','SYSMAN_MDS'),
('Oracle Platform Security Services','SYSMAN_OPSS')
);
2 rows deleted.
SQL> commit;
Commit complete.
SQL> ALTER SYSTEM SET optimizer_dynamic_sampling = 0 SCOPE=both;
System altered.
Cause :-
Generally this error comes when the database we are using as OMS database was already used as a database for OMS installation before or A failed OMS installation already happened using this database.
Solution :-
we have to properly clean the database before using it again as a OMS database :-
Below steps I did to clean my database :-
1. Drop sysman related schemas.
[oracle@ ~]$ . .bash_profile
[oracle@ ~]$ sqlplus / as sysdba
SQL> DROP USER SYSMAN CASCADE;
User dropped.
SQL> DROP USER SYSMAN_OPSS CASCADE;
User dropped.
SQL> DROP USER SYSMAN_MDS CASCADE;
User dropped.
SQL> DROP USER SYSMAN_STB CASCADE;
User dropped.
SQL> DROP USER SYSMAN_BIPLATFORM CASCADE;
User dropped.
SQL> DROP USER SYSMAN_RO CASCADE;
User dropped.
2. Remove Synonyms related to sysman accounts :-
DECLARE
CURSOR l_syn_csr IS
SELECT 'DROP ' ||
CASE owner
WHEN 'PUBLIC'
THEN 'PUBLIC SYNONYM '
ELSE 'SYNONYM ' || owner || '.'
END ||
synonym_name AS cmd
FROM
dba_synonyms
WHERE
table_owner IN (
'SYSMAN',
'SYSMAN_MDS',
'MGMT_VIEW',
'SYSMAN_BIP',
'SYSMAN_APM',
'BIP',
'SYSMAN_OPSS',
'SYSMAN_RO'
);
BEGIN
FOR l_syn_rec IN l_syn_csr LOOP
BEGIN
EXECUTE IMMEDIATE l_syn_rec.cmd;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line( '===> ' || l_syn_rec.cmd );
dbms_output.put_line( sqlerrm );
END;
END LOOP;
END;
/
PL/SQL procedure successfully completed.
3. Removing remaining Objects and tablespaces :-
SQL> DROP USER mgmt_view CASCADE;
User dropped.
SQL> DROP TABLESPACE mgmt_ecm_depot_ts INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
Tablespace dropped.
SQL> DROP TABLESPACE mgmt_tablespace INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
Tablespace dropped.
SQL> DROP TABLESPACE mgmt_ad4j_ts INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
Tablespace dropped.
4. As proper database cleaning using RepManager dropall didn't happen, so we have to clean up the registry details :-
DELETE
FROM
schema_version_registry
WHERE
(comp_name,owner) IN (
('Authorization Policy Manager','SYSMAN_APM'),
('Metadata Services','SYSMAN_MDS'),
('Oracle Platform Security Services','SYSMAN_OPSS')
);
2 rows deleted.
SQL> commit;
Commit complete.
SQL> ALTER SYSTEM SET optimizer_dynamic_sampling = 0 SCOPE=both;
System altered.