1. Take a backup of your database as explained here.
2. Find out the entity_id value for orders and invoices by opening the table eav_entity_type:
3. Open the table eav_entity_store and change the value in the increment_last_id field to the number to want to use:
- WordPress – Fatal error: Allowed memory size….
- Magento – reset “use secure in frontend or admin” using PhpMyadmin