Around the world, hundreds of oil wells are undergoing repair, and this number is predicted to stay constant for the foreseeable future. These oil wells must operate safely for the sake of the environment and our way of life. Although it would be easier to forecast anomalies and unwanted events in advance and avert potentially disastrous situations, the intricacy of the issue makes manual prediction challenging. This project proposes a prediction of oil using an optimized gated recurrent unit. Initially, in the data collection process, getting input data for the prediction of oil production. The input data is moved for preprocessing. The dataset is pre-processed in order to handle missing values, data cleaning, and data filtering. Pre-processed data are further moved to the data analysis and exploration process. This procedure, which frequently makes use of data processing techniques, analyzes, investigates, and summarizes data sets' primary features. These data are further split into training and testing using feature selection. Selected features are subsequently classified using the Optimized Gated Recurrent Unit (GRU). Finally, from the classification of RMSE (Root Mean Square Error) and MAE (Mean Absolute Error), R2 score values are accurately predicted. This project is implemented using Python software. The MAE, MSE and RMSE Comparison of the Classification values are listed as 0.0157181852040254, 0.00302712813431332 and 0.0550193432741006 for SVM, ANN and GRU Classier Respectively.