Thanks Pedro actually this works.
I stopped these services to rename the database.
Management reporter 2012 process service
Microsoft Dynamics 365 for Operations – Batch Management service
Microsoft Dynamics 365 for Operations – Data import/Export Framework service
World Wide Web Publishing Service
After I stopped them I rename the database and then start the services again.