Moneycontrol Brokerage Recos

Friday, August 9, 2019

ORA-65093: multitenant container database not set up properly



While creating or starting a container database manually when initialization parameter (enable_pluggable_database) is not set to true (enable_pluggable_database=true), it throws the error : ORA-65093: multitenant container database not set up properly


Below is the initialization parameter file without enable_pluggable_database parameter set to true or not included at all. I am simulating the error while creating a container database using command line - manually.


[oracle@exadbadm01 dbs]$ cat initCDB1.ora
db_name='CDB1'
memory_target=3100M
db_create_file_dest='+DATAC1'
db_create_online_log_dest_1='+RECOC1'
control_files='+DATAC1'


Export or set the ORACLE_SID and ORACLE_HOME environment variable and start the instance in nomount state.



export ORACLE_SID=CDB1
export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1



SQL> startup nomount
ORACLE instance started.

Total System Global Area 3254779904 bytes
Fixed Size                  2929648 bytes
Variable Size            2810166288 bytes
Database Buffers          402653184 bytes
Redo Buffers               39030784 bytes
SQL>


Since we have not included the enable_pluggable_database parameter in our initialization parameter file, let's try to create the container database (to enable/create a container database you need to include ENABLE PLUGGABLE DATABASE SEED  clause in the create database command)


SQL> CREATE DATABASE CDB1
USER SYS IDENTIFIED BY Welcome1
USER SYSTEM IDENTIFIED BY Welcome1
EXTENT MANAGEMENT LOCAL
DEFAULT TABLESPACE users
DEFAULT TEMPORARY TABLESPACE temp
UNDO TABLESPACE undotbs1
  2    3    4    5    6    7    8  ENABLE PLUGGABLE DATABASE
   SEED
   SYSTEM DATAFILES SIZE 125M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
   SYSAUX DATAFILES SIZE 100M;  9   10   11
CREATE DATABASE CDB1
*
ERROR at line 1:
ORA-65093: multitenant container database not set up properly

Above it throws the error that we tried to reproduce and now we know why does it come.

Now, let's include the enable_pluggable_database=true in our initialization parameter file and bounce the instance.



[oracle@exadbadm01 dbs]$ cat initCDB1.ora
db_name='CDB1'
memory_target=3100M
db_create_file_dest='+DATAC1'
db_create_online_log_dest_1='+RECOC1'
control_files='+DATAC1'
enable_pluggable_database=true




SQL> shut immediate
ORA-01507: database not mounted


ORACLE instance shut down.
SQL>




SQL> startup nomount
ORACLE instance started.

Total System Global Area 3254779904 bytes
Fixed Size                  2929648 bytes
Variable Size            2810166288 bytes
Database Buffers          402653184 bytes
Redo Buffers               39030784 bytes
SQL>


Finally, let's create the container database now.


SQL> CREATE DATABASE CDB1
USER SYS IDENTIFIED BY Welcome1
USER SYSTEM IDENTIFIED BY Welcome1
EXTENT MANAGEMENT LOCAL
DEFAULT TABLESPACE users
DEFAULT TEMPORARY TABLESPACE temp
  2    3    4    5    6    7  UNDO TABLESPACE undotbs1
ENABLE PLUGGABLE DATABASE
   SEED
   SYSTEM DATAFILES SIZE 125M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
   SYSAUX DATAFILES SIZE 100M;  8    9   10   11

Database created.

SQL>


Container database created successfully now. You can validate the DB details now.



SQL> select name, open_mode, database_role , cdb from v$database;

NAME      OPEN_MODE            DATABASE_ROLE    CDB
--------- -------------------- ---------------- ---
CDB1      READ WRITE           PRIMARY          YES

SQL>

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
SQL>


As of now, we don't have any Pluggable Database create hence there is SEED PDB only as a default. Further we would see how to create PDBs in separate articles.

SQL> col name for a15
SQL> col OPEN_TIME for a35
SQL> select con_id, dbid, name, open_mode, open_time, total_size, recovery_status from v$pdbs;

    CON_ID       DBID NAME            OPEN_MODE  OPEN_TIME                           TOTAL_SIZE RECOVERY
---------- ---------- --------------- ---------- ----------------------------------- ---------- --------
         2 2931554829 PDB$SEED        READ ONLY  09-AUG-19 07.17.39.413 AM -05:00     340787200 ENABLED

SQL>



SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT



SQL> select name, status, con_id from v$datafile;

NAME                                                                             STATUS      CON_ID
-------------------------------------------------------------------------------- ------- ----------
+DATAC1/CDB1/DATAFILE/system.11080.1015822331                                    SYSTEM           1
+DATAC1/CDB1/8FA8EFE7EE287653E0537C17800A501C/DATAFILE/system.11081.1015822331   SYSTEM           2
+DATAC1/CDB1/DATAFILE/sysaux.11082.1015822335                                    ONLINE           1
+DATAC1/CDB1/8FA8EFE7EE287653E0537C17800A501C/DATAFILE/sysaux.11083.1015822335   ONLINE           2
+DATAC1/CDB1/DATAFILE/undotbs1.11084.1015822335                                  ONLINE           1
+DATAC1/CDB1/DATAFILE/users.11087.1015822335                                     ONLINE           1
+DATAC1/CDB1/8FA8EFE7EE287653E0537C17800A501C/DATAFILE/users.11088.1015822337    ONLINE           2



Hope it helps, subscribe to this blog to stay updated on latest Oracle Technologies and new articles.

Twitter : @rajsoft8899
Linkedin : https://www.linkedin.com/in/raj-kumar-kushwaha-5a289219/

No comments:

Post a Comment