Re: Importing a backup of data

2020-02-11 Thread Emmanuel Lécharny



On 11/02/2020 14:40, Davies, Matt wrote:

Thanks Emmanuel

I've got to that bit, and I'm seeing loads of data now, much much better

The only issue now is that it's not in the correct order, and it's failing 
creating items, when their parent item hasn't been created yet but is further 
down in the file.

We're not passing a -S option, but we are passing a -s, but I don't think that 
relates to the order of the results, whilst -S does.

Any ideas what switch to use to ensure the results follow the correct parent 
first pattern so I can import it?


Sadly, there is no such option that enforces the ordering the way you 
want. The only solution is to inject the file until it get accepted 
fully, discarding the errors (ldapadd -c ...). Otherwise, you have to 
massage the file 'by hand'.


Ldap is not necessarily funny...



-
To unsubscribe, e-mail: dev-unsubscr...@directory.apache.org
For additional commands, e-mail: dev-h...@directory.apache.org



RE: Importing a backup of data

2020-02-11 Thread Davies, Matt
Thanks Emmanuel

I've got to that bit, and I'm seeing loads of data now, much much better

The only issue now is that it's not in the correct order, and it's failing 
creating items, when their parent item hasn't been created yet but is further 
down in the file.

We're not passing a -S option, but we are passing a -s, but I don't think that 
relates to the order of the results, whilst -S does.

Any ideas what switch to use to ensure the results follow the correct parent 
first pattern so I can import it?

Thanks again Emmanuel



From: Emmanuel Lécharny [elecha...@gmail.com]
Sent: 11 February 2020 13:11
To: dev@directory.apache.org
Subject: Re: Importing a backup of data

On 11/02/2020 11:24, Davies, Matt wrote:
> Hi there
>
> A colleague of mine recently exported what we believed to be all the data 
> from a running apacheds v24 server like so
>
> ldapsearch -h hostname -x -p 10389 -b "dc=org" -s sub "(ObjectClass=)" + > 
> backup_060220.ldif
>
> I've then ran through a number of ldif scripts, adding them to a new 
> installation to build up the same structure on a different machine, but when 
> I try to add the backup file it's failing right at the start
>
> ldapadd -h localhost -p 10389 -x -w [PASSWORD] -D "uid=admin,ou=system"  -f 
> /tmp/backup_060220.ldif
>
> adding new entry "dc=DansOrg2,dc=org"
> ldap_add: Object class violation (65)
>   additional info: OBJECT_CLASS_VIOLATION: failed for MessageType : 
> ADD_REQUEST
> Message ID : 2
>  Add Request :
> Entry
>  dn[n]: dc=DansOrg2,dc=org
>
>  subschemaSubentry: cn=schema
>  createTimestamp: 20191018141712.279Z
>  entryUUID: a98fa576-d440-49d5-b336-5f175a5c619e
>  entryDN: dc=DansOrg2,dc=org
>  nbSubordinates: 2
>  entryCSN: 20191018141712.279000Z#00#001#00
>  entryParentId: 2115906e-3e4d-433e-95f3-3311038027b2
>  nbChildren: 2
>  creatorsName: 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system
> : ERR_60 Entry dc=DansOrg2,dc=org does not contain a STRUCTURAL ObjectClass
>
>
> Looking at the backup ldif file, there are numerous entries at the beginning 
> that don't have any objectclass defined, here's the first one
>
> # DansOrg2.org
> dn: dc=DansOrg2,dc=org
> entryCSN: 20191018141712.279000Z#00#001#00
> nbSubordinates: 2
> nbChildren: 2
> createTimestamp: 20191018141712.279Z
> creatorsName: 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system
> subschemaSubentry: cn=schema
> entryDN: dc=DansOrg2,dc=org
> entryUUID: a98fa576-d440-49d5-b336-5f175a5c619e
> entryParentId: 2115906e-3e4d-433e-95f3-3311038027b2
>
> We're very new to apacheds, so I don’t know if we're creating the backup 
> incorrectly, or importing it incorrectly, or a bit of both.
>
> I don't really understand how it could import without an object class.

You specified that you wanted only the operational attributes in your
search request ( the '+' at the end of ...-s sub "(ObjectClass=)" +)

Replace it with '*', that should do the trick. Or use '*' and '+'.


Note : you should normally not specify either of them. The operational
attributes are internal attributes that are not necessarily needed
(except in some corner cases) and teh default is for a search to return
all the other attributes (ie you don't have to add the '*')


Hope it helps.

Emmanuel

-
To unsubscribe, e-mail: dev-unsubscr...@directory.apache.org
For additional commands, e-mail: dev-h...@directory.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@directory.apache.org
For additional commands, e-mail: dev-h...@directory.apache.org



Re: Importing a backup of data

2020-02-11 Thread Emmanuel Lécharny



On 11/02/2020 11:24, Davies, Matt wrote:

Hi there

A colleague of mine recently exported what we believed to be all the data from 
a running apacheds v24 server like so

ldapsearch -h hostname -x -p 10389 -b "dc=org" -s sub "(ObjectClass=)" + > 
backup_060220.ldif

I've then ran through a number of ldif scripts, adding them to a new 
installation to build up the same structure on a different machine, but when I 
try to add the backup file it's failing right at the start

ldapadd -h localhost -p 10389 -x -w [PASSWORD] -D "uid=admin,ou=system"  -f 
/tmp/backup_060220.ldif

adding new entry "dc=DansOrg2,dc=org"
ldap_add: Object class violation (65)
additional info: OBJECT_CLASS_VIOLATION: failed for MessageType : 
ADD_REQUEST
Message ID : 2
 Add Request :
Entry
 dn[n]: dc=DansOrg2,dc=org

 subschemaSubentry: cn=schema
 createTimestamp: 20191018141712.279Z
 entryUUID: a98fa576-d440-49d5-b336-5f175a5c619e
 entryDN: dc=DansOrg2,dc=org
 nbSubordinates: 2
 entryCSN: 20191018141712.279000Z#00#001#00
 entryParentId: 2115906e-3e4d-433e-95f3-3311038027b2
 nbChildren: 2
 creatorsName: 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system
: ERR_60 Entry dc=DansOrg2,dc=org does not contain a STRUCTURAL ObjectClass


Looking at the backup ldif file, there are numerous entries at the beginning 
that don't have any objectclass defined, here's the first one

# DansOrg2.org
dn: dc=DansOrg2,dc=org
entryCSN: 20191018141712.279000Z#00#001#00
nbSubordinates: 2
nbChildren: 2
createTimestamp: 20191018141712.279Z
creatorsName: 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system
subschemaSubentry: cn=schema
entryDN: dc=DansOrg2,dc=org
entryUUID: a98fa576-d440-49d5-b336-5f175a5c619e
entryParentId: 2115906e-3e4d-433e-95f3-3311038027b2

We're very new to apacheds, so I don’t know if we're creating the backup 
incorrectly, or importing it incorrectly, or a bit of both.

I don't really understand how it could import without an object class.


You specified that you wanted only the operational attributes in your 
search request ( the '+' at the end of ...-s sub "(ObjectClass=)" +)


Replace it with '*', that should do the trick. Or use '*' and '+'.


Note : you should normally not specify either of them. The operational 
attributes are internal attributes that are not necessarily needed 
(except in some corner cases) and teh default is for a search to return 
all the other attributes (ie you don't have to add the '*')



Hope it helps.

Emmanuel

-
To unsubscribe, e-mail: dev-unsubscr...@directory.apache.org
For additional commands, e-mail: dev-h...@directory.apache.org