CREATE new_db WITH TEMPLATE old_db OWNER src_db_owneror run the command in terminal:
createdb -O src_db_owner -T src_db new_db
You may get errors if the source database is in use:
ERROR: source database "src_db" is being accessed by other usersYou can kill all the connections to the source databse:
SELECT pg_terminate_backend(pg_stat_activity.procpid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'src_db' AND procpid <> pg_backend_pid();then run the command
CREATE new_db WITH TEMPLATE src_db OWNER src_db_owner
No comments:
Post a Comment