Rename an existing database.
Section: Database and Role Lifecycle
Rename database
sql
sql
ALTER DATABASE appdb RENAME TO appdb_prod;Explanation
Cannot rename the currently connected database.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Database and Role Lifecycle