by Ken Task.
"... add some more context"
Ahhhh, the devils are always in the details! ![smile smile]()
In everything moodle id numbers are sequential and the next new whatever will be the next available id number. That's true of courses. So a course that has been deleted - it's id is no longer used, but moodle won't go back to find the first id number that's not used and use it.
Using a mysql client, on the DB for your Moodle where a course has been deleted, make this query:
select id,fullname,shortname from mdl_course;
Course ID 1 is your front page and should always remain 1.
All other course ID's are courses. You will see gaps in sequence of id column.
Don't think there is a GUI tool to set course ID number.
But, if you are careful and know for sure what course ID a restored course should have, you could restore a course, id number will be the last one added, then set the course id via DB directly to the id desired.
Catch 22 ... indexes of tables. You don't see those but they are there.
If you go that route, make sure you backup your DB before such actions.
Got a clone of your production site? Use that first! ![smile smile]()
'SoS', Ken