Friday, May 6, 2016

Oracle Database 12c – Creation Of Database - Manual Method


Creating a Container Database – Using SQL *Plus 

Step-1: Create the following directory and password file under ‘/u01/app/oracle/oradata’

a. ->cdb3

Note: under ->cdb3 directory – create ‘seed’ directory
  
[oracle@12casm oracle]$ cd /u01/app/oracle/product/12.1.0.1/db_1/dbs
[oracle@12casm oracle]$ orapwd file=orapwcdb3 password=oracle entries=5 force=y 
[oracle@12casm ~]$ cd /u01/app/oracle/oradata
[oracle@12casm oracle]$ mkdir -p  cdb3/pdbseed

Step-2: Create the following directories under ‘/u01/app/oracle/admin’

a. ->cdb3

[oracle@12casm cdb1]$ cd /u01/app/oracle/admin/
[oracle@12casm admin]$ mkdir cdb3

Step-3: Create the following directories under ‘/u01/app/oracle/admin/cdb3’

a. ->dpdump
b. ->pfile
c. ->adump
d. ->xdb_wallet

[oracle@12casm admin]$ cd cdb3/
[oracle@12casm cdb3]$ mkdir dpdump xdb_wallet pfile adump

Step-4: Create the following directories under ‘/u01/app/oracle’

a. ->fast_recovery_area

[oracle@12casm pfile]$ cd /u01/app/oracle/
[oracle@12casm oracle]$ ls -lrth
[oracle@12casm oracle]$ mkdir -p fast_recovery_area/cdb3

Step-5: Create the following directories under ‘/u01/app/oracle/fast_recovery_area’

a. ->cdb3

[oracle@12casm oracle]$ cd fast_recovery_area/cdb3/

Step-6: Set the environment variables and Oracle Home Directory


[oracle@12casm ~]$ export ORACLE_SID=cdb3
[oracle@12casm ~]$ export ORACLE_HOME =  /u01/app/oracle/product/12.1.0.1/db_1

Step-7: Prepare the initcdb3.ora and place in '/u01/app/oracle/admin/cdb3/pfile/initcdb3.ora'

###########################################
# Cache and I/O
###########################################
db_block_size=8192

###########################################
# Cursors and Library Cache
###########################################
open_cursors=300

###########################################
# Database Identification
###########################################
db_domain=""
db_name="cdb3"

###########################################
# File Configuration
###########################################
control_files=("/u01/app/oracle/oradata/cdb3/control01.ctl","/u01/app/oracle/fast_recovery_area/cdb3/control02.ctl")
db_recovery_file_dest="/u01/app/oracle/fast_recovery_area"
db_recovery_file_dest_size=4800m

###########################################
# Miscellaneous
###########################################
#compatible=12.1.0.0.0
diagnostic_dest=/u01/app/oracle
enable_pluggable_database=true
memory_target=1560m

###########################################
# Processes and Sessions
###########################################
processes=300

###########################################
# Security and Auditing
###########################################
audit_file_dest="/u01/app/oracle/admin/cdb3/adump"
audit_trail=db
remote_login_passwordfile=EXCLUSIVE

###########################################
# Shared Server
###########################################
dispatchers="(PROTOCOL=TCP) (SERVICE=cdb3XDB)"

###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_tablespace=UNDOTBS

[oracle@12casm ~]$

Step-8: Login as sysdba and create spfile from pfile

[oracle@12casm ~]$ sqlplus /nolog
SQL> connect /as sysdba
SQL> startup pfile ='/u01/app/oracle/admin/cdb3/pfile/initcdb3.ora' nomount;

SQL> create spfile from pfile ='/u01/app/oracle/admin/cdb3/pfile/initcdb3.ora';
File created.

SQL> shut immediate;
SQL> startup nomount;

Step-9: Execute ‘create database’ command

SQL> create database cdb3
user sys identified by oracle user system identified by oracle
logfile group 1 ('/u01/app/oracle/oradata/cdb3/redo1a.log','/u01/app/oracle/oradata/cdb3/redo1b.log') size 50M,
group 2 
('/u01/app/oracle/oradata/cdb3/redo2a.log','/u01/app/oracle/oradata/cdb3/redo2b.log') size 50M
character set AL32UTF8 national character set AL16UTF16
extent management local datafile
                           '/u01/app/oracle/oradata/cdb3/system01.dbf' size 480M
sysaux datafile '/u01/app/oracle/oradata/cdb3/sysaux01.dbf' size 480M
default temporary tablespace tbstemp
tempfile '/u01/app/oracle/oradata/cdb3/temp01.dbf' size 50M
undo tablespace undotbs
datafile '/u01/app/oracle/oradata/cdb3/undotbs01.dbf' size 200M
enable pluggable database
seed file_name_convert = ('/u01/app/oracle/oradata/cdb3','/u01/app/oracle/oradata/cdb3/pdbseed/');
Database created.

Step-10: Run the post creation scripts

SQL> alter session set "_oracle_script"=TRUE;
Session altered.

SQL> select name,open_mode from v$pdbs;
NAME                            OPEN_MODE
------------------------------  ----------
PDB$SEED                        READ ONLY

SQL> select name,open_mode from v$database;
NAME       OPEN_MODE
---------   --------------------
CDB3       READ WRITE

Step-11: Close and Open the PDB

SQL> alter pluggable database pdb$seed close;
Pluggable database altered.

SQL> alter pluggable database pdb$seed open;
Pluggable database altered.

SQL> select name,open_mode from v$pdbs;
NAME                            OPEN_MODE
------------------------------  ----------
PDB$SEED                        READ WRITE

Step-12: Execute the scripts

a. @?/rdbms/admin/catalog.sql
b. @?/rdbms/admin/catblock.sql
c. @?/rdbms/admin/catproc.sql
d. @?/rdbms/admin/catoctk.sql
e. @?/rdbms/admin/owminst.plb
f. @?/sqlplus/admin/pupbld.sql

Step-13: Configure EM Express 

SQL> SELECT DBMS_XDB_CONFIG.gethttpport FROM dual;
SQL> SELECT DBMS_XDB_CONFIG.gethttpsport FROM dual;
SQL> EXEC DBMS_XDB_CONFIG.sethttpsport(5505);
PL/SQL procedure successfully completed.

SQL> SELECT DBMS_XDB_CONFIG.gethttpsport FROM dual;

GETHTTPSPORT
------------
        5501

1 row selected.

SQL> alter user sys identified by oracle;
User altered.

SQL> alter user system identified by oracle;
User altered.

URL: https://192.168.56.101:5505/em

No comments:

Post a Comment