You open a port with a program. The operating system provides primitives for you to do so, which is usually done at the OS level is to allow the port to accept connections. For this, you may need to configure the firewall or even SELinux, depending on your installation (even though I did not see Ubuntu standard installation bringing any of these). @ Andrea pointed out that you do not need special permission to the program if it wants to open the port. Again, this is a program, a server, which will be listening on a port.
Any network communication, using connection-oriented protocol (such as TCP / IP), needs a listening server port, and connecting client. I do not know Heroku, but I guess by the looks of the command that you posted, you are trying to migrate a database from one place to another. That depends if you open two connections, one to extract the data from and the other one to write into.
If you intend to receive connections from the Internet, then you need a port on a public IP, which arrives to the port 5000 of your server machine.
If you think you have a correct installation, then try this command:
sudo netstat -tnlp
It should give you something like this output:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 940/sshd
This is the case, for a SSH server, listening on port 22. You should have something similar, for the 5000 port.
It that's the case, then try connecting from your internal network to the server's IP, and then figure out how to open it to Internet.
You can do this with the telnet command:
$ telnet 192.168.1.1 22
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.8p1 Debian-7ubuntu1
^\
Connection closed by foreign host.
If you got the word "Connected" then your port is alive and kicking :)
This is a sample for a SSH server listening, your heroku output should be different.