How to connect to and automatically open the ORCLPDB1 Oracle 19c Pluggable database

In a previous tutorial we saw how to autostart the ORCLCDB sample Oracle database in an Oracle Linux 8.5 VM. We are now going to see how to connect to the ORCLPDB1 Pluggable database hosted by the ORCLCDB Container and how to auto open it after a reboot.

ORCLPDB1 READ WRITE
ORCLPDB1 READ WRITE

I was planning to use the ORCLPDB1 Pluggable database created with the installation of the ORCLCDB Container database for the installation of the Oracle Analytics Server. But I get the “ORA-12154: TNS: could not resolve the connect identifier specified” error the first time I tried to connect to with the “sqlplus” command.

ORA-12154: TNS: could not resolve the connect identifier specified
ORA-12154: TNS: could not resolve the connect identifier specified

I quickly realised that there was no entry for this database in the “tnsnames.ora” “Oracle Listener” file so I edited this file and I added the connexion parameters for ORCLPDB1 with the “sudo vi /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora” command:

Add ORCLPDB1 entry in /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora file
Add ORCLPDB1 entry in /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora file

I tried to connect again using the “sqlplus sys@orclpdb1 as sysdba” command and I could connect this time:

sqlplus sys@orclpdb1 as sysdba
sqlplus sys@orclpdb1 as sysdba

I checked the status of the Pluggable database using the “show pdbs” command and I realised that it was mounted but not opened, so I used the “alter pluggable database orclpdb1 open;” command to open it:

alter pluggable database orclpdb1 open;
alter pluggable database orclpdb1 open;

I was now able to use the ORCLPDB1 database, but after rebooting the VM, I realised that it was mounted but not opened automatically after a reboot. I didn’t want to have to manually open it after every reboot so I found that I could ask Oracle to save the state of a Pluggable DB using the “alter pluggable database orclpdb1 save state;” command:

alter pluggable database orclpdb1 save state;
alter pluggable database orclpdb1 save state;

As a consequence, the Oracle Database Server would now preserve the Pluggable DB state after restarting the DB. I restarted the VM once more and I used the “show pdbs” command to check the ORCLPDB1 database open mode and it was effectively “READ WRITE” as expected :

show pdbs after reboot
show pdbs after reboot

With these modifications, the ORCLPDB1 Pluggable database now opened automatically after restarting up the VM and I didn’t have to execute additional commands in order to be able to use it.

Disclaimer

The information contained in this Website is for general information purposes only. We try to keep this information up to date and correct but we make no warranties of any kind about the completeness, accuracy, reliability with respect to the website, the information or the graphics contained on the website for any purpose. Any reliance you place on such information is strictly at your own risk. In no event will we be liable for any loss or damage whatsoever from the use of this Website.

The post How to connect to and automatically open the ORCLPDB1 Oracle 19c Pluggable database appeared first on MyBIJourney

All trademarks are properties of their respective owners.
FacebookTwitterPinterestWhatsAppMail