Hi CN,
The procedure you have followed in the beginning is right.
But if you are trying to do with second option like from source schema(s1) of db1 to target schema(t1) of db2, it is not possible with pg_restore because while restoring from backup dump, it follows the sequence of commands like
"CREATE SCHEMA s1"
"SET SEARCH_PATH=s1"
"CREATE TABLE table_name(id int)"
"INSERT INTO table_name VALUES(1)"
2: If you are taking the dump in plan text format you can edit the plain text file and replace schema old name to new name and then you can restore the file using psql -d <db> -U <user> -f <path of plain text file>.
--
Thanks & Regards
Venkataramana Aitla
Database Administrator
Shreeyansh Technologies