To attain means to reach as an end, to gain or achieve a goal through some growth, effort, or progression.
The report stated that the company had attained a perfect safety record for the quarter.
To obtain means to acquire, get hold of, procure, or possess.
He obtained a copy of the report the day before it was to be released.
Obtain also has a second meaning as an intransitive verb, which takes no object.
It means to exist, to prevail, or to be customary or established.
Because the original plan no longer obtains, we will need to revise the budget.