Why do I need two of them? When I have to use one or another?
In short: SID = the unique name of your DB, ServiceName = the alias used when connecting
Not strictly true. SID = unique name of the INSTANCE (eg the oracle process running on the machine). Oracle considers the "Database" to be the files.
Service Name = alias to an INSTANCE (or many instances). The main purpose of this is if you are running a cluster, the client can say "connect me to SALES.acme.com
", the DBA can on the fly change the number of instances which are available to SALES.acme.com
requests, or even move SALES.acme.com
to a completely different database without the client needing to change any settings.