In this work, we have proposed and studied efficient online algorithms for shared path protection under dynamic traffic conditions in survivable WDM optical mesh networks. Given a connection request, routing and wavelength assignment of a working path and a protection path for the request is formulated as two integer linear programs based on shared and dedicated path protection, respectively. The objective is to minimize the total cost of additional resources used by the working path as well as the protection path to accommodate a new connection request. We then devise two resource efficient online algorithms using pre-computed candidate routes. The first algorithm uses one candidate working path and one candidate protection path for each newly arrived connection request while the second algorithm may use multiple candidate working paths and/or multiple candidate protection paths. The selection of a pair of paths from candidate routes as well as the assignment of appropriate wavelengths to accommodate a connection request is then jointly considered to minimize the total cost of additional resources. The solutions to the ILP formulations serve as the baseline for evaluating the performance of the proposed algorithms.We have evaluated the effectiveness of the proposed online algorithms via extensive simulations in terms of the connection blocking probability and the revenue earnings improved over the dedicated path protection approach. Our simulations indicate that our proposed computationally efficient online algorithms are able to provide 100% restorability against single failures with a resource efficiency comparable to that of the optimal shared path protection. The results also show that a small increase in the number of candidate working paths or protection paths (from 1 to 3) provides better performance, but a further increase does not improve the performance significantly. Therefore, a proper balance can be struck to achieve both satisfactory performance and efficient computation.