I am looking for a basic script/command that will create a copy of a live database (let name them mydb and mydb_test, both on the same server).
mydb
mydb_test
Are you looking into the Hot Standby with Streaming Replication here?