The Schottky barrier at the metal-nanotube contact has been a prime issue in the nanoscale devices. Here we use ab initio density-functional calculations to investigate the electronic structure and the Fermi level alignment at the metal-nanotube contacts. Consistent with the common concept of the large (small) work function of gold (aluminum) surfaces, the Fermi level of the gold layer is found to be aligned at the valence band edge, while that of the aluminum sits at the conduction band edge of the semiconducting carbon nanotube. However, upon the oxidation, the work function of aluminum surface becomes as large as that of the clean gold surface, causing the Fermi level to be aligned at the valence band edge of the semiconducting nanotube. This suggests that the carrier type of the nanotube field effect transistor could transform from n-type to p-type upon oxygen adsorption on the electrode surface. The oxidation-induced increase of the tunneling barrier is also investigated.