Creating a CDB
The procedure for creating a multitenant container database (CDB) is very similar to the procedure for creating a non-CDB
About Creating an Oracle Database
After you plan your database using some of the guidelines presented in this section, you can create the database with a graphical tool or a SQL command. You typically create a database during Oracle Database software installation. However, you can also create a database after installation. Reasons to create a database after installation are as follows:
- You used Oracle Universal Installer (OUI) to install software only, and did not create a database.
- You want to create another database (and database instance) on the same host computer as an existing Oracle database. In this case, this chapter assumes that the new database uses the same Oracle home as the existing database. You can also create the database in a new Oracle home by running OUI again.
- You want to make a copy of (clone) a database.
Meeting Creation Prerequisites
Before you can create a new database, the following prerequisites must be met:
- The desired Oracle software must be installed. This includes setting various environment variables unique to your operating system and establishing the directory structure for software and database files.
- Sufficient memory must be available to start the Oracle Database instance.
- Sufficient disk storage space must be available for the planned database on the computer that runs Oracle Database.
Using DBCA to Create a CDB
Oracle strongly recommends using the Database Configuration Assistant (DBCA) to create a CDB, because it is a more automated approach, and your CDB is ready to use when DBCA completes. DBCA enables you to specify the number of PDBs in the CDB when it is created.
DBCA can be launched by the Oracle Universal Installer (OUI), depending upon the type of install that you select. You can also launch DBCA as a standalone tool at any time after Oracle Database installation.
You can use DBCA to create a CDB in interactive mode or noninteractive/silent mode. Interactive mode provides a graphical interface and guided workflow for creating and configuring a CDB. Noninteractive/silent mode enables you to script CDB creation. You can run DBCA in noninteractive/silent mode by specifying command-line arguments, a response file, or both.
After a CDB is created, you can use DBCA to plug PDBs into it and unplug PDBs from it.
Using the CREATE DATABASE Statement to Create a CDB
Note:
Oracle strongly recommends using the Database Configuration Assistant (DBCA) instead of the
CREATE
DATABASE
SQL statement to create a CDB, because using DBCA is a more automated approach, and your CDB is ready to use when DBCA completes.
Example 1: Creating a CDB Without Using Oracle Managed Files
The following statement creates a CDB named
newcdb
. This name must agree with the DB_NAME
parameter in the initialization parameter file. This example assumes the following:- The initialization parameter file specifies the number and location of control files with the
CONTROL_FILES
parameter. - The directory
/u01/app/oracle/oradata/newcdb
exists. - The directory
/u01/app/oracle/oradata/pdbseed
exists. - The directories
/u01/logs/my
and/u02/logs/my
exist.
This example includes the
ENABLE
PLUGGABLE
DATABASE
clause to create a CDB with the root and the seed. This example also includes the SEED
FILE_NAME_CONVERT
clause to specify the names and locations of the seed's files. This example also includes tablespace_datafile
clauses that specify attributes of the seed's data files for the SYSTEM
and SYSAUX
tablespaces that differ from the root's.CREATE DATABASE newcdbUSER SYS IDENTIFIED BY sys_passwordUSER SYSTEM IDENTIFIED BY system_passwordLOGFILE GROUP 1 ('/u01/logs/my/redo01a.log','/u02/logs/my/redo01b.log')SIZE 100M BLOCKSIZE 512,2a.log','/u02/logs/my/redo02b.log') SIZE 100M BLOCKSIZE 512,GROUP 2 ('/u01/logs/my/redo 0 GROUP 3 ('/u01/logs/my/redo03a.log','/u02/logs/my/redo03b.log')LOGMEMBERS 3 MAXDATAFILES 1024 CSIZE 100M BLOCKSIZE 512 MAXLOGHISTORY 1 MAXLOGFILES 16 MA XHARACTER SET AL32UTF8 NATIONAL CHARACTER SET AL16UTF16 EXTENT MANAGEMENT LOCALEND ON NEXT 10240K MAXSIZE UNLIMITED SYSAUX DATAFILE 'DATAFILE '/u01/app/oracle/oradata/newcdb/system01.dbf' SIZE 700M REUSE AUTOEX T/u01/app/oracle/oradata/newcdb/sysaux01.dbf' SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED DEFAULT TABLESPACE deftbsSPACE tempts1 TEMPFILE '/u01/app/oracle/oradata/newcdbDATAFILE '/u01/app/oracle/oradata/newcdb/deftbs01.dbf' SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED DEFAULT TEMPORARY TABL E/temp01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED UNDO TABLESPACE undotbs1 DATAFILE '/u01/app/oracle/oradata/newcdb/undotbs01.dbf'SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITEDENABLE PLUGGABLE DATABASESEEDFILE_NAME_CONVERT = ('/u01/app/oracle/oradata/newcdb/','/u01/app/oracle/oradata/pdbseed/')SYSTEM DATAFILES SIZE 125M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITEDSYSAUX DATAFILES SIZE 100MUSER_DATA TABLESPACE usertbsDATAFILE '/u01/app/oracle/oradata/pdbseed/usertbs01.dbf'SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
No comments:
Post a Comment