Pluggable Database Save State in Oracle

Pluggable Database Save State in Oracle with Examples

In this article, I am going to discuss Pluggable Database Save State in Oracle with Examples. Please read our previous article where we discussed V$Controlfile/ V$Logfile in Oracle.

Pluggable Database Save State in Oracle

In this article, we are going to learn about a concept that will save a lot of time. Every time when we shut down the database or start the database the pluggable database will always be mounted. We have to manually open the pluggable database. So, in order to avoid this there is a solution that always opens the database automatically, and no need to open the pluggable database manually. Oracle introduced this feature from 12c release 2. Oracle introduced this feature to solve this issue. This is using the command “alter pluggable database save state”. Now, to do this we will try to explain this.

Note: Open the Linux machine and start the database and once the database is started start the pluggable database as well.

Open the terminal and connect to the database as “Sqlplus / as sysdba

Pluggable Database Save State in Oracle

Once we are connected to the database, we will run a query to check the status of the pluggable databases.

Query: select name,open_mode from v$pdbs;

Pluggable Database Save State in Oracle

We can see the PDB$SEED database which is READ ONLY and the JAYAPDB pluggable database READ WRITE mode.

You can see in the above screenshot that the table is not formatted correctly. In the sqlplus we have to do a lot of formatting to check the exact output that we are expecting. There is a reason why we are getting this kind of unformatted table. Use the desc command “desc V$pdbs

Pluggable Database Save State in Oracle

From the above result, we can see the NAME column takes 128-character spaces to display the output. So, that is the reason we are getting unformatted output. There is an option to format the data. There is a command to change the format.

Command: col name format a30

Pluggable Database Save State in Oracle

Now, let’s run the query again to check whether we have formatted the data or not.

Query: select name,open_mode from v$pdbs;

This is the reason most of the developers use SQL developer instead of this SQL plus. Because SQL developer is the best platform to write the SQL commands.

We can see the JAYAPDB is in READ WRITE mode. Now, let us try to shut down and start the database again to check whether the pluggable database is open or not.

Shut down & startup:

Pluggable Database Save State in Oracle

Let us try to run the same query again to check the status of the pluggable databases.

Pluggable Database Save State in Oracle

The solution to this problem is to use a command. First, open the pluggable database manually.

Pluggable Database Save State in Oracle

In order to save the state of the pluggable database, we need to use the below command.

Command: Alter pluggable database JAYAPDB save state;

Pluggable Database Save State in Oracle

We have made changes to the pluggable database. So, now let’s shut down and start the database again to check whether this is working or not.

Pluggable Database Save State in Oracle

You can see the pluggable database is open without manually opening the database. So, in this, we can save a lot of time and this method is used widely in many databases to automatically open the pluggable databases.

In the next article, I am going to discuss Initialization Parameters and Parameter Files in Oracle with Examples. Here, in this article, I try to explain Pluggable Database Save State in Oracle with Examples and I hope you enjoy this Pluggable Database Save State in Oracle article.

Leave a Reply

Your email address will not be published. Required fields are marked *