Aaron Carter isn't taking any chances with an ex-girlfriend he says threatened to stab him with a knife ... he was just granted a restraining order against the woman.
Aaron filed for a restraining order Monday in L.A. County Superior Court against Lina Valentina -- his ex who cops recently named as a suspect in a domestic violence report.
According to the docs, Aaron says Lina threatened to stab him several times and carries a knife with her. He claims she physically abused him during their relationship, shoving him and hitting him in the face.
TMZ broke the story ... police took a report for an alleged incident between Aaron and Lina that went down July 31 around 2 AM at the singer's Lancaster pad. Our sources say Aaron told cops she slapped him in the face, leaving a bruise on his cheek.
The alleged incident happened only days before Aaron confirmed his split with Lina.
The judge ordered Lina to stay 100 yards away from Aaron ... at least until the hearing next month.