[midPoint] Change OID
Sylvaire kevin TIPA
sylvaire-kevin.tipa at mythalesgroup.io
Thu Oct 8 11:19:15 CEST 2020
Hey, Reply to myself, we have make this job with success in production (MP 3.9 in docker). Following this step :
Be carreful to backup your instance first and ensure than any user will make change in MP during process
Shell code :
```shell
# Export date for get unique id
export int="$(date +%F_%H-%M-%S)"
# Make MP backup
/opt/midpoint/bin/ninja.sh -v export -r -z -O /opt/midpoint/var/backup_changeOID_${int}.zip
# unizp backup
unzip /opt/midpoint/var/backup_changeOID_${int}.zip -d /tmp/changeOID
# For each object than need to be changed
export oldOID="4771e0f2-ea31-443c-aaf2-2364f4f7d83c"
export newOID="41746865-6e61-2000-0003-000000000000"
### Count old oid occurance
grep -i "${oldOID}" /tmp/changeOID/backup_changeOID_${int}-zip.xml | wc -l
### Check new oid is not used
grep -i "${newOID}" /tmp/changeOID/backup_changeOID_${int}-zip.xml | wc -l
### Change oid
sed -i "s/${oldOID}/${newOID}/g" /tmp/changeOID/backup_changeOID_${int}-zip.xml
### Check than new oid is apply - need to return same occurance number as 'Count old oid occurance'
grep -i "${newOID}" /tmp/changeOID/backup_changeOID_${int}-zip.xml | wc -l
### Delet old object (for avoid import error - Import will create new object with same name as old file, so need to delete old object)
/opt/midpoint/bin/ninja.sh -v delete -r -o ${oldOID}
#At the end, import backup
/opt/midpoint/bin/ninja.sh -v import -r -O -i /tmp/changeOID/backup_changeOID_${int}-zip.xml
## Restart MP to ensure all is ok
```
Cordialement,
[https://attachment.outlook.office.net/owa/sylvaire-kevin.tipa@mythalesgroup.io/service.svc/s/GetFileAttachment?id=AAMkAGY1ZjY5NWRmLTQ0ZDgtNGNjMy05NzNkLWJmMDRiMWE1MzRlZABGAAAAAABh4WdBWT4xR7DMeIEaHdTyBwAoAS%2FqG5cHS6e%2BmMV1HZP5AAAAAAEJAAAoAS%2FqG5cHS6e%2BmMV1HZP5AAA6Qq2YAAABEgAQABu5cy33gBtFlMD7DO8YR0A%3D&X-OWA-CANARY=ChiPfpk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ssYRUfiW4dtcuFpSIV16vXS_Lu61-cjbcKGtHNAbGDYFgKiv3vMLzge_N95-xkvLd0GDbPrk743gK0l9TUIjfLTgnrK2uqlSwpVRUeL_dSG-_kKqaMyvJNo0Eh55dKUckmZhws2shczl72V4Ftt-dWzklX6lDGZ6goiYMWb3i0T-_QekdsXRNXlCRO7nIUSlBRndBjtfCMaOE40RBI9lcp9VQKmxWAWQDJpNEUhtQ&owa=outlook.office365.com&isImagePreview=True]
Sylvaire-Kevin TIPA
Thales Services / OIC / DevOps Automatisation Infrastructures
…………………………………………………………………………………………
THALES SERVICES SAS
44 Quai Charles de Gaulle
CS 20100
69463 Lyon Cedex 06
…………………………………………………………………………………………
www.thalesgroup.com<http://www.thalesgroup.com/>
________________________________
De : Sylvaire kevin TIPA
Envoyé : lundi 25 mai 2020 01:11
À : midpoint at lists.evolveum.com <midpoint at lists.evolveum.com>
Objet : Change OID
Hey all,
it's possible to change object OID (en keep link) that is in use ? I thinks that MP pure canno't do that, but with bulk action / ninja bin / SQL in BDD ?
If I need it, do you have some tip, best way or idee of how to do that ?
Thanks, br,
Cordialement,
[https://attachment.outlook.office.net/owa/sylvaire-kevin.tipa@mythalesgroup.io/service.svc/s/GetFileAttachment?id=AAMkAGY1ZjY5NWRmLTQ0ZDgtNGNjMy05NzNkLWJmMDRiMWE1MzRlZABGAAAAAABh4WdBWT4xR7DMeIEaHdTyBwAoAS%2FqG5cHS6e%2BmMV1HZP5AAAAAAEJAAAoAS%2FqG5cHS6e%2BmMV1HZP5AAA6Qq2YAAABEgAQABu5cy33gBtFlMD7DO8YR0A%3D&X-OWA-CANARY=ChiPfpk72ke8XYNev7RaMjBqkl3Gx9UY9Eb1nD0ESaO9Vu49v6lQFICf4be4xrzkFIas0KMHQr8.&token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjA2MDBGOUY2NzQ2MjA3MzdFNzM0MDRFMjg3QzQ1QTgxOENCN0NFQjgiLCJ4NXQiOiJCZ0Q1OW5SaUJ6Z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RndBjtfCMaOE40RBI9lcp9VQKmxWAWQDJpNEUhtQ&owa=outlook.office365.com&isImagePreview=True]
Sylvaire-Kevin TIPA
Thales Services / OIC / DevOps Automatisation Infrastructures
…………………………………………………………………………………………
THALES SERVICES SAS
44 Quai Charles de Gaulle
CS 20100
69463 Lyon Cedex 06
…………………………………………………………………………………………
www.thalesgroup.com<http://www.thalesgroup.com/>
This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are notified that disclosing, distributing, or copying this e-mail is strictly prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20201008/0d50f95b/attachment.htm>
More information about the midPoint
mailing list