Environment: Operating System: Windows 11 Pro Oracle Database: 23ai
By default, when the Oracle Database service is started, the container database is started and opened automatically, but any non-default pluggable databases must be manually opened before use.
Default pluggable database FREEPDB1 will open automatically when the Oracle service starts and when the container database opens.
You can stop/start Oracle database by below two methods: 1) Starting Up and Shutting Down Using Windows Services 2) Starting Up and Shutting Down Using SQL*Plus
1) Starting Up and Shutting Down Using Windows Services
Stopping Oracle database 23ai services (Listener and Database) - (Windows + R) and type services.msc. - Locate OracleOraDB23Home1TNSListener service in the Services window. - Right click the OracleOraDB23Home1TNSListener service, and from the menu, select Stop. - Similarly, locate OracleServiceFREE service in the Services window. - Right-click the OracleServiceFREE service, and from the menu, select Stop.
You can ensure that LISTENER service is not runninng.
You can stop DB service as below:
You can ensure that database service is not runninng.
Starting Oracle database 23ai services (Listener and Database) - (Windows + R) and type services.msc. - Locate OracleOraDB23Home1TNSListener service in the Services window. - Right click the OracleOraDB23Home1TNSListener service, and from the menu, select Start. - Similarly, locate OracleServiceFREE service in the Services window. - Right-click the OracleServiceFREE service, and from the menu, select Start.
You can ensure that both database and listener services are running.
2) Starting Up and Shutting Down Using SQL*Plus
Stopping:
Ensure that both database and listener are running.
You can shut down the database using SQL*Plus. Issue the following SQL*Plus command.
C:\Windows\System32> set ORACLE_SID=FREE
C:\Windows\System32> sqlplus / as sysdba
SQL> select name,open_mode from v$database; SQL> select con_id,name,open_mode from v$pdbs;
SQL> shut immediate;
SQL> exit;
Ensure that LISTENER and database services are running.
Login to the database by sqlplus and shutdown the database instance. Please note that database service will still be running since we have shut down only database not service.
You can also stop LISTENER from cmd prompt.
You can see if you stop the LISTENER then its service is stopped automatically, but this did not happen with database service.Starting:
You can start the database using SQL*Plus. Issue the following SQL*Plus command.
C:\Windows\System32> set ORACLE_SID=FREE
C:\Windows\System32> sqlplus / as sysdba SQL> startup;
#To start non default PDBs. SQL> ALTER PLUGGABLE DATABASE ALL OPEN;
SQL> select name,open_mode from v$database; SQL> select con_id,name,open_mode from v$pdbs;
SQL> exit;
Ensure that both database and listener are not running.
Please note that the SAVE STATE of the PDB database is OPEN and hence the FREEPDB1 started in READ WRITE mode.
SQL> col name for a23 SQL> col INSTANCE_NAME for a23 SQL> select con_id,CON_NAME,INSTANCE_NAME,STATE from DBA_PDB_SAVED_STATES;
CON_ID CON_NAME INSTANCE_NAME STATE ------- ----------- -------------- ------ 3 FREEPDB1 free OPEN
INSTANCE_NAME --> Name of the instance for which the state is saved.
You can see LISTENER service is started after starting LISTENER.
Please note that the default pluggable database FREEPDB1 will open automatically when the container database opens, such as when Windows is rebooted and the FREE service starts. It will not need to be opened manually.
Other non-default pluggable databases will not open automatically. You have to manually start them using below command or they can be set to automatically open when the container database opens by connecting to the container database via SQL*Plus, and issuing the following SQL:
#To start non-default PDBs manually. SQL> ALTER PLUGGABLE DATABASE ALL OPEN;
#To start non-default PDBs automatically. SQL> ALTER PLUGGABLE DATABASE ALL SAVE STATE;
These commands will need to be reissued when additional pluggable databases are created.
|
Thanks for reading this post ! Please comment if you like this post ! Click FOLLOW to get future blog updates !
Thank you for your comment !