If you enter Germany on a visa and intend to stay for a longer period, it is imperative that you get a residence permit. However, students from a whole list of other countries must also apply for a residence permit. The Aliens Department in your place of residence in Germany is responsible for this.
Students from the European Union, the European Economic Area and Switzerland do not need a residence permit, but they must prove that they have health insurance and that they can finance their studies.
For the residence permit you need a certificate of enrolment from the university, the registration from the authorities, the proof of financing, and valid health insurance.
Just like the visa, a residence permit is granted for a particular purpose. International students can get a residence permit for their studies. The purpose of your residence determines to what extent you can work. Students with a residence permit who are attending preparatory language courses or preparatory college are only allowed to work during the holidays.
A residence permit for the purpose of studying is usually issued for a period of two years and must always be extended before the two years run out. The extension depends on how you conduct your studies, e.g. whether you take examinations and obtain ECTS. In this way, the chances of completing your studies within an appropriate timeframe are assessed.