Cognitive radio has been suggested as a solution to address the shortage of accessible spectrum caused by the significant demand for wideband services and the fragmentation of spectrum resources. Nevertheless, the sensing performance is rather inadequate owing to the diminished sensing signal-to-noise ratio, especially in complex environments with severe channel fading. Fortunately, applying reconfigurable intelligent surfaces (RIS) for spectrum sensing can efficiently address the aforementioned problems. However, the passive RIS may experience the "double fading" effect, seriously limiting the effectiveness of passive RIS-aided spectrum sensing. Thus, a crucial challenge is how to fully exploit the potential advantages of the RIS and further improve the sensing performance. In this paper, we utilize the passive and active RIS to further enhance detection probability and subsequently develop two different problems for both the passive and active RIS to achieve the detection probability maximization. Considering the complexity of the above problems, we design a one-stage optimization algorithm featuring inner approximation and a two-stage optimization algorithm that employs the bisection method to derive corresponding solutions, and further establish the upper bound and lower bound of the detection probability by employing the Rayleigh quotient. Moreover, we separately explore how many reflecting elements are needed for passive RIS and active RIS and investigate the detection performance comparison of the two types (passive and active) of RIS. Simulation results show that the proposed algorithms outperform existing algorithms under the same parameter configuration, and achieve a detection probability close to 1 with even fewer reflecting elements or antennas than existing schemes.